Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

ID: 23068, Client side referential integrity rules

by Kostas Terzides Email: Anonymous

DataSnap enhancement to enforce client side referential integrity rules
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 6.0  to 9.0 412 downloads
Copyright: No significant restrictions

Size: 193,326 bytes
Updated on Sun, 29 May 2005 09:51:11 GMT
Originally uploaded on Sat, 26 Feb 2005 08:11:44 GMT
SHA1 Hash: 8EF0CD3571E6694AAEF93DCBBD71D4089DE48B19
MD5 Hash: 2DA55C15EF33989CAF1CC6CAAFC1AF4F

    Explore the files in this upload

DataSnap (Midas) is a very effective and mature technology about building distributed applications. Its support for building database applications with master/ detail relationships in particular is excellent. This way data representing one to many relationships can easily be moved from client to server and vice versa with automatic transaction handling. An area where I think DataSnap didn't cover my needs in such an elegant way as I would like it to, is in cases of many to many relationships. This kind of data is usually manipulated by forming join queries on the server and sending portion of data to the client. This approach could be in some cases somewhat restrictive and as Dan Miser has noted a more user friendly way to accomplish the same thing would be to use file based Client Datasets to represent static (or rarely changing) lookup datasets.
Extending Dan's thought I tried to find a way to enforce referential integrity rules on client side (provide similar functionality that ADO .NET DataSet has) and I built two components (a TCustomClientDataSet descendant (TCustomKTClientDataSet) and a TDataSetProvider descendant TKTDataSetProvider) that achieve that and simplify applying updates of these inter-related datasets.

1) A new property PrimaryKey that cuts off dependency on Fields[0]. In prior version Fields[0] was assumed to be the primary key. All field types are now supported (not just TIntegerField types).
2) Properties AutoIncrementStep and AutoIncrementSeed that have similar meaning with the one's used in ADO. NET have been added.
3) ForeignKeys property is now a collection property and methods have been added that provide run time manipulation of referential constraints.
4) Added support for SQL servers using AutoInc columns (a new event added called OnGetLastInsertedValue)
5) Better reconciliation handling (fixed some bugs related to that)
6) No need to handle OnGetConnFldIdx event (this event doesn't exist any more). This is now managed automatically
7) Better clone support (fixed some relevant bugs)
8) Updated help file with more comments, topics and examples
9) 3 sample applications as showcases of KT Data Component features

1) Transaction support (for stateless servers too)
2) Correct applying order (Inserted records from least dependent Cds applied first and in the reverse order for deleted records).
3) Possibility to build briefcase applications (file based) with more complicated data relations and that are really able to work as disconnected ("not so thin clients").
4) Support for usual referential integrity rules (Cascade, SetNull, SetDefault, NoAction).
5) Native TCustomClientDataSet descendant with all its features available (see restrictions for a list of things that should be considered of though).
6) No change in DBClient.pas or Provider.Pas. A simple layer of code on top of DataSnap
7) Support for clones.
8) "Foreign key" fields can belong to nested datasets too.
9) It is not necessary to Refresh a dataset after BatchApplyUpdates, since all changes needed to keep integrity are propagated back to the client.
10) As an extra there are some functions that can enhance the use of my (rather slow I have to admit) TKTDataTreeView data control.

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03