Home > Archive > SQL Anywhere Mobile > April 2006 > How skip parameter ?









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 How skip parameter ?
Fantom

2006-04-07, 9:35 am

Hi
I see this in help, but i dont find now : how skip or retry (again) use
parameter in script ?

example parametr : user,last download
1) skip paramter - script : "where last_time > ?" - i want skip parameter
'user'
2) retry paramer - script "where user1 = ? or user2 = ?"
3) use more than once time "where user1 = ? and last_download = ? and user2
= ? and last_download >'2006/01/01'"


Fantom

Breck Carter [Team iAnywhere]

2006-04-07, 9:35 am

On 7 Apr 2006 07:47:07 -0800, "Fantom"
<szczukot@skasujto.poczta.onet.pl> wrote:

>Hi
>I see this in help, but i dont find now : how skip or retry (again) use
>parameter in script ?
>
>example parametr : user,last download
>1) skip paramter - script : "where last_time > ?" - i want skip parameter
>'user'


What version are you using? The order is different in V9.

Anyway, here is the technique...

MobiLink Administration Guide

Synchronization Events

download_cursor table event

....

To write a download_cursor SQL script that does not use the first
parameter (the last_download timestamp), but does use the second
parameter (the MobiLink user name), add a dummy clause that affects no
rows. For example:

call ml_add_table_script(

'Lab',
'ULOrder',
'download_cursor',
'SELECT order_id, cust_id, prod_id, emp_id, disc,
quant, notes, status
FROM ULOrder WHERE ? IS NOT NULL AND emp_name = ?' )

>2) retry paramer - script "where user1 = ? or user2 = ?"


You have to save the value in a CREATE VARIABLE or a temporary table,
and refer to that instead of "?". You can save the values in the
begin_download event.

>3) use more than once time "where user1 = ? and last_download = ? and user2
>= ? and last_download >'2006/01/01'"


Same as 2)

Breck

--
Breck Carter [Team iAnywhere]
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
The book: http://www.risingroad.com/ SQL_Anyw...pers_Guide.html
breck.carter@risingroad.com
Greg Fenton

2006-04-07, 11:31 am

Fantom wrote:
> I see this in help, but i dont find now : how skip or retry (again) use
> parameter in script ?
>


The clearest way is to stored the values in database variables (assuming
an ASA consolidated) and use those variables in your other scripts.

For example:

begin_connection:

CREATE VARIABLE @v_ml_user VARCHAR(128);
CREATE VARIABLE @v_last_download TIMESTAMP;

begin_synchronizatio
n:

SET @v_ml_user = ?

begin_download:

SET @v_last_download = ?


Then you can use "@v_ml_user" and "@v_last_download" in your other
scripts instead of relying on those pesky "?":

download_cursor:

SELECT c1, c2, c3
FROM my_table
WHERE last_modified >= @v_last_download
AND row_belongs_to = @v_ml_user;


BTW: in the upcoming Jasper release introduces Named Parameters, meaning
that scripts will have access to various pieces of information by
directly naming them instead of those pesky "?".

greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com