Subject | Re: [firebird-support] Generator only seems to increment once...? |
---|---|
Author | brian |
Post date | 2015-04-27T12:38:33Z |
On Mon, 27 Apr 2015 19:13:51 +1200, you wrote:
with the Firebird drivers and the fbembedded library. The SQL is
executed via the TSQLQuery components. I've done a barrowload of this
sort of stuff before, just never previously using Firebird and
FreePascal, it was all Windows work with Delphi and
DBISAM/Oracle/DBFs, but it was more than 10 years ago now, so I
suppose I *could* be doing something silly. I've been through the code
a dozen times, though, and it's not like the routines to call the
generators are particularly complex - they're coded as 10-20 line
functions returning the values.
But to answer your question, yes, I actually created the generators I
was trying to use - the SQL to create them and also to set the initial
value (which I could change, and which changes were reflected in the
values returned, as with the step) all executed and returned without
exceptions.
So did the queries to increment the values - but each call just
returned the same value, i.e. the starting value plus the initial
step. The generators are there, they're working as far as changing the
initial value and step are concerned, but they're just NOT
incrementing, and that's what has me baffled.
Thanks for the assistance,
Brian.
>At 09:58 a.m. 27/04/2015, brian brian@... [firebird-support] wrote:I'll try it with isql - at the moment, I'm using Lazarus/FreePascal
>
>>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.
>
with the Firebird drivers and the fbembedded library. The SQL is
executed via the TSQLQuery components. I've done a barrowload of this
sort of stuff before, just never previously using Firebird and
FreePascal, it was all Windows work with Delphi and
DBISAM/Oracle/DBFs, but it was more than 10 years ago now, so I
suppose I *could* be doing something silly. I've been through the code
a dozen times, though, and it's not like the routines to call the
generators are particularly complex - they're coded as 10-20 line
functions returning the values.
But to answer your question, yes, I actually created the generators I
was trying to use - the SQL to create them and also to set the initial
value (which I could change, and which changes were reflected in the
values returned, as with the step) all executed and returned without
exceptions.
So did the queries to increment the values - but each call just
returned the same value, i.e. the starting value plus the initial
step. The generators are there, they're working as far as changing the
initial value and step are concerned, but they're just NOT
incrementing, and that's what has me baffled.
Thanks for the assistance,
Brian.