PMCORE-3876 Check Backward Incompatible Changes, specially "String to Number Comparison"
This commit is contained in:
81
thirdparty/pear/DB/oci8.php
vendored
81
thirdparty/pear/DB/oci8.php
vendored
@@ -20,11 +20,6 @@
|
||||
// $Id: oci8.php 3355 2005-06-11 22:14:40Z nbm $
|
||||
|
||||
|
||||
// be aware... OCIError() only appears to return anything when given a
|
||||
// statement, so functions return the generic DB_ERROR instead of more
|
||||
// useful errors that have to do with feedback from the database.
|
||||
|
||||
|
||||
require_once 'DB/common.php';
|
||||
|
||||
/**
|
||||
@@ -127,7 +122,7 @@ class DB_oci8 extends DB_common
|
||||
$conn = false;
|
||||
}
|
||||
if ($conn == false) {
|
||||
$error = OCIError();
|
||||
$error = oci_error();
|
||||
$error = (is_array($error)) ? $error['message'] : null;
|
||||
return $this->raiseError(DB_ERROR_CONNECT_FAILED, null, null,
|
||||
null, $error);
|
||||
@@ -146,7 +141,7 @@ class DB_oci8 extends DB_common
|
||||
*/
|
||||
function disconnect()
|
||||
{
|
||||
$ret = @OCILogOff($this->connection);
|
||||
$ret = @oci_close($this->connection);
|
||||
$this->connection = null;
|
||||
return $ret;
|
||||
}
|
||||
@@ -169,14 +164,14 @@ class DB_oci8 extends DB_common
|
||||
$this->_data = 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);
|
||||
@@ -231,14 +226,14 @@ class DB_oci8 extends DB_common
|
||||
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_all($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_all($result,$arr,OCI_RETURN_NULLS+OCI_RETURN_LOBS);
|
||||
}
|
||||
if (!$moredata) {
|
||||
return null;
|
||||
@@ -264,7 +259,7 @@ class DB_oci8 extends DB_common
|
||||
*/
|
||||
function freeResult($result)
|
||||
{
|
||||
return @OCIFreeStatement($result);
|
||||
return @oci_free_statement($result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -329,7 +324,7 @@ class DB_oci8 extends DB_common
|
||||
*/
|
||||
function numCols($result)
|
||||
{
|
||||
$cols = @OCINumCols($result);
|
||||
$cols = @oci_num_fields($result);
|
||||
if (!$cols) {
|
||||
return $this->oci8RaiseError($result);
|
||||
}
|
||||
@@ -341,8 +336,8 @@ class DB_oci8 extends DB_common
|
||||
|
||||
/**
|
||||
* Get the native error code of the last error (if any) that occured
|
||||
* on the current connection. This does not work, as OCIError does
|
||||
* not work unless given a statement. If OCIError does return
|
||||
* on the current connection. This does not work, as oci_error does
|
||||
* not work unless given a statement. If oci_error does return
|
||||
* something, so will this.
|
||||
*
|
||||
* @return int native oci8 error code
|
||||
@@ -350,9 +345,9 @@ class DB_oci8 extends DB_common
|
||||
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'];
|
||||
@@ -422,7 +417,7 @@ class DB_oci8 extends DB_common
|
||||
|
||||
$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;
|
||||
@@ -482,16 +477,16 @@ class DB_oci8 extends DB_common
|
||||
$data[$key] = fread($fp, filesize($data[$key]));
|
||||
fclose($fp);
|
||||
}
|
||||
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;
|
||||
}
|
||||
$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);
|
||||
@@ -530,7 +525,7 @@ class DB_oci8 extends DB_common
|
||||
*/
|
||||
function commit()
|
||||
{
|
||||
$result = @OCICommit($this->connection);
|
||||
$result = @oci_commit($this->connection);
|
||||
if (!$result) {
|
||||
return $this->oci8RaiseError();
|
||||
}
|
||||
@@ -547,7 +542,7 @@ class DB_oci8 extends DB_common
|
||||
*/
|
||||
function rollback()
|
||||
{
|
||||
$result = @OCIRollback($this->connection);
|
||||
$result = @oci_rollback($this->connection);
|
||||
if (!$result) {
|
||||
return $this->oci8RaiseError();
|
||||
}
|
||||
@@ -568,7 +563,7 @@ class DB_oci8 extends DB_common
|
||||
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);
|
||||
}
|
||||
@@ -613,20 +608,20 @@ class DB_oci8 extends DB_common
|
||||
} 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)
|
||||
@@ -743,11 +738,11 @@ class DB_oci8 extends DB_common
|
||||
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']);
|
||||
}
|
||||
@@ -813,20 +808,20 @@ class DB_oci8 extends DB_common
|
||||
|
||||
$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]['table'] = $case_func($result);
|
||||
$res[$i]['name'] = $case_func(@OCIResult($stmt, 1));
|
||||
$res[$i]['type'] = @OCIResult($stmt, 2);
|
||||
$res[$i]['len'] = @OCIResult($stmt, 3);
|
||||
$res[$i]['flags'] = (@OCIResult($stmt, 4) == 'N') ? 'not_null' : '';
|
||||
$res[$i]['name'] = $case_func(@oci_result($stmt, 1));
|
||||
$res[$i]['type'] = @oci_result($stmt, 2);
|
||||
$res[$i]['len'] = @oci_result($stmt, 3);
|
||||
$res[$i]['flags'] = (@oci_result($stmt, 4) == 'N') ? 'not_null' : '';
|
||||
|
||||
if ($mode & DB_TABLEINFO_ORDER) {
|
||||
$res['order'][$res[$i]['name']] = $i;
|
||||
@@ -840,7 +835,7 @@ class DB_oci8 extends DB_common
|
||||
if ($mode) {
|
||||
$res['num_fields'] = $i;
|
||||
}
|
||||
@OCIFreeStatement($stmt);
|
||||
@oci_free_statement($stmt);
|
||||
|
||||
} else {
|
||||
if (isset($result->result)) {
|
||||
@@ -857,13 +852,13 @@ class DB_oci8 extends DB_common
|
||||
}
|
||||
|
||||
if ($result === $this->last_stmt) {
|
||||
$count = @OCINumCols($result);
|
||||
$count = @oci_num_fields($result);
|
||||
|
||||
for ($i=0; $i<$count; $i++) {
|
||||
$res[$i]['table'] = '';
|
||||
$res[$i]['name'] = $case_func(@OCIColumnName($result, $i+1));
|
||||
$res[$i]['type'] = @OCIColumnType($result, $i+1);
|
||||
$res[$i]['len'] = @OCIColumnSize($result, $i+1);
|
||||
$res[$i]['name'] = $case_func(@oci_field_name($result, $i+1));
|
||||
$res[$i]['type'] = @oci_field_type($result, $i+1);
|
||||
$res[$i]['len'] = @oci_field_size($result, $i+1);
|
||||
$res[$i]['flags'] = '';
|
||||
|
||||
if ($mode & DB_TABLEINFO_ORDER) {
|
||||
|
||||
8
thirdparty/pear/DB/pgsql.php
vendored
8
thirdparty/pear/DB/pgsql.php
vendored
@@ -123,12 +123,8 @@ class DB_pgsql extends DB_common
|
||||
|
||||
$connect_function = $persistent ? 'pg_pconnect' : 'pg_connect';
|
||||
|
||||
$ini = ini_get('track_errors');
|
||||
if ($ini) {
|
||||
$conn = @$connect_function($connstr);
|
||||
} else {
|
||||
$conn = @$connect_function($connstr);
|
||||
}
|
||||
$conn = @$connect_function($connstr);
|
||||
|
||||
if ($conn == false) {
|
||||
$lastError = error_get_last();
|
||||
$errorMessage = $lastError['message'] ?? 'Connection error.';
|
||||
|
||||
Reference in New Issue
Block a user