Foreign/Primary Keys as CHAR - limitations?
Posted: Mon 06 Aug 2007 15:46
Hello,
What are limitations of Foreign/Primary Keys in MyDAC? I have tables:
xLevel.symbol is a Foreign key for a Primary key xUser.level and it is a type of CHAR(1).
In TD when I put on form two TMyTables, two TMyDataSources, use custom fields for xUser table, and set the field properties for TStringField("level") as:
Michal
What are limitations of Foreign/Primary Keys in MyDAC? I have tables:
Code: Select all
CREATE TABLE xLevel (
symbol CHAR(1) NOT NULL PRIMARY KEY,
name VARCHAR(32) NULL ) TYPE=InnoDB;
CREATE TABLE xUser (
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
level CHAR(1) NOT NULL,
firstname VARCHAR(32) NULL,
lastname VARCHAR(32) NULL,
INDEX x1(level),
FOREIGN KEY(level) REFERENCES xLevel(symbol) ON DELETE NO ACTION ON UPDATE NO ACTION ) TYPE=InnoDB;In TD when I put on form two TMyTables, two TMyDataSources, use custom fields for xUser table, and set the field properties for TStringField("level") as:
- KeyFields: level
LookupDataSet: MyTableLevel (xLevel)
LookupKeyFields: symbol
LookupResultField: name
FieldKinf:fkLookup
Michal