Subject | Primary key generators |
---|---|
Author | ivoras |
Post date | 2004-08-19T01:13:03Z |
Occasionally, I need to use Firebird with Delphi to create nice GUI
database applications, and I've always had this problem bugging me.
I've worked around it most of the time, but I always feel that there
needs to be a better/more elegant way. The problem is:
I'm using the IBX components shipped with Delphi (7), and when I have
an "ID" column, which is of autoincrement behaviour (using a
generator), and a primary key, I don't "see" the ID on a newly
inserted record.
I noticed the ProviderFlags property (of a field), which
looks like it should influence the re-fetching of the newly generated
ID field, but either it doesn't work as I think it should, or I'm
misusing it :)
There is a second part of the problem: Almost the same thing, but in a
master/detail situation: The ID of the master table should be
autogenerated, and the value propagated to the detail table (in a
foreign key field).
So, any ideas/best practices?
database applications, and I've always had this problem bugging me.
I've worked around it most of the time, but I always feel that there
needs to be a better/more elegant way. The problem is:
I'm using the IBX components shipped with Delphi (7), and when I have
an "ID" column, which is of autoincrement behaviour (using a
generator), and a primary key, I don't "see" the ID on a newly
inserted record.
I noticed the ProviderFlags property (of a field), which
looks like it should influence the re-fetching of the newly generated
ID field, but either it doesn't work as I think it should, or I'm
misusing it :)
There is a second part of the problem: Almost the same thing, but in a
master/detail situation: The ID of the master table should be
autogenerated, and the value propagated to the detail table (in a
foreign key field).
So, any ideas/best practices?