diff options
| author | Damien Regad <dregad@mantisbt.org> | 2023-06-11 01:51:15 +0200 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2023-06-11 01:51:15 +0200 |
| commit | 98c947721c6e7a5fe2766383d111550bd5e165e7 (patch) | |
| tree | af55f50d57e70b6f1ed3fe4e24b362fd56149729 /drivers | |
| parent | 40e53396b9a8f01ddc36de30321015bed3b9cca7 (diff) | |
| parent | 348d2631724b3e72e45b9785fa679ca064098e93 (diff) | |
| download | adodb-98c947721c6e7a5fe2766383d111550bd5e165e7.tar.gz adodb-98c947721c6e7a5fe2766383d111550bd5e165e7.tar.bz2 adodb-98c947721c6e7a5fe2766383d111550bd5e165e7.zip | |
Merge branch 'hotfix/5.22'
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/adodb-mysqli.inc.php | 8 | ||||
| -rw-r--r-- | drivers/adodb-postgres8.inc.php | 20 |
2 files changed, 24 insertions, 4 deletions
diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php index 9c9cc346..f634da36 100644 --- a/drivers/adodb-mysqli.inc.php +++ b/drivers/adodb-mysqli.inc.php @@ -166,6 +166,14 @@ class ADODB_mysqli extends ADOConnection { if(!extension_loaded("mysqli")) { return null; } + // Check for a function that only exists in mysqlnd + if (!function_exists('mysqli_stmt_get_result')) { + // @TODO This will be treated as if the mysqli extension were not available + // This could be misleading, so we output an additional error message. + // We should probably throw a specific exception instead. + $this->outp("MySQL Native Driver (msqlnd) required"); + return null; + } $this->_connectionID = @mysqli_init(); if (is_null($this->_connectionID)) { diff --git a/drivers/adodb-postgres8.inc.php b/drivers/adodb-postgres8.inc.php index 37c2aae1..58df47c6 100644 --- a/drivers/adodb-postgres8.inc.php +++ b/drivers/adodb-postgres8.inc.php @@ -45,11 +45,23 @@ class ADODB_postgres8 extends ADODB_postgres7 * @return int last inserted ID for given table/column, or the most recently * returned one if $table or $column are empty */ - protected function _insertID($table = '', $column = '') + protected function _insertID( $table = '', $column = '' ) { - return empty($table) || empty($column) - ? $this->GetOne("SELECT lastval()") - : $this->GetOne("SELECT currval(pg_get_serial_sequence('$table', '$column'))"); + global $ADODB_GETONE_EOF; + + $sql = empty($table) || empty($column) + ? 'SELECT lastval()' + : "SELECT currval(pg_get_serial_sequence('$table', '$column'))"; + + // Squelch "ERROR: lastval is not yet defined in this session" (see #978) + $result = @$this->GetOne($sql); + if ($result === false || $result == $ADODB_GETONE_EOF) { + if ($this->debug) { + ADOConnection::outp(__FUNCTION__ . "() failed : " . $this->errorMsg()); + } + return false; + } + return $result; } } |
