Board index » delphi » Referential Integrity at runtime

Referential Integrity at runtime

See the examples for DbiDoRestructure at
www.borland.com/devsupport/bde/bdeapiex.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

 

Re:Referential Integrity at runtime


I make at runtime a new table with TTable.create. This work fine.
How can i make at runtime a referential integrity. if posible with a
example.

Regards,

Rob Krapels (NL)

Re:Referential Integrity at runtime


Hi Rob,
the dbiDoRestructure suggested by Bill is
the way to go. You must, however, keep in mind that,
if you have multiple level referential integrities in your database,
the order in which you set the new ones is important -
you cannot make the table that already is referential integrity
master the detail table in another referential integrity.
You might consider an alternative - PXUPGR utility (shareware)
stored at http://www.rksolution.cz/delphi/pxupgr.htm
that would save you a lot of work otherwise spent at
mastering BDE API.
--
Roman
(please remove 'stopspam' in header when replying)
mail: i...@rksolution.cz
URL: www.rksolution.cz

Rob Krapels p1e ve zprv <824amq$mg...@forums.borland.com>.

Quote
>I make at runtime a new table with TTable.create. This work fine.
>How can i make at runtime a referential integrity. if posible with a
>example.

>Regards,

>Rob Krapels (NL)

Re:Referential Integrity at runtime


Rob,

Try this: ParadoxQuery:
http://home.wanadoo.nl/abacadabra/index.html

ParadoxQuery is a Delphi component that enables you to use standard SQL
to create paradox tables. You can also call it extended local SQL
. You don't have to call any complex
BDE function from now on.

ParadoxQuery enables you to declare
- foreign key constraints,
- null constraints,
- unique constraints,
- defaultvalues and
- check constraints
the same way you would do for SQL databases. Both column and table
constraints are supported.

Declaration of foreign keys will result in Referential Integrity
checks, declaration of a not null constraint will result in a required
field, declaration of unique constraints can result in a unique index
and declaration of a check constraint will result in one or more
validity checks.

ParadoxQuery is available for Delphi 3, 4 and 5.

== Some examples ==

The following examples will result in paradox tables including validity
checks, referential integrity and eventually unique-indexes.

CREATE TABLE Team_product(
FK_Team_number VARCHAR(10) NOT NULL,
FK_Prod_id INTEGER NOT NULL,
FOREIGN KEY (FK_Team_number) REFERENCES team (Team_number),
FOREIGN KEY (FK_Prod_id) REFERENCES product (Prod_id),
PRIMARY KEY (FK_Team_number,FK_Prod_id));

CREATE TABLE Maintenance_team(
Team_number VARCHAR(10) NOT NULL PRIMARY KEY,
Team_name VARCHAR(20) NOT NULL,
Team_leader VARCHAR(50) NOT NULL DEFAULT "Nobody",
Location VARCHAR(30),
Money_For_Team MONEY DEFAULT 0 CHECK (Money_For_Team>10),
UNIQUE(Team_name, Team_Leader))

== download ==

The component is available for download at:
http://home.wanadoo.nl/abacadabra/index.html
- exe-demo included
- supported syntax included

---
Rick van Doorn mailto:abacada...@wanadoo.nl
Abacadabra Software
http://home.wanadoo.nl/abacadabra/index.html

Rob Krapels schreef:

Quote
> I make at runtime a new table with TTable.create. This work fine.
> How can i make at runtime a referential integrity. if posible with a
> example.

> Regards,

> Rob Krapels (NL)

Re:Referential Integrity at runtime


Thanks Bill,
but with the answer I have another Q.
what must I fill in in (example 9) the procedure AddRI(Master, Detail:
TTable; RIName: string; ModOp, DelOp: RINTQual) and spec in Modop and Delop?
If I fill in the fieldname i will get a error , not RINTQual.

regards,
Rob Krapels (NL).

Bill Todd (TeamB) <b...@dbginc.com> wrote in message
news:824ehj$qfd3@forums.borland.com...

Quote
> See the examples for DbiDoRestructure at
> www.borland.com/devsupport/bde/bdeapiex.

> --
> Bill

> Bill Todd (TeamB)
> (TeamB cannot respond to questions received via email)

Re:Referential Integrity at runtime


Sorry. I am not sure what the answer to your question is. Perhaps someone
else can help.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Re:Referential Integrity at runtime


On Sun, 5 Dec 1999 21:33:31 +0100, "Rob Krapels" <krap...@casema.net>
wrote:

Quote
>what must I fill in in (example 9) the procedure AddRI(Master, Detail:
>TTable; RIName: string; ModOp, DelOp: RINTQual) and spec in Modop and Delop?
>If I fill in the fieldname i will get a error , not RINTQual.

From BDE.INT on your Delphi's DOC directory (that's where you find the
defines for the BDE):

  RINTQual = (                  { Ref integrity action/qualifier }
    rintRESTRICT,               { Prohibit operation }
    rintCASCADE                 { Cascade operation }
  );

HTH,

Jan

Re:Referential Integrity at runtime


Thanks you all.
Now its work.

Rob Krapels (NL)

Other Threads