summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Newnham <mark@newnhams.com>2021-03-26 21:09:42 -0600
committerDamien Regad <dregad@mantisbt.org>2021-08-22 11:16:01 +0200
commit19d676c7440ce535ec1047927ef7493eb04473b1 (patch)
treec3a4ceeb88c92da7af16f52b7772e5a85f15b159
parent1aa567ad18d5ed0c39335179c9278ae7a90c42fe (diff)
downloadadodb-19d676c7440ce535ec1047927ef7493eb04473b1.tar.gz
adodb-19d676c7440ce535ec1047927ef7493eb04473b1.tar.bz2
adodb-19d676c7440ce535ec1047927ef7493eb04473b1.zip
update method genID()
- Update docblock = Replace GENERATOR with recommended SEQUENCE
-rw-r--r--drivers/adodb-firebird.inc.php13
1 files 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) {