Home > Archive > SQL Anywhere Mobile > March 2005 > only changed rows









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 only changed rows
omri

2005-03-30, 9:43 am

Hello There!
mobilink:9.0.1
build:1751
i want to download to ultralite database only the cahnged
rows in the consolidate so i marked in the ultralite schema
the "only changed rows" but when i activate the download
synchronize it's
blowing up the ultralite db instead of ignoring what not
changed.

thank you in advanced
Omri Zi
Reg Domaratzki \(iAnywhere Solutions\)

2005-03-30, 9:43 am

Can you describe the message you get when it's "blowing up the ultralite db"
?

--
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

<omri> wrote in message news:4247bb30.1ebc.1681692777@sybase.com...
> Hello There!
> mobilink:9.0.1
> build:1751
> i want to download to ultralite database only the cahnged
> rows in the consolidate so i marked in the ultralite schema
> the "only changed rows" but when i activate the download
> synchronize it's
> blowing up the ultralite db instead of ignoring what not
> changed.
>
> thank you in advanced
> Omri Zi



Graham Hurst

2005-03-30, 9:43 am

The data that is downloaded from the consolidated database is determined
by your download_cursor script in the consolidated database. If you let
MobiLink create that script for you, it can only create a script for
"snapshot" download (i.e. all data is downloaded each synchronization).
To only download rows that have changed since the last synchronization, see:

MobiLink Administration Guide
Synchronization Techniques
Timestamp-based synchronization

Cheers,

Graham

omri wrote:
> Hello There!
> mobilink:9.0.1
> build:1751
> i want to download to ultralite database only the cahnged
> rows in the consolidate so i marked in the ultralite schema
> the "only changed rows" but when i activate the download
> synchronize it's
> blowing up the ultralite db instead of ignoring what not
> changed.
>
> thank you in advanced
> Omri Zi

omri

2005-03-30, 9:43 am

Hi!
Thank you for the answer. but if i'll use "timestamp based
synchronization" it's means hat i'll have to change my
oracle tables (add last modified colunm) and i can't do
that.
how i use the "snapshot"??
even though i don't prephare it.
Have a nice day
Omri Ziv
[color=darkred]
> The data that is downloaded from the consolidated database
> is determined by your download_cursor script in the
> consolidated database. If you let MobiLink create that
> script for you, it can only create a script for
> "snapshot" download (i.e. all data is downloaded each
> synchronization). To only download rows that have changed
> since the last synchronization, see:
>
> MobiLink Administration Guide
> Synchronization Techniques
> Timestamp-based synchronization
>
> Cheers,
>
> Graham
>
> omri wrote:
Greg Fenton

2005-03-30, 9:43 am

omri wrote:
> Thank you for the answer. but if i'll use "timestamp based
> synchronization" it's means hat i'll have to change my
> oracle tables (add last modified colunm) and i can't do
> that.


No, not necessarily. You can create a "shadow table" for the original
table in question that holds the PK of the original table and a
"last_modified" column tracking the timestamp of the latest change to
that table. Then you need to have a trigger on the original table that
inserts or updates the shadow row whenever an original row is updated.

For your download_cursor, you simply join the original table to the
shadow table and select the rows where the last_modified is greater than
or equal to ( >= ) the last download timestamp of the remote.

> how i use the "snapshot"??


Snapshot is the default, so you likely don't need to do anything. A
snapshot is simply a SELECT without a WHERE clause (i.e. get me all rows).

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

2005-03-30, 9:43 am

Your answer is clear but:

> Snapshot is the default, so you likely don't need to do
> anything. A snapshot is simply a SELECT without a WHERE
> clause (i.e. get me all rows).


when i use simple select it's not replacing the data it's
only adding information to the ultralite (not to the
tables),
what causes my application to crash.
that's why i need to now how it's replacing the rows or
tables inside the ultralite.
thank you in advenced
Omri Ziv
p.s. i'll use the shadow table if i'll know how to relplace
the specific table


> omri wrote:
>
> No, not necessarily. You can create a "shadow table" for
> the original table in question that holds the PK of the
> original table and a "last_modified" column tracking the
> timestamp of the latest change to that table. Then you
> need to have a trigger on the original table that inserts
> or updates the shadow row whenever an original row is
> updated.
>
> For your download_cursor, you simply join the original
> table to the shadow table and select the rows where the
> last_modified is greater than or equal to ( >= ) the last
> download timestamp of the remote.
>
>
> Snapshot is the default, so you likely don't need to do
> anything. A snapshot is simply a SELECT without a WHERE
> clause (i.e. get me all rows).
>
> greg.fenton
> --
> Greg Fenton
> Consultant, Solution Services, iAnywhere Solutions
> --------
> Visit the iAnywhere Solutions Developer Community
> Whitepapers, TechDocs, Downloads
> http://www.ianywhere.com/developer/

Greg Fenton

2005-03-30, 9:43 am

Omri wrote:
>
> when i use simple select it's not replacing the data it's
> only adding information to the ultralite (not to the
> tables),


I don't understand what you are trying to say here.

In ML synchronization, the consolidated is King. Whatever data it sends
down to the remote is to be applied. If the row already exists, it is
overwritten with the new values sent down by the consolidated.

What do you mean "not to the tables" ?


> what causes my application to crash.


How do you mean "crash"?
How do you know it is the download that is causing this?
Are you able to get the SQLCode after synchronization is complete?


> p.s. i'll use the shadow table if i'll know how to relplace
> the specific table


What do you mean by "replace the specific table" ?

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

2005-03-31, 7:02 am

Hello and thanks for the answers, let me be more detailed
1. I'm using simple select in download_cursor event.
2. When I'm using upload it's on "only changed rows" but
it's not relevant because the troubles I have only on
download stream.
3. when I'm doing download to the same data from the
consolidate to the ultralite the size of the ultralite is
growing by few kb (sometime 100 sometime less)
when it should be stay the same size and ignore the download
stream.
4. I probably use snapshot because it's the default.
5. if you want I can give you ultralite after one download
and one after I do second download to the same data.
6. if you have a tool to extract the ultralite it will be
nice
7. when i said to replace specific tanle i ment to download
only one table or more by simple condition


best regards ,
omri ziv
QIS ltd

Omri@qis.co.il



> Omri wrote:
>
> I don't understand what you are trying to say here.
>
> In ML synchronization, the consolidated is King. Whatever
> data it sends down to the remote is to be applied. If
> the row already exists, it is overwritten with the new
> values sent down by the consolidated.
>
> What do you mean "not to the tables" ?
>
>
>
> How do you mean "crash"?
> How do you know it is the download that is causing this?
> Are you able to get the SQLCode after synchronization is
> complete?
>
>
>
> What do you mean by "replace the specific table" ?
>
> greg.fenton
> --
> Greg Fenton
> Consultant, Solution Services, iAnywhere Solutions
> --------
> Visit the iAnywhere Solutions Developer Community
> Whitepapers, TechDocs, Downloads
> http://www.ianywhere.com/developer/

Greg Fenton

2005-03-31, 8:04 pm

Omri wrote:
> 3. when I'm doing download to the same data from the
> consolidate to the ultralite the size of the ultralite is
> growing by few kb (sometime 100 sometime less)
> when it should be stay the same size and ignore the download
> stream.


A remote will *never* ignore the download. When ML sends down a row,
the remote applies that row even if the row is not modified. This is
one of the reasons that you should be looking to timestamp-based
synchronization: only send the rows down that the remote needs, based
on what has changed since its last successful download. The other main
benefit is that you then are transmitting less data over the network.


> 4. I probably use snapshot because it's the default.


Going to timestamp-based is a simple process once you have the
"last_modified" column added to your schema (directly on base table or
in shadow table, along with trigger(s) to maintain the date). You
simply add a WHERE clause to the download_cursor (possibly with a JOIN
to the shadow table).


> 5. if you want I can give you ultralite after one download
> and one after I do second download to the same data.


Not necessary as I think I've explained why you are seeing what you are
seeing.

> 6. if you have a tool to extract the ultralite it will be
> nice


Take a look at the "ulconv" tool that was newly added to 9.0.1. In the
ASA 9.x online docs see:

UltraLite Database User's Guide
UltraLite Utilities Reference
- The ulconv utility

Hope this helps,
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