From e83f23d2d516c89cc1a2396f2ba9347358ffb493 Mon Sep 17 00:00:00 2001 From: schengawegga Date: Sat, 4 Nov 2023 22:25:08 +0100 Subject: [PATCH 1/5] Fix PHP8.2 Deprecated use of ${var} instead of {$var} --- DB/ibase.php | 6 +++--- DB/msql.php | 4 ++-- DB/mysql.php | 18 +++++++++--------- DB/mysqli.php | 12 ++++++------ DB/oci8.php | 2 +- DB/odbc.php | 6 +++--- DB/pgsql.php | 4 ++-- DB/sqlite.php | 2 +- DB/sqlite3.php | 2 +- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/DB/ibase.php b/DB/ibase.php index ca0c948..8b8a03d 100644 --- a/DB/ibase.php +++ b/DB/ibase.php @@ -707,9 +707,9 @@ function nextId($seq_name, $ondemand = true) $repeat = 0; do { $this->pushErrorHandling(PEAR_ERROR_RETURN); - $result = $this->query("SELECT GEN_ID(${sqn}, 1) " + $result = $this->query("SELECT GEN_ID({$sqn}, 1) " . 'FROM RDB$GENERATORS ' - . "WHERE RDB\$GENERATOR_NAME='${sqn}'"); + . "WHERE RDB\$GENERATOR_NAME='{$sqn}'"); $this->popErrorHandling(); if ($ondemand && DB::isError($result)) { $repeat = 1; @@ -746,7 +746,7 @@ function createSequence($seq_name) { $sqn = strtoupper($this->getSequenceName($seq_name)); $this->pushErrorHandling(PEAR_ERROR_RETURN); - $result = $this->query("CREATE GENERATOR ${sqn}"); + $result = $this->query("CREATE GENERATOR {$sqn}"); $this->popErrorHandling(); return $result; diff --git a/DB/msql.php b/DB/msql.php index 202f93e..cc95f9f 100644 --- a/DB/msql.php +++ b/DB/msql.php @@ -443,7 +443,7 @@ function nextId($seq_name, $ondemand = true) $repeat = false; do { $this->pushErrorHandling(PEAR_ERROR_RETURN); - $result = $this->query("SELECT _seq FROM ${seqname}"); + $result = $this->query("SELECT _seq FROM {$seqname}"); $this->popErrorHandling(); if ($ondemand && DB::isError($result) && $result->getCode() == DB_ERROR_NOSUCHTABLE) { @@ -490,7 +490,7 @@ function createSequence($seq_name) if (DB::isError($res)) { return $res; } - $res = $this->query("CREATE SEQUENCE ON ${seqname}"); + $res = $this->query("CREATE SEQUENCE ON {$seqname}"); return $res; } diff --git a/DB/mysql.php b/DB/mysql.php index ca8a8b1..f22751a 100644 --- a/DB/mysql.php +++ b/DB/mysql.php @@ -590,7 +590,7 @@ function nextId($seq_name, $ondemand = true) do { $repeat = 0; $this->pushErrorHandling(PEAR_ERROR_RETURN); - $result = $this->query("UPDATE ${seqname} ". + $result = $this->query("UPDATE {$seqname} ". 'SET id=LAST_INSERT_ID(id+1)'); $this->popErrorHandling(); if ($result === DB_OK) { @@ -602,7 +602,7 @@ function nextId($seq_name, $ondemand = true) // EMPTY SEQ TABLE // Sequence table must be empty for some reason, so fill // it and return 1 and obtain a user-level lock - $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)"); + $result = $this->getOne("SELECT GET_LOCK('{$seqname}_lock',10)"); if (DB::isError($result)) { return $this->raiseError($result); } @@ -612,14 +612,14 @@ function nextId($seq_name, $ondemand = true) } // add the default value - $result = $this->query("REPLACE INTO ${seqname} (id) VALUES (0)"); + $result = $this->query("REPLACE INTO {$seqname} (id) VALUES (0)"); if (DB::isError($result)) { return $this->raiseError($result); } // Release the lock $result = $this->getOne('SELECT RELEASE_LOCK(' - . "'${seqname}_lock')"); + . "'{$seqname}_lock')"); if (DB::isError($result)) { return $this->raiseError($result); } @@ -699,12 +699,12 @@ function createSequence($seq_name) return $res; } // insert yields value 1, nextId call will generate ID 2 - $res = $this->query("INSERT INTO ${seqname} (id) VALUES (0)"); + $res = $this->query("INSERT INTO {$seqname} (id) VALUES (0)"); if (DB::isError($res)) { return $res; } // so reset to zero - return $this->query("UPDATE ${seqname} SET id = 0"); + return $this->query("UPDATE {$seqname} SET id = 0"); } // }}} @@ -743,7 +743,7 @@ function _BCsequence($seqname) // Obtain a user-level lock... this will release any previous // application locks, but unlike LOCK TABLES, it does not abort // the current transaction and is much less frequently used. - $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)"); + $result = $this->getOne("SELECT GET_LOCK('{$seqname}_lock',10)"); if (DB::isError($result)) { return $result; } @@ -753,7 +753,7 @@ function _BCsequence($seqname) return $this->mysqlRaiseError(DB_ERROR_NOT_LOCKED); } - $highest_id = $this->getOne("SELECT MAX(id) FROM ${seqname}"); + $highest_id = $this->getOne("SELECT MAX(id) FROM {$seqname}"); if (DB::isError($highest_id)) { return $highest_id; } @@ -769,7 +769,7 @@ function _BCsequence($seqname) // If another thread has been waiting for this lock, // it will go thru the above procedure, but will have no // real effect - $result = $this->getOne("SELECT RELEASE_LOCK('${seqname}_lock')"); + $result = $this->getOne("SELECT RELEASE_LOCK('{$seqname}_lock')"); if (DB::isError($result)) { return $result; } diff --git a/DB/mysqli.php b/DB/mysqli.php index 21a41bc..001e0c5 100644 --- a/DB/mysqli.php +++ b/DB/mysqli.php @@ -691,7 +691,7 @@ function nextId($seq_name, $ondemand = true) // so fill it and return 1 // Obtain a user-level lock $result = $this->getOne('SELECT GET_LOCK(' - . "'${seqname}_lock', 10)"); + . "'{$seqname}_lock', 10)"); if (DB::isError($result)) { return $this->raiseError($result); } @@ -708,7 +708,7 @@ function nextId($seq_name, $ondemand = true) // Release the lock $result = $this->getOne('SELECT RELEASE_LOCK(' - . "'${seqname}_lock')"); + . "'{$seqname}_lock')"); if (DB::isError($result)) { return $this->raiseError($result); } @@ -789,7 +789,7 @@ function createSequence($seq_name) return $res; } // insert yields value 1, nextId call will generate ID 2 - return $this->query("INSERT INTO ${seqname} (id) VALUES (0)"); + return $this->query("INSERT INTO {$seqname} (id) VALUES (0)"); } // }}} @@ -828,7 +828,7 @@ function _BCsequence($seqname) // Obtain a user-level lock... this will release any previous // application locks, but unlike LOCK TABLES, it does not abort // the current transaction and is much less frequently used. - $result = $this->getOne("SELECT GET_LOCK('${seqname}_lock',10)"); + $result = $this->getOne("SELECT GET_LOCK('{$seqname}_lock',10)"); if (DB::isError($result)) { return $result; } @@ -838,7 +838,7 @@ function _BCsequence($seqname) return $this->mysqliRaiseError(DB_ERROR_NOT_LOCKED); } - $highest_id = $this->getOne("SELECT MAX(id) FROM ${seqname}"); + $highest_id = $this->getOne("SELECT MAX(id) FROM {$seqname}"); if (DB::isError($highest_id)) { return $highest_id; } @@ -855,7 +855,7 @@ function _BCsequence($seqname) // If another thread has been waiting for this lock, // it will go thru the above procedure, but will have no // real effect - $result = $this->getOne("SELECT RELEASE_LOCK('${seqname}_lock')"); + $result = $this->getOne("SELECT RELEASE_LOCK('{$seqname}_lock')"); if (DB::isError($result)) { return $result; } diff --git a/DB/oci8.php b/DB/oci8.php index 06ea8c1..98fb7a8 100644 --- a/DB/oci8.php +++ b/DB/oci8.php @@ -877,7 +877,7 @@ function nextId($seq_name, $ondemand = true) $repeat = 0; do { $this->expectError(DB_ERROR_NOSUCHTABLE); - $result = $this->query("SELECT ${seqname}.nextval FROM dual"); + $result = $this->query("SELECT {$seqname}.nextval FROM dual"); $this->popExpect(); if ($ondemand && DB::isError($result) && $result->getCode() == DB_ERROR_NOSUCHTABLE) { diff --git a/DB/odbc.php b/DB/odbc.php index a664331..8ddbe7c 100644 --- a/DB/odbc.php +++ b/DB/odbc.php @@ -502,7 +502,7 @@ function nextId($seq_name, $ondemand = true) $repeat = 0; do { $this->pushErrorHandling(PEAR_ERROR_RETURN); - $result = $this->query("update ${seqname} set id = id + 1"); + $result = $this->query("update {$seqname} set id = id + 1"); $this->popErrorHandling(); if ($ondemand && DB::isError($result) && $result->getCode() == DB_ERROR_NOSUCHTABLE) { @@ -513,7 +513,7 @@ function nextId($seq_name, $ondemand = true) if (DB::isError($result)) { return $this->raiseError($result); } - $result = $this->query("insert into ${seqname} (id) values(0)"); + $result = $this->query("insert into {$seqname} (id) values(0)"); } else { $repeat = 0; } @@ -523,7 +523,7 @@ function nextId($seq_name, $ondemand = true) return $this->raiseError($result); } - $result = $this->query("select id from ${seqname}"); + $result = $this->query("select id from {$seqname}"); if (DB::isError($result)) { return $result; } diff --git a/DB/pgsql.php b/DB/pgsql.php index 8a75ca6..88baa84 100644 --- a/DB/pgsql.php +++ b/DB/pgsql.php @@ -664,7 +664,7 @@ function nextId($seq_name, $ondemand = true) $repeat = false; do { $this->pushErrorHandling(PEAR_ERROR_RETURN); - $result = $this->query("SELECT NEXTVAL('${seqname}')"); + $result = $this->query("SELECT NEXTVAL('{$seqname}')"); $this->popErrorHandling(); if ($ondemand && DB::isError($result) && $result->getCode() == DB_ERROR_NOSUCHTABLE) { @@ -703,7 +703,7 @@ function nextId($seq_name, $ondemand = true) function createSequence($seq_name) { $seqname = $this->getSequenceName($seq_name); - $result = $this->query("CREATE SEQUENCE ${seqname}"); + $result = $this->query("CREATE SEQUENCE {$seqname}"); return $result; } diff --git a/DB/sqlite.php b/DB/sqlite.php index b81a43f..4d48dd3 100644 --- a/DB/sqlite.php +++ b/DB/sqlite.php @@ -517,7 +517,7 @@ function createSequence($seq_name) if (DB::isError($result)) { return($result); } - $query = "CREATE TRIGGER ${seqname}_cleanup AFTER INSERT ON $seqname + $query = "CREATE TRIGGER {$seqname}_cleanup AFTER INSERT ON $seqname BEGIN DELETE FROM $seqname WHERE id Date: Sat, 4 Nov 2023 22:32:42 +0100 Subject: [PATCH 2/5] Add lastId Method --- DB/mysqli.php | 2 +- DB/sqlite3.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DB/mysqli.php b/DB/mysqli.php index 001e0c5..df51f76 100644 --- a/DB/mysqli.php +++ b/DB/mysqli.php @@ -763,7 +763,7 @@ function nextId($seq_name, $ondemand = true) function lastId($link_identifier = null) { $id = $this->connection->insert_id(); - if(empty($id) || !is_int($id)) { + if (empty($id) || !is_int($id)) { return 0; } return $id; diff --git a/DB/sqlite3.php b/DB/sqlite3.php index ae4ef8f..6aab7e3 100644 --- a/DB/sqlite3.php +++ b/DB/sqlite3.php @@ -606,7 +606,11 @@ function nextId($seq_name, $ondemand = true) */ function lastId($link_identifier = null) { - return $this->connection->lastInsertRowID(); + $id = $this->connection->lastInsertRowID(); + if (empty($id) || !is_int($id)) { + return 0; + } + return $id; } // }}} From ff83f62253b2abfe03d2782da2550c1214daf78c Mon Sep 17 00:00:00 2001 From: schengawegga Date: Sat, 4 Nov 2023 23:08:24 +0100 Subject: [PATCH 3/5] PHP8.2 ready --- DB/mssql.php | 2 ++ DB/mysql.php | 2 ++ DB/oci8.php | 82 ++++++++++++++++++++++++--------------------------- DB/odbc.php | 2 +- DB/pgsql.php | 24 +++++++-------- DB/sybase.php | 6 ++-- 6 files changed, 60 insertions(+), 58 deletions(-) diff --git a/DB/mssql.php b/DB/mssql.php index 82bf63f..e26dc7c 100644 --- a/DB/mssql.php +++ b/DB/mssql.php @@ -22,6 +22,7 @@ * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id$ * @link http://pear.php.net/package/DB + * @deprecated since 1.12.0 */ /** @@ -51,6 +52,7 @@ * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @link http://pear.php.net/package/DB + * @deprecated since 1.12.0 */ class DB_mssql extends DB_common { diff --git a/DB/mysql.php b/DB/mysql.php index f22751a..7219a91 100644 --- a/DB/mysql.php +++ b/DB/mysql.php @@ -22,6 +22,7 @@ * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id$ * @link http://pear.php.net/package/DB + * @deprecated since 1.12.0 */ /** @@ -43,6 +44,7 @@ * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @link http://pear.php.net/package/DB + * @deprecated since 1.12.0 */ class DB_mysql extends DB_common { diff --git a/DB/oci8.php b/DB/oci8.php index 98fb7a8..b176453 100644 --- a/DB/oci8.php +++ b/DB/oci8.php @@ -249,7 +249,7 @@ function connect($dsn, $persistent = false) $dsn['password'], $db, $char); - $error = OCIError(); + $error = oci_error(); if (!empty($error) && $error['code'] == 12541) { // Couldn't find TNS listener. Try direct connection. $this->connection = @$connect_function($dsn['username'], @@ -270,7 +270,7 @@ function connect($dsn, $persistent = false) } if (!$this->connection) { - $error = OCIError(); + $error = oci_error(); $error = (is_array($error)) ? $error['message'] : null; return $this->raiseError(DB_ERROR_CONNECT_FAILED, null, null, null, @@ -289,11 +289,7 @@ function connect($dsn, $persistent = false) */ function disconnect() { - if (function_exists('oci_close')) { - $ret = @oci_close($this->connection); - } else { - $ret = @OCILogOff($this->connection); - } + $ret = @oci_close($this->connection); $this->connection = null; return $ret; } @@ -320,14 +316,14 @@ function simpleQuery($query) $this->last_parameters = array(); $this->last_query = $query; $query = $this->modifyQuery($query); - $result = @OCIParse($this->connection, $query); + $result = @oci_parse($this->connection, $query); if (!$result) { return $this->oci8RaiseError(); } if ($this->autocommit) { - $success = @OCIExecute($result,OCI_COMMIT_ON_SUCCESS); + $success = @oci_execute($result,OCI_COMMIT_ON_SUCCESS); } else { - $success = @OCIExecute($result,OCI_DEFAULT); + $success = @oci_execute($result,OCI_DEFAULT); } if (!$success) { return $this->oci8RaiseError($result); @@ -336,7 +332,7 @@ function simpleQuery($query) if ($this->_checkManip($query)) { return DB_OK; } else { - @ocisetprefetch($result, $this->options['result_buffering']); + @oci_set_prefetch($result, $this->options['result_buffering']); return $result; } } @@ -387,14 +383,14 @@ function fetchInto($result, &$arr, $fetchmode, $rownum = null) return $this->raiseError(DB_ERROR_NOT_CAPABLE); } if ($fetchmode & DB_FETCHMODE_ASSOC) { - $moredata = @OCIFetchInto($result,$arr,OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS); + $moredata = @oci_fetch_array($result,$arr,OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS); if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $moredata) { $arr = array_change_key_case($arr, CASE_LOWER); } } else { - $moredata = OCIFetchInto($result,$arr,OCI_RETURN_NULLS+OCI_RETURN_LOBS); + $moredata = oci_fetch_array($result,$arr,OCI_RETURN_NULLS+OCI_RETURN_LOBS); } if (!$moredata) { return null; @@ -426,7 +422,7 @@ function fetchInto($result, &$arr, $fetchmode, $rownum = null) */ function freeResult($result) { - return is_resource($result) ? OCIFreeStatement($result) : false; + return is_resource($result) ? oci_free_statement($result) : false; } /** @@ -520,7 +516,7 @@ function numRows($result) */ function numCols($result) { - $cols = @OCINumCols($result); + $cols = @oci_num_fields($result); if (!$cols) { return $this->oci8RaiseError($result); } @@ -592,7 +588,7 @@ function prepare($query) $this->last_query = $query; $newquery = $this->modifyQuery($newquery); - if (!$stmt = @OCIParse($this->connection, $newquery)) { + if (!$stmt = @oci_parse($this->connection, $newquery)) { return $this->oci8RaiseError(); } $this->prepare_types[(int)$stmt] = $types; @@ -664,7 +660,7 @@ function &execute($stmt, $data = array()) $data[$key] = $this->quoteFloat($data[$key]); } } - if (!@OCIBindByName($stmt, ':bind' . $i, $data[$key], -1)) { + if (!@oci_bind_by_name($stmt, ':bind' . $i, $data[$key], -1)) { $tmp = $this->oci8RaiseError($stmt); return $tmp; } @@ -673,9 +669,9 @@ function &execute($stmt, $data = array()) $i++; } if ($this->autocommit) { - $success = @OCIExecute($stmt, OCI_COMMIT_ON_SUCCESS); + $success = @oci_execute($stmt, OCI_COMMIT_ON_SUCCESS); } else { - $success = @OCIExecute($stmt, OCI_DEFAULT); + $success = @oci_execute($stmt, OCI_DEFAULT); } if (!$success) { $tmp = $this->oci8RaiseError($stmt); @@ -688,7 +684,7 @@ function &execute($stmt, $data = array()) $tmp = DB_OK; } else { $this->_last_query_manip = false; - @ocisetprefetch($stmt, $this->options['result_buffering']); + @oci_set_prefetch($stmt, $this->options['result_buffering']); $tmp = new DB_result($this, $stmt); } return $tmp; @@ -721,7 +717,7 @@ function autoCommit($onoff = false) */ function commit() { - $result = @OCICommit($this->connection); + $result = @oci_commit($this->connection); if (!$result) { return $this->oci8RaiseError(); } @@ -738,7 +734,7 @@ function commit() */ function rollback() { - $result = @OCIRollback($this->connection); + $result = @oci_rollback($this->connection); if (!$result) { return $this->oci8RaiseError(); } @@ -760,7 +756,7 @@ function affectedRows() if ($this->last_stmt === false) { return $this->oci8RaiseError(); } - $result = @OCIRowCount($this->last_stmt); + $result = @oci_num_rows($this->last_stmt); if ($result === false) { return $this->oci8RaiseError($this->last_stmt); } @@ -821,20 +817,20 @@ function modifyLimitQuery($query, $from, $count, $params = array()) } else { $q_fields = "SELECT * FROM ($query) WHERE NULL = NULL"; - if (!$result = @OCIParse($this->connection, $q_fields)) { + if (!$result = @oci_parse($this->connection, $q_fields)) { $this->last_query = $q_fields; return $this->oci8RaiseError(); } - if (!@OCIExecute($result, OCI_DEFAULT)) { + if (!@oci_execute($result, OCI_DEFAULT)) { $this->last_query = $q_fields; return $this->oci8RaiseError($result); } } - $ncols = OCINumCols($result); + $ncols = oci_num_fields($result); $cols = array(); for ( $i = 1; $i <= $ncols; $i++ ) { - $cols[] = '"' . OCIColumnName($result, $i) . '"'; + $cols[] = '"' . oci_field_name($result, $i) . '"'; } $fields = implode(', ', $cols); // XXX Test that (tip by John Lim) @@ -950,11 +946,11 @@ function dropSequence($seq_name) function oci8RaiseError($errno = null) { if ($errno === null) { - $error = @OCIError($this->connection); + $error = @oci_error($this->connection); return $this->raiseError($this->errorCode($error['code']), null, null, null, $error['message']); } elseif (is_resource($errno)) { - $error = @OCIError($errno); + $error = @oci_error($errno); return $this->raiseError($this->errorCode($error['code']), null, null, null, $error['message']); } @@ -973,9 +969,9 @@ function oci8RaiseError($errno = null) function errorNative() { if (is_resource($this->last_stmt)) { - $error = @OCIError($this->last_stmt); + $error = @oci_error($this->last_stmt); } else { - $error = @OCIError($this->connection); + $error = @oci_error($this->connection); } if (is_array($error)) { return $error['code']; @@ -1029,21 +1025,21 @@ function tableInfo($result, $mode = null) $this->last_query = $q_fields; - if (!$stmt = @OCIParse($this->connection, $q_fields)) { + if (!$stmt = @oci_parse($this->connection, $q_fields)) { return $this->oci8RaiseError(DB_ERROR_NEED_MORE_DATA); } - if (!@OCIExecute($stmt, OCI_DEFAULT)) { + if (!@oci_execute($stmt, OCI_DEFAULT)) { return $this->oci8RaiseError($stmt); } $i = 0; - while (@OCIFetch($stmt)) { + while (@oci_fetch($stmt)) { $res[$i] = array( 'table' => $case_func($result), - 'name' => $case_func(@OCIResult($stmt, 1)), - 'type' => @OCIResult($stmt, 2), - 'len' => @OCIResult($stmt, 3), - 'flags' => (@OCIResult($stmt, 4) == 'N') ? 'not_null' : '', + 'name' => $case_func(@oci_result($stmt, 1)), + 'type' => @oci_result($stmt, 2), + 'len' => @oci_result($stmt, 3), + 'flags' => (@oci_result($stmt, 4) == 'N') ? 'not_null' : '', ); if ($mode & DB_TABLEINFO_ORDER) { $res['order'][$res[$i]['name']] = $i; @@ -1057,7 +1053,7 @@ function tableInfo($result, $mode = null) if ($mode) { $res['num_fields'] = $i; } - @OCIFreeStatement($stmt); + @oci_free_statement($stmt); } else { if (isset($result->result)) { @@ -1071,16 +1067,16 @@ function tableInfo($result, $mode = null) $res = array(); if ($result === $this->last_stmt) { - $count = @OCINumCols($result); + $count = @oci_num_fields($result); if ($mode) { $res['num_fields'] = $count; } for ($i = 0; $i < $count; $i++) { $res[$i] = array( 'table' => '', - 'name' => $case_func(@OCIColumnName($result, $i+1)), - 'type' => @OCIColumnType($result, $i+1), - 'len' => @OCIColumnSize($result, $i+1), + 'name' => $case_func(@oci_field_name($result, $i+1)), + 'type' => @oci_field_name($result, $i+1), + 'len' => @oci_field_name($result, $i+1), 'flags' => '', ); if ($mode & DB_TABLEINFO_ORDER) { diff --git a/DB/odbc.php b/DB/odbc.php index 8ddbe7c..13a390b 100644 --- a/DB/odbc.php +++ b/DB/odbc.php @@ -331,7 +331,7 @@ function fetchInto($result, &$arr, $fetchmode, $rownum = null) return null; } if ($fetchmode !== DB_FETCHMODE_ORDERED) { - for ($i = 0; $i < count($arr); $i++) { + for ($i = 0, $iMax = count($arr); $i < $iMax; $i++) { $colName = @odbc_field_name($result, $i+1); $a[$colName] = $arr[$i]; } diff --git a/DB/pgsql.php b/DB/pgsql.php index 88baa84..213f74d 100644 --- a/DB/pgsql.php +++ b/DB/pgsql.php @@ -460,7 +460,7 @@ function freeResult($result) unset($this->row[(int)$result]); unset($this->_num_rows[(int)$result]); $this->affected = 0; - return @pg_freeresult($result); + return @pg_free_result($result); } return false; } @@ -534,7 +534,7 @@ function escapeSimple($str) */ function numCols($result) { - $cols = @pg_numfields($result); + $cols = @pg_num_fields($result); if (!$cols) { return $this->pgsqlRaiseError(); } @@ -559,7 +559,7 @@ function numCols($result) */ function numRows($result) { - $rows = @pg_numrows($result); + $rows = @pg_num_rows($result); if ($rows === null) { return $this->pgsqlRaiseError(); } @@ -791,7 +791,7 @@ function pgsqlRaiseError($errno = null) */ function errorNative() { - return @pg_errormessage($this->connection); + return @pg_last_error($this->connection); } // }}} @@ -916,7 +916,7 @@ function tableInfo($result, $mode = null) $case_func = 'strval'; } - $count = @pg_numfields($id); + $count = @pg_num_fields($id); $res = array(); if ($mode) { @@ -926,9 +926,9 @@ function tableInfo($result, $mode = null) for ($i = 0; $i < $count; $i++) { $res[$i] = array( 'table' => $got_string ? $case_func($result) : '', - 'name' => $case_func(@pg_fieldname($id, $i)), - 'type' => @pg_fieldtype($id, $i), - 'len' => @pg_fieldsize($id, $i), + 'name' => $case_func(@pg_field_name($id, $i)), + 'type' => @pg_field_type($id, $i), + 'len' => @pg_field_size($id, $i), 'flags' => $got_string ? $this->_pgFieldFlags($id, $i, $result) : '', @@ -943,7 +943,7 @@ function tableInfo($result, $mode = null) // free the result only if we were called on a table if ($got_string) { - @pg_freeresult($id); + @pg_free_result($id); } return $res; } @@ -967,7 +967,7 @@ function tableInfo($result, $mode = null) */ function _pgFieldFlags($resource, $num_field, $table_name) { - $field_name = @pg_fieldname($resource, $num_field); + $field_name = @pg_field_name($resource, $num_field); // Check if there's a schema in $table_name and update things // accordingly. @@ -986,7 +986,7 @@ function _pgFieldFlags($resource, $num_field, $table_name) AND typ.typrelid = f.attrelid AND f.attname = '$field_name' AND $tableWhere"); - if (@pg_numrows($result) > 0) { + if (@pg_num_rows($result) > 0) { $row = @pg_fetch_row($result, 0); $flags = ($row[0] == 't') ? 'not_null ' : ''; @@ -1010,7 +1010,7 @@ function _pgFieldFlags($resource, $num_field, $table_name) AND f.attrelid = i.indrelid AND f.attname = '$field_name' AND $tableWhere"); - $count = @pg_numrows($result); + $count = @pg_num_rows($result); for ($i = 0; $i < $count ; $i++) { $row = @pg_fetch_row($result, $i); diff --git a/DB/sybase.php b/DB/sybase.php index aa3a1b7..3e7d0af 100644 --- a/DB/sybase.php +++ b/DB/sybase.php @@ -17,12 +17,13 @@ * @category Database * @package DB * @author Sterling Hughes - * @author Antônio Carlos Venâncio Júnior + * @author Ant�nio Carlos Ven�ncio J�nior * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id$ * @link http://pear.php.net/package/DB + * @deprecated since 1.12.0 */ /** @@ -42,12 +43,13 @@ * @category Database * @package DB * @author Sterling Hughes - * @author Antônio Carlos Venâncio Júnior + * @author Ant�nio Carlos Ven�ncio J�nior * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @link http://pear.php.net/package/DB + * @deprecated since 1.12.0 */ class DB_sybase extends DB_common { From a3c315fcdccd8b4cd74b46fb891c8558fc380357 Mon Sep 17 00:00:00 2001 From: schengawegga Date: Sat, 4 Nov 2023 23:15:25 +0100 Subject: [PATCH 4/5] Fix UTF-8 encoding in sybase.php --- DB/sybase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DB/sybase.php b/DB/sybase.php index 3e7d0af..c7e3f50 100644 --- a/DB/sybase.php +++ b/DB/sybase.php @@ -17,7 +17,7 @@ * @category Database * @package DB * @author Sterling Hughes - * @author Ant�nio Carlos Ven�ncio J�nior + * @author Antônio Carlos Venâncio Júnior * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 @@ -43,7 +43,7 @@ * @category Database * @package DB * @author Sterling Hughes - * @author Ant�nio Carlos Ven�ncio J�nior + * @author Antônio Carlos Venâncio Júnior * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 From e806c3656084555fc8d5d5dcf4997e5e391240f2 Mon Sep 17 00:00:00 2001 From: schengawegga Date: Sun, 5 Nov 2023 01:23:12 +0100 Subject: [PATCH 5/5] corrected oci field type and field size --- DB/oci8.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DB/oci8.php b/DB/oci8.php index b176453..a89dd33 100644 --- a/DB/oci8.php +++ b/DB/oci8.php @@ -1075,8 +1075,8 @@ function tableInfo($result, $mode = null) $res[$i] = array( 'table' => '', 'name' => $case_func(@oci_field_name($result, $i+1)), - 'type' => @oci_field_name($result, $i+1), - 'len' => @oci_field_name($result, $i+1), + 'type' => @oci_field_type($result, $i+1), + 'len' => @oci_field_size($result, $i+1), 'flags' => '', ); if ($mode & DB_TABLEINFO_ORDER) {