|
Home > Archive > SQL Anywhere Mobile > May 2005 > Using Host Variables When creating a mobilink user and creating a subscription
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Using Host Variables When creating a mobilink user and creating a subscription
|
|
| Chance 2005-05-16, 8:24 pm |
| Hi,
I'm using Powerbuilder and I would like to dynamically add users and
subscriptions based on information I have the user enter. However, I don't
know how to express this as an embedded SQL statement in Powerbuilder.
This is what I want to do:
1. CREATE SYNCHRONIZATION USER XEON ADDRESS 'host=64.105.19.195;port=2439'
//Whereby XEON, I.P. address and port are variables.
2.CREATE SYNCHRONIZATION SUBSCRIPTION TO Booklog FOR XEON
//Whereby XEON is a variable.
Can anyone help out?
tia,
chance.
| |
| Breck Carter [TeamSybase] 2005-05-16, 8:24 pm |
| Use PowerBuilder's EXECUTE IMMEDIATE.
Breck
On 16 May 2005 12:16:51 -0700, "Chance" <chance@booklog.com> wrote:
>Hi,
>I'm using Powerbuilder and I would like to dynamically add users and
>subscriptions based on information I have the user enter. However, I don't
>know how to express this as an embedded SQL statement in Powerbuilder.
>This is what I want to do:
>
>1. CREATE SYNCHRONIZATION USER XEON ADDRESS 'host=64.105.19.195;port=2439'
>//Whereby XEON, I.P. address and port are variables.
>
>2.CREATE SYNCHRONIZATION SUBSCRIPTION TO Booklog FOR XEON
>//Whereby XEON is a variable.
>
>Can anyone help out?
>
>tia,
>chance.
>
--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/A...7/risingroad-20
bcarter@risingroad.com
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
| |
| Chance 2005-05-16, 8:24 pm |
| Yes, but what do the SQL statements look like when specifying variables?
"Breck Carter [TeamSybase]" < NOSPAM__bcarter@risi
ngroad.com> wrote in
message news:upsh81lo2lha7rh
kjkt54103bgrjjqc6s1@
4ax.com...
> Use PowerBuilder's EXECUTE IMMEDIATE.
>
> Breck
>
> On 16 May 2005 12:16:51 -0700, "Chance" <chance@booklog.com> wrote:
>
>
> --
> SQL Anywhere Studio 9 Developer's Guide
> Buy the book:
> http://www.amazon.com/exec/obidos/A...7/risingroad-20
> bcarter@risingroad.com
> RisingRoad SQL Anywhere and MobiLink Professional Services
> www.risingroad.com
| |
| Breck Carter [TeamSybase] 2005-05-16, 8:24 pm |
| You build up character strings containing the entire command; no
embedded host variables, just string literals *inside* the EXECUTE
IMMEDIATE string.
ls_sql = "CREATE SYNCHRONIZATION USER " &
+ ls_site_name &
+ " ADDRESS 'host=" &
+ ls_ip &
+ ";port=" &
+ ls_port &
+ "'"
EXECUTE IMMEDIATE :ls_sql USING SQLCA;
IF SQLCA.SQLCode <> 0 THEN
... error
ls_sql = "CREATE SYNCHRONIZATION SUBSCRIPTION TO Booklog FOR " &
+ ls_site_name
EXECUTE IMMEDIATE :ls_sql USING SQLCA;
IF SQLCA.SQLCode <> 0 THEN
... error
(Caveat Emptor: I just typed that from memory, no testing done :)
Breck
On 16 May 2005 12:28:17 -0700, "Chance" <chance@booklog.com> wrote:
>Yes, but what do the SQL statements look like when specifying variables?
>
>
>"Breck Carter [TeamSybase]" < NOSPAM__bcarter@risi
ngroad.com> wrote in
>message news:upsh81lo2lha7rh
kjkt54103bgrjjqc6s1@
4ax.com...
>
--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/A...7/risingroad-20
bcarter@risingroad.com
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
| |
| Chance 2005-05-16, 8:24 pm |
| Thanks! That worked.
"Breck Carter [TeamSybase]" < NOSPAM__bcarter@risi
ngroad.com> wrote in
message news:o6th81l9i8ofpgp
r0lg50l2tllcluk9nh8@
4ax.com...
> You build up character strings containing the entire command; no
> embedded host variables, just string literals *inside* the EXECUTE
> IMMEDIATE string.
>
> ls_sql = "CREATE SYNCHRONIZATION USER " &
> + ls_site_name &
> + " ADDRESS 'host=" &
> + ls_ip &
> + ";port=" &
> + ls_port &
> + "'"
>
> EXECUTE IMMEDIATE :ls_sql USING SQLCA;
> IF SQLCA.SQLCode <> 0 THEN
> ... error
>
> ls_sql = "CREATE SYNCHRONIZATION SUBSCRIPTION TO Booklog FOR " &
> + ls_site_name
>
> EXECUTE IMMEDIATE :ls_sql USING SQLCA;
> IF SQLCA.SQLCode <> 0 THEN
> ... error
>
> (Caveat Emptor: I just typed that from memory, no testing done :)
>
> Breck
>
>
> On 16 May 2005 12:28:17 -0700, "Chance" <chance@booklog.com> wrote:
>
>
> --
> SQL Anywhere Studio 9 Developer's Guide
> Buy the book:
> http://www.amazon.com/exec/obidos/A...7/risingroad-20
> bcarter@risingroad.com
> RisingRoad SQL Anywhere and MobiLink Professional Services
> www.risingroad.com
|
|
|
|
|