|
Home > Archive > SQL Anywhere Mobile > July 2005 > Howto: upload a table and delete it in the remote
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 |
Howto: upload a table and delete it in the remote
|
|
| Ignacio Mateos 2005-07-07, 9:23 am |
| Hi to all:
I think this one should be simple, I have a table in the remote that I need
to upload to the consolidated.
I have written this script for the Upload_Insert event:
INSERT
INTO log( door, loc_ac, time_ac, date_time, inout, chipno, smartcard,
nameoncard, granted, deny_code, pwk )
VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? , ?)
It works, but I would also like to delete all records from the remote once
they have been uploaded (why? because sometimes if the remote user gets
reset or something, they get uploaded again and the sync aborts with
duplicate keys, and after all, once they are in the consolidated I do not
need them anymore in the remote).
Is there an event or a way to program in the sync that these records be
deleted on the remote (and the deletes not propagated to the consolidated,
of course).
Regards
| |
| Reg Domaratzki \(iAnywhere Solutions\) 2005-07-07, 11:24 am |
| What version and build number of MobiLink are you using? If your MobiLink
server and MobiLink clients are v802.3549 or up, then you can use the
following feature :
MobiLink Administration Guide
Writing Synchronization Scripts
Writing scripts to download rows
Writing download_delete_curs
or scripts
Deleting all the rows in a table
When MobiLink detects a download_delete_curs
or with a row that contains all
NULLs, it deletes all the data in the remote table. The number of NULLs in
the download_delete_curs
or can be the number of primary key columns or the
total number of columns in the table. For example, the following
download_delete_curs
or SQL script deletes every row in a table in which
there are two primary key columns. This example works for Adaptive Server
Anywhere, Adaptive Server Enterprise, and Microsoft SQL Server databases.
SELECT NULL, NULL
In IBM DB2 and Oracle consolidated databases, you must specify a dummy table
to select NULL. For IBM DB2 7.1, you can use the following syntax:
SELECT NULL FROM SYSIBM.SYSDUMMY1
For Oracle consolidated databases, you can use the following syntax:
SELECT NULL FROM DUAL
--
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
"Ignacio Mateos" <imateos@telefonica.net> wrote in message
news:42cd3f41$1@foru
ms-2-dub...
> Hi to all:
>
> I think this one should be simple, I have a table in the remote that I
need
> to upload to the consolidated.
>
> I have written this script for the Upload_Insert event:
>
> INSERT
> INTO log( door, loc_ac, time_ac, date_time, inout, chipno, smartcard,
> nameoncard, granted, deny_code, pwk )
> VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? , ?)
>
> It works, but I would also like to delete all records from the remote once
> they have been uploaded (why? because sometimes if the remote user gets
> reset or something, they get uploaded again and the sync aborts with
> duplicate keys, and after all, once they are in the consolidated I do not
> need them anymore in the remote).
>
> Is there an event or a way to program in the sync that these records be
> deleted on the remote (and the deletes not propagated to the consolidated,
> of course).
>
> Regards
>
>
|
|
|
|
|