[bug_fixed] TZSequence error, value from prior database

In this forum all bug reports concerning the 6.x branch will be gahtered. You have the possibility to track the bug fix process.

Moderators: EgonHugeist, mdaems

Post Reply
martinalex
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: 21.12.2005, 16:54

[bug_fixed] TZSequence error, value from prior database

Post by martinalex »

TZSequence works fine within one database. I read a generator value with

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
      begin
        SQL.Clear;
        SQL.Add('select gen_id(book_gen, 0) as gen ');
        SQL.Add('from rdb$database ');
        Open;
        if RecordCount > 0 then
        begin
          First;
          genVal := FieldValues['gen'];
        end; {if}
        Close;
      end; {with}  
I could not find the error. I guess the error is in some initialization routine in ZDbcInterbase6. TZInterbase6Sequence.GetCurrentValue returns the wrong value.



I use
Win XP Pro SP2
Delphi 7
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
You do not have the required permissions to view the files attached to this post.
martinalex
Fresh Boarder
Fresh Boarder
Posts: 17
Joined: 21.12.2005, 16:54

Re: TZSequence error, value from prior database + workaround

Post by martinalex »

I have checked the bug again with the new Zeos version 6.6. The error still exists.

Code: Select all

genVal := ZSequence1.GetCurrentValue;
The generator value is from the prior database, if another database has been opened before.

The workaround is easy, but not portable to other datbases, because the Firebird database is accessed directly, system table rdb$database

Martinalex
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi,

Sorry, I don't use Firebird, so as long as nobody else tests this we'll have to search together for the solution.
Can you make a tracefile of what queries are issued in both cases by putting a ZSqlMonitor in your example? Possibly Zeoslib adds some database indication in your query that is initialized only once when using a ZSequence component.

I'll add this to the new Mantis bug tracker (See portal announcements for more info on new bug reporting).

Mark
User avatar
cipto_kh
Senior Boarder
Senior Boarder
Posts: 83
Joined: 28.09.2005, 11:22
Location: Indonesia
Contact:

Post by cipto_kh »

Please check the patch in Mantis bug, I already patch for that bug but need more test and suggestion if any :)
Post Reply