Article View: borland.public.interbase.replication
Article #712Provide updates to distributed database
From: Synergy
Date: Wed, 10 Oct 2001 18:26
Date: Wed, 10 Oct 2001 18:26
64 lines
4154 bytes
4154 bytes
Hi,
I have recently finished an application using BCB4 and IB 6. I have a
difficult time planning how to provide updates to the databases that I would
eventually distribute. Sorry this may be long to read ... but I really hope
someone with a thorough understanding of the problem can help.
I have a material database with a table for material, a table for
material_class, and a table called material_class_link that gives the
many-to-many relationship between material and material class by storing the
primary keys for each table.
Now, the primary key for a newly inserted material or material class would
have the value of the material and material class generator plus 1
respectively. Therefore, the same material classes inserted in different
orders will end up with different primary key schemes. This is what will
happen once different users start to use their own copy of our software.
We are required to provide an update for any new materials that we added.
Please note that we are not looking for total synchronization for all the
distributed material databases, since different users may want to keep
certain records to themselves.
The first problem is that with any replicator, straight replication of the
material record that we wish to pass over will result in a conflict with the
user's primary key scheme. The more tricky problem is that even if we find
a way to copy over a material record, the material class keys that we copy
over will not likely retrieve the right material classes for the material in
someone else's database. Worse yet, material class is only one such
many-to-many relationship that we have to deal with!
I am quite new to database programming and I really want to learn what is an
expert's solution to this problem. Please ask for any clarification that you
may need to further understand my problem.
Thank you,
Frank Liu
(Below is my propose solution, a big problem though: this is a time
consuming process to build a large update)
//--------------------------------------------------------------------------
-----------
1) Use an utility to extract the insert statement from every table
associated with a material record that we wish to pass onto
everyone.
2) Search the distributed databases, using the material name, for the
material record. If they don't have it, generate a new material
primary key from their generator, insert the new material
record.
3) Search their databases for the material class records that need to be
associated with the material record that we are passing on. If
they have the material classes, record the key values,
else insert the necessary material classes then record the
key values. Use these key values and the material key in an insert
statement to update the material_class link table.
4) Repeat 3) for all the many-to-many relationships that are associated
with the material.
5) Graphics blobs has to be inserted separately because the extract
insert
statements done in 1) doesn't take care of them.
With all this work ... I think I might just as well ask the users to type
the record directly into their database.
Technical Details
Message-ID:
<3bc49371$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f89d7,a98bab5788e4f103,start X-Google-Attributes: gidf89d7,public X-Google-ArrivalTime: 2001-10-10 11:39:04 PST From: "Synergy" <fwliu@interchange.ubc.ca> Newsgroups: borland.public.interbase.replication Subject: Provide updates to distributed database Date: Wed, 10 Oct 2001 11:26:57 -0700 Lines: 66 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 208.181.138.19 Message-ID: <3bc49371$1_1@dnews> X-Trace: dnews 1002738545 208.181.138.19 (10 Oct 2001 11:29:05 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews