Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finally hit by integer surrogate keys:(
Message
From
17/10/2006 09:42:54
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
17/10/2006 09:23:55
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01162506
Message ID:
01162543
Views:
15
>>>>(Why I have integer surrogate keys in the first place is not my fault-I'm maintaining and can't change the base tables).
>>>>
>>>>I need to work with tables offline. So:
>>>>-I create a separate view with only view definitions in it (one table-one view).
>>>>-Take them offline to a mobile place.
>>>>
>>>>When they need to be updated is there a way to do that just using tableupdate() or alike instead of checking per table (using getnextmodified) and doing record by record insert/update/delete?
>>>>Browsed all documentation about it + some tests to no avail:(
>>>>TIA.
>>>>Cetin
>>>
>>>add a ts
>>
>>Nice Fabio I even wanted to add a GUID but where:)
>>Cetin
>
>ts is a timestamp, GUID is a global id and id is a table's id .
>
>I have not understood what you have to do,
>but ts it is necessary.
>
>1) Want you implement a
>master/slave replication
>or
>peer to peer replication ?
>
>Where do the changes happen?
>
>Will The tables have a primary key, correct?
>
>The views are created with CREATEOFFLINE ?

OK let me try to a bit more clear:

TableA, TableC,...tableN all have integer primary keys generated via stored proc (modified version of NewID()).

Tables have PK-FK relationships.

I need to take them offline, work on them and get back.

Let's sample with testdata.dbc:

A new customer is inserted offline. Key is not yet known (will be assigned later, only have a key which is valid in offline set).

Multiple orders are inserted for this customer. Again keys are valid for offline set, also FK cust_id is locally valid.

Per each order orditems are inserted using locally valid FK.

Now when this data gets back to online would this work (actually up till now I didn't use views so not sure-testing different scenarios):
If I create the PK-FK relations with cascade in views before I take them offline, use online exclusive, tableupdate(). Would all tables get correct PK-FK generated on master db? This would need a special care on the order of tableupdates but I can handle it ( around 120 tables:( ) if that would work.
Otherwise what I do is to:
Take an offline view (use online exclusive):
GetNextModified loop.
insert/update.
Get pkey assigned
Update FKs in referenced tables.

Hope it's understandable now.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform