Re: Checksum and Objects
- From: "MikeA" <appell@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 12 Aug 2009 00:24:43 -0700
I can't use CompObj because I need to compare data offline. The ultimate
goal here is to allow my users to click a button and all their data from
their laptop computer is synced to the file server. I've written a
client/server app in VFP with a socket to accomplish all this.
With regards to the problem at hand...
For example, I might have a 50,000 record table that might have say 50
fields per record and the file is 50 megs. I need to figure out what
records have changed without downloading the entire 50 megs to a laptop
computer (and that is just one table alone). I realize I could add a field
and track changes but I'm not sure if that is the best route to take at this
time. In other words I could have a DateLastChanged field but that might
not be ideal in this situation.
Anyways, imagine a table on a laptop computer. The laptop needs to know
what records have changed and I only want to download those records that
have changed rather than the entire 50 meg table (one of several). I've
written a client server app in VFP so they just click a button and it uses a
socket to connect to the server and the server can then send it the changed
records. In this way they can work "offline" and sync changes later.
I calculated the time to create a checksum of a sample 20,000 record table
with almost 50 fields that is close to 40 megs using a DO CASE statement and
it took 20 seconds to generate all the checksums in a temp table. This is
actually quicker than I thought. The temp table size is clearly just over
100K which is a lot smaller than 40 megs and would be very quick to transfer
and then compare the checksums and send the information back to request the
changed records.
I'm not sure - maybe I am going about this all wrong and I should have a
field that tracks the last time the record was changed or maybe just a field
that has the checksum in it already. Then I can upload all the checksums
from the laptop to figure out which records have changed and do it that way
instead.
This "two way syncing" is sure very complicated when you throw in multiple
tables, attachments, relations, etc. It works, but it's just complicated.
All ideas welcome on how to do this. I'm very clear on how to track changes
they make offline on their laptop. That is easy. I then upload those
changes to the main database but then I have to figure out what has changed
on the server so as to quickly download the changes rather than doing a
"full sync" which can be reserved for when they bring their laptops on site.
Thanks for the input and ideas.
Mike
"Stefan Wuebbe" <stefan.wuebbe@xxxxxx> wrote in message
news:OCObQbxGKHA.3888@xxxxxxxxxxxxxxxxxxxxxxx
Hi, Try CompObj()
hth
-Stefan
MikeA wrote:
There's probably not an easy way to do this but I thought I would ask
anyways.
We can easily get a checksum on a string like this:
lnChkSum = sys(2007, mystring)
Now, suppose I want to QUICKLY compare all the fields in different
records in two different tables without using fcount and having to
compare every field. Is there some quick way to do this?
Ideally I would love something like this:
scatter name loFlds
lnChkSum = sys(2007, loFlds)
but obviously that won't work. The fields in the record could be a
combination of logical fields, numeric, character and possibly memo as
well.
Any quick way to do this? If it were just one record it would be no
problem to use fcount but I need to check the entire table which could be
thousands of records and I need to do it FAST and compact. By compact
what I mean is I'm doing a remote sync so I want to grab all the
checksums, download them, compare them and then sync changes.
Thanks,
Mike
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
.
- References:
- Checksum and Objects
- From: MikeA
- Re: Checksum and Objects
- From: Stefan Wuebbe
- Checksum and Objects
- Prev by Date: Re: Checksum and Objects
- Next by Date: Re: BACKSPACE
- Previous by thread: Re: Checksum and Objects
- Next by thread: Re: Checksum and Objects
- Index(es):