genVal := ZSequence1.GetCurrentValue;
But when I close the database and open another database the generator value is from the prior database.
Workaround is not to use TZSequence, but to read the generator value from the Firebird system table with a query. TZQuery does work properly. This is basically what the TZSequence component does internally.
Code: Select all
with queryGen do
SQL.Add('select gen_id(book_gen, 0) as gen ');
SQL.Add('from rdb$database ');
if RecordCount > 0 then
genVal := FieldValues['gen'];
I could not find the error. I guess the error is in some initialization routine in ZDbcInterbase6. TZInterbase6Sequence.GetCurrentValue returns the wrong value.
Win XP Pro SP2
Firebird 2.0 RC2
ZeosDBO 6.5.1 cvs - oct 13th 2005.
Attached is a test program ‘gentest’ which shows the error and the workaround.
Required: 2 Firebird database files, each database contains the same generator, but with different values.
For the test program I have used: database: db1.fdb and db2.fdb; generator: gen