Groups > dBase > dBase SQL Servers > Re: Using firebird with increment generator




Using firebird with increment generator

Using firebird with increment generator
Wed, 20 Feb 2008 03:07:50 -050
I have a generator in firebird for incrementing a number. The generator works
fine, but I have a need to retrieve the current number. I use the following
code:

 d = new database()
 d.databaseName = "FIREBIRD"
 d.active = true
q = new query()
q.database = d
 q.sql = "SELECT Gen_id(idnum,0) as TheID from RDB$DATABASE"
 q.active = true
 
 I get the following error message "Database Engine Error: Capability not
supported"
I tried it without the "as TheID" as well.

I had this problem in the past and thought I had it figured out but now I can
seem to make it work.
 
What am I doing wrong?
Post Reply
Re: Using firebird with increment generator
Wed, 20 Feb 2008 09:02:09 -050
Your a lifesaver. Turning requestlive to false did the trick. I guess this is
because the return is read-only.

thanks!

Lysander Wrote:

> Ira Berkowitz schrieb:
> > What am I doing wrong?
> 
> I really don't know, because for what I know your command should work.
> maybe you would have to set q.requestlive = false to make it work?
> 
> Also, to make serverside functions (like Gen_ID) work, you would have to 
> make sure that the SQLQueryMode is set to "Server" in the BDE.
Maybe you 
> will take a look there and check this out.
> 
> If the query only returns one value in any case, you can save the "as

> TheID".
> 
> just do
> "select Gen_ID(idnum,0) from RDB$Database"
> 
> q.active = true
> TheID = q.rowset.fields[1].value
> q.active = false
Post Reply
Re: Using firebird with increment generator
Wed, 20 Feb 2008 10:37:51 +010
Ira Berkowitz schrieb:
> What am I doing wrong?

I really don't know, because for what I know your command should work.
maybe you would have to set q.requestlive = false to make it work?

Also, to make serverside functions (like Gen_ID) work, you would have to 
make sure that the SQLQueryMode is set to "Server" in the BDE. Maybe
you 
will take a look there and check this out.

If the query only returns one value in any case, you can save the "as 
TheID".

just do
"select Gen_ID(idnum,0) from RDB$Database"

q.active = true
TheID = q.rowset.fields[1].value
Post Reply
about | contact