From 19d676c7440ce535ec1047927ef7493eb04473b1 Mon Sep 17 00:00:00 2001 From: Mark Newnham Date: Fri, 26 Mar 2021 21:09:42 -0600 Subject: update method genID() - Update docblock = Replace GENERATOR with recommended SEQUENCE --- drivers/adodb-firebird.inc.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/adodb-firebird.inc.php b/drivers/adodb-firebird.inc.php index a6db6c38..bfeeaa22 100644 --- a/drivers/adodb-firebird.inc.php +++ b/drivers/adodb-firebird.inc.php @@ -404,13 +404,22 @@ class ADODB_firebird extends ADOConnection { return false; } + /** + * A portable method of creating sequence numbers. + * + * @link https://adodb.org/dokuwiki/doku.php?id=v5:reference:connection:genid + * + * @param string $seqname (Optional) The name of the sequence to use. + * @param int $startID (Optional) The point to start at in the sequence. + * + * @return bool|int|string + */ function GenID($seqname='adodbseq',$startID=1) { $getnext = ("SELECT Gen_ID($seqname,1) FROM RDB\$DATABASE"); $rs = @$this->Execute($getnext); if (!$rs) { - $this->Execute(("CREATE GENERATOR $seqname" )); - $this->Execute("SET GENERATOR $seqname TO ".($startID-1).';'); + $this->Execute("CREATE SEQUENCE $seqname START WITH $startID"); $rs = $this->Execute($getnext); } if ($rs && !$rs->EOF) { -- cgit v1.3