Subject Re: [firebird-support] Generator only seems to increment once...?
Author brian
On Mon, 27 Apr 2015 19:13:51 +1200, you wrote:

>At 09:58 a.m. 27/04/2015, brian brian@... [firebird-support] wrote:
>
>>Hi folks,
>>
>>Has anything changed with regard to generators after Firebird 1.5?
>>I've got Helen Borrie's first version as my reference book, and in
>>there I read
>>
>>SELECT GEN_ID(<name>,<step>) FROM RDB$DATABASE;
>>
>>as the way to increment the value returned from a generator.
>>
>>I guess I should say now that I'm using the embedded server v2.5.2
>>from Lazarus/FreePascal under 64-bit Debian.
>>
>>Everything else seems to be working, I can create the database, the
>>tables, the indices, all works fine, but when I try to return values
>>from the generator it never increments. I can vary the value returned
>>by varying the step, but it's always returning (1+step) no matter how
>>many calls I make to the routine. Does anybody have any idea what I'm
>>missing, please?
>
>Did you actually create a generator?
>Assuming you're using isql from the /bin/directory of your Firebird installation:
>
>CREATE GENERATOR MYGEN;
>COMMIT;
>SELECT GEN_ID (MYGEN,1) FROM RDB$DATABASE as MyNumber;
>-- repeat this a few times.
>

I confirm that this works correctly from isql. OK, so I'm looking for
some kind of problem with executing the SQL statements via
FreePascal's TSQLQuery. That narrows it down a bit! I'm surprised that
this is where the problem lies, though. Either there's some very
unlikely bug or I've failed to understand a difference between
FreePascal and Delphi. When I sort out what the problem is, I'll post
back here, just in case someone else is using this combination and
runs into a similar problem.


Brian.