Subject RE: [firebird-php] auto increment last insert
Author Darren Thompson
adodb is bloat-ware on large databases you can see a speed diffrence if
there is no need to port it to another database then there is no need to use
it ;-) go for the jugular
-----Original Message-----
From: Lester Caine [mailto:lester@...]
Sent: 24 November 2004 21:10
Subject: Re: [firebird-php] auto increment last insert

FIRST - will people please hack the replies. They are getting very long ;)

Second - I think I've been passing duff info. You get used to ADOdb's
way of doing things.

ibase_execute returns a result set
ibase_query returns a result set identifier

I'm using the Execute rather than Query and forgetting that

Darren Thompson wrote:

> I think you is not pretending but i think you should read the php
> Clarion yeah i know a little never thought it was still being used.
> looking at your prob your code is messy
> Function GetId() {
> $qry = 'SELECT gen_id('GEN_USERS',1) AS Id from RDB$DATABASE';
> $res = ibase_query($qry);
> while ($resrow = ibase_fetch_row($res)) {
> $id = $resrow[0];
> }
> return($id);
> }
> //use
> $variable = GetId();
> use this function to get a gen id

ADOdb equivalent creates the generator if it does not exist -
function GenID($seqname='adodbseq',$startID=1)
$getnext = ("SELECT Gen_ID($seqname,1) FROM RDB\$DATABASE");
$rs = @$this->Execute($getnext);
if (!$rs) {
VALUES (UPPER('$seqname'))" ));
$this->Execute("SET GENERATOR $seqname TO ".($startID-1).';');
$rs = $this->Execute($getnext);
if ($rs && !$rs->EOF) $this->genID = (integer) reset($rs->fields);
else $this->genID = 0; // false

if ($rs) $rs->Close();

return $this->genID;

Lester Caine
L.S.Caine Electronic Services

Yahoo! Groups Sponsor

Yahoo! Groups Links

a.. To visit your group on the web, go to:

b.. To unsubscribe from this group, send an email to:

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

[Non-text portions of this message have been removed]