Home > Archive > SQL Anywhere Mobile > March 2005 > Download cursor









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 Download cursor
Roger Nygård

2005-03-30, 9:43 am

MSSQL 2000
SQLANY 803
Win2000server

I use a shadow table for each table in the database to track changes
How do I prevent uploaded records to came in the download stream at the same
sync. session?

Roger Nygård

Here is the trigger for the tables..:

CREATE TRIGGER CUSTOMERTYPE_iu
ON CUSTOMERTYPE
AFTER INSERT, UPDATE AS
INSERT TellusChanges (TellusTable, Last_Modified, UpdateType,pk_1,pk_2
)
(select 'CUSTOMERTYPE', getDate(), 'I', convert (varchar(10),
inserted.DBOWNER_ID) , convert (varchar(10), inserted.CUSTOMERTYPE_ID)
from inserted)

Here is the download cursor:

SELECT DBOWNER_ID, CUSTOMERTYPE_ID, RTrim(NAME)
FROM CUSTOMERTYPE, TellusChanges
where TellusChanges. TellusTable='CUSTOME
RTYPE' AND
TellusChanges.UpdateType='I' AND
TellusChanges.Last_Modified > ? AND
CUSTOMERTYPE.DBOWNER_ID = Convert(int, TellusChanges.pk_1) AND
CUSTOMERTYPE.CUSTOMERTYPE_ID = Convert(int, TellusChanges.pk_2) AND
TellusChanges.telluschanges_id = (select max (t.TellusChanges_id)
from telluschanges t
where t.tellustable =
telluschanges.tellustable and
t.pk_1 = Telluschanges.pk_1 AND
t.pk_2 = Telluschanges.pk_2)


Reg Domaratzki \(iAnywhere Solutions\)

2005-03-30, 9:43 am

Assumption : You were asking how to filter out rows that were passed up in
the upload from the download stream in the same synchronization.

MobiLink should do this automatically for you. If the image of the row that
was uploaded matches the image of the row returned in the download cursor,
it will not be placed in the download stream. It's probably you're
"RTRIM(Name)" in the download cursor that is causing the rows not to be
filtered. If MobiLink thinks the row has changed since it was uploaded, it
will be sent down in the download stream.



--
Reg Domaratzki, Sybase iAnywhere Solutions
Sybase Certified Professional - Sybase ASA Developer Version 8
Please reply only to the newsgroup

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm
-> Choose SQL Anywhere Studio
-> Set "Platform Preview" and "Time Frame" to ALL

"Roger Nygård" <roger@askit.no> wrote in message
news:42382bc5@forums
-1-dub...
> MSSQL 2000
> SQLANY 803
> Win2000server
>
> I use a shadow table for each table in the database to track changes
> How do I prevent uploaded records to came in the download stream at the

same
> sync. session?
>
> Roger Nygård
>
> Here is the trigger for the tables..:
>
> CREATE TRIGGER CUSTOMERTYPE_iu
> ON CUSTOMERTYPE
> AFTER INSERT, UPDATE AS
> INSERT TellusChanges (TellusTable, Last_Modified, UpdateType,pk_1,pk_2
)
> (select 'CUSTOMERTYPE', getDate(), 'I', convert (varchar(10),
> inserted.DBOWNER_ID) , convert (varchar(10), inserted.CUSTOMERTYPE_ID)
> from inserted)
>
> Here is the download cursor:
>
> SELECT DBOWNER_ID, CUSTOMERTYPE_ID, RTrim(NAME)
> FROM CUSTOMERTYPE, TellusChanges
> where TellusChanges. TellusTable='CUSTOME
RTYPE' AND
> TellusChanges.UpdateType='I' AND
> TellusChanges.Last_Modified > ? AND
> CUSTOMERTYPE.DBOWNER_ID = Convert(int, TellusChanges.pk_1) AND
> CUSTOMERTYPE.CUSTOMERTYPE_ID = Convert(int, TellusChanges.pk_2) AND
> TellusChanges.telluschanges_id = (select max (t.TellusChanges_id)
> from telluschanges t
> where t.tellustable =
> telluschanges.tellustable and
> t.pk_1 = Telluschanges.pk_1

AND
> t.pk_2 = Telluschanges.pk_2)
>
>



David Fishburn

2005-03-30, 9:43 am

"Roger Nygård" <roger@askit.no> wrote in news:42382bc5@forums
-1-dub of
sybase.public.sqlanywhere.mobilink:

RN> MSSQL 2000
RN> SQLANY 803
RN> Win2000server

Please ALWAYS include version and MORE importantly BUILD number
with EACH post (dbeng9 -v).

RN> I use a shadow table for each table in the database to track changes
RN> How do I prevent uploaded records to came in the download stream at
RN> the same sync. session?

Is there a reason you didn't simply add a datetime field to the table?
You would still need the shadow table to track deletes, but it would be
much simplier.

....
RN> Here is the trigger for the tables..:
RN>
RN> CREATE TRIGGER CUSTOMERTYPE_iu
RN> ON CUSTOMERTYPE
RN> AFTER INSERT, UPDATE AS
RN> INSERT TellusChanges (TellusTable, Last_Modified,
RN> UpdateType,pk_1,pk_2
)
RN> (select 'CUSTOMERTYPE', getDate(), 'I', convert
RN> (varchar(10),
RN> inserted.DBOWNER_ID) , convert (varchar(10),
inserted.CUSTOMERTYPE_ID)
RN> from inserted)
RN>
RN> Here is the download cursor:
RN>
RN> SELECT DBOWNER_ID, CUSTOMERTYPE_ID, RTrim(NAME)
RN> FROM CUSTOMERTYPE, TellusChanges
RN> where TellusChanges. TellusTable='CUSTOME
RTYPE' AND
RN> TellusChanges.UpdateType='I' AND
RN> TellusChanges.Last_Modified > ? AND
RN> CUSTOMERTYPE.DBOWNER_ID = Convert(int, TellusChanges.pk_1) AND
RN> CUSTOMERTYPE.CUSTOMERTYPE_ID = Convert(int, TellusChanges.pk_2) AND
RN> TellusChanges.telluschanges_id = (select max
RN> (t.TellusChanges_id)
RN> from telluschanges t
RN> where t.tellustable =
RN> telluschanges.tellustable and
RN> t.pk_1 =
RN> Telluschanges.pk_1 AND
RN> t.pk_2 = Telluschanges.pk_2)

Can you describe why this query has to be so complex?
What is it trying to do?

--
David Fishburn
Certified ASA Developer Version 8
iAnywhere Solutions - Sybase
Professional Services
Please only post to the newsgroup
Please ALWAYS include version and MORE importantly BUILD number with
EACH post (dbeng9 -v).

EBFs and Maintenance Releases
http://downloads.sybase.com/swx/sdmain.stm

Developer Community / Whitepapers
http://www.ianywhere.com/developer

CaseXpress - to report bugs
http://casexpress.sybase.com

CodeXchange - Free samples
[url]http://ianywhere.codexchange.sybase.com/servlets/ ProjectDocumentList[
/url]

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