Skip to content

Commit

Permalink
Merge branch 'hotfix/5.22'
Browse files Browse the repository at this point in the history
# Conflicts:
#	adodb.inc.php
  • Loading branch information
dregad committed Mar 12, 2023
2 parents feadc3d + d085fc8 commit 404fb7b
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 31 deletions.
24 changes: 22 additions & 2 deletions adodb.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,12 @@ function ADODB_Setup() {
// CLASS ADOFieldObject
//==============================================================================================
/**
* Helper class for FetchFields -- holds info on a column
* Helper class for FetchFields -- holds info on a column.
*
* Note: Dynamic properties are required here, as some drivers may require
* the object to hold database-specific field metadata.
*/
#[\AllowDynamicProperties]
class ADOFieldObject {
/**
* @var string Field name
Expand Down Expand Up @@ -484,7 +488,14 @@ abstract class ADOConnection {
//
var $dataProvider = 'native';
var $databaseType = ''; /// RDBMS currently in use, eg. odbc, mysql, mssql
var $database = ''; /// Name of database to be used.

/**
* @var string Current database name.
*
* This used to be stored in the $databaseName property, which was marked
* as deprecated in 4.66 and removed in 5.22.5.
*/
public $database = '';

/**
* @var string If the driver is PDO, then the dsnType is e.g. sqlsrv, otherwise empty
Expand Down Expand Up @@ -3905,6 +3916,12 @@ class ADORecordSet implements IteratorAggregate {
* public variables
*/
var $dataProvider = "native";

/**
* @var string Table name (used in _adodb_getupdatesql() and _adodb_getinsertsql())-
*/
public $tableName = '';

/** @var bool|array */
var $fields = false; /// holds the current row data
var $blobSize = 100; /// any varchar/char field this size or greater is treated as a blob
Expand Down Expand Up @@ -3949,6 +3966,8 @@ class ADORecordSet implements IteratorAggregate {
public $customActualTypes;
public $customMetaTypes;

/** @var int Only used in _adodb_getinsertsql() */
public $insertSig;

/**
* @var ADOFieldObject[] Field metadata cache
Expand Down Expand Up @@ -5785,6 +5804,7 @@ function newDataDictionary(&$conn, $drivername='') {
}
include_once($path);
$class = "ADODB2_$drivername";
/** @var ADODB_DataDict $dict */
$dict = new $class();
$dict->dataProvider = $conn->dataProvider;
$dict->connection = $conn;
Expand Down
31 changes: 13 additions & 18 deletions drivers/adodb-db2.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ class ADODB_db2 extends ADOConnection {
*/
public $connectStmt = '';

/*
* Holds the current database name
*/
private $databaseName = '';

/*
* Holds information about the stored procedure request
* currently being built
Expand All @@ -113,7 +108,7 @@ public function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)

private function doDB2Connect($argDSN, $argUsername, $argPassword, $argDatabasename, $persistent=false)
{

if (!function_exists('db2_connect')) {
ADOConnection::outp("DB2 extension not installed.");
return null;
Expand Down Expand Up @@ -184,7 +179,7 @@ private function doDB2Connect($argDSN, $argUsername, $argPassword, $argDatabasen
null,
$db2Options);


$this->_errorMsg = @db2_conn_errormsg();

if ($this->_connectionID && $this->connectStmt)
Expand All @@ -207,7 +202,7 @@ private function doDB2Connect($argDSN, $argUsername, $argPassword, $argDatabasen
private function unpackParameters($argDSN, $argUsername, $argPassword, $argDatabasename)
{


$connectionParameters = array('dsn'=>'',
'uid'=>'',
'pwd'=>'',
Expand Down Expand Up @@ -257,7 +252,7 @@ private function unpackParameters($argDSN, $argUsername, $argPassword, $argDatab
$errorMessage = 'Supply uncatalogued connection parameters ';
$errorMessage.= 'in either the database or DSN arguments, ';
$errorMessage.= 'but not both';

if ($this->debug)
ADOConnection::outp($errorMessage);
return null;
Expand All @@ -282,7 +277,7 @@ private function unpackParameters($argDSN, $argUsername, $argPassword, $argDatab
{
$errorMessage = 'For uncatalogued connections, provide ';
$errorMessage.= 'both UID and PWD in the connection string';

if ($this->debug)
ADOConnection::outp($errorMessage);
return null;
Expand All @@ -307,7 +302,7 @@ private function unpackParameters($argDSN, $argUsername, $argPassword, $argDatab
}
elseif ($argDatabasename)
{
$this->databaseName = $argDatabasename;
$this->database = $argDatabasename;
$argDSN .= ';database=' . $argDatabasename;
$argDatabasename = '';
$useCataloguedConnection = false;
Expand All @@ -317,7 +312,7 @@ private function unpackParameters($argDSN, $argUsername, $argPassword, $argDatab
{
$errorMessage = 'Uncatalogued connection parameters ';
$errorMessage.= 'must contain a database= argument';

if ($this->debug)
ADOConnection::outp($errorMessage);
return null;
Expand Down Expand Up @@ -347,9 +342,9 @@ private function unpackParameters($argDSN, $argUsername, $argPassword, $argDatab
}

if ($argDatabasename)
$this->databaseName = $argDatabasename;
elseif (!$this->databaseName)
$this->databaseName = $this->getDatabasenameFromDsn($argDSN);
$this->database = $argDatabasename;
elseif (!$this->database)
$this->database = $this->getDatabasenameFromDsn($argDSN);


$connectionParameters = array('dsn'=>$argDSN,
Expand Down Expand Up @@ -1003,7 +998,7 @@ public function metaProcedures($procedureNamePattern = null, $catalog = null, $
*/
public function metaDatabases(){

$dbName = $this->getMetaCasedValue($this->databaseName);
$dbName = $this->getMetaCasedValue($this->database);

return (array)$dbName;

Expand Down Expand Up @@ -1618,10 +1613,10 @@ function _query(&$sql,$inputarr=false)
{
$this->_errorMsg = @db2_stmt_errormsg();
$this->_errorCode = @db2_stmt_error();

if ($this->debug)
ADOConnection::outp($this->_errorMsg);

return false;
}
}
Expand Down
1 change: 0 additions & 1 deletion drivers/adodb-mssql.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@ function MetaTables($ttype=false,$showSchema=false,$mask=false)
function SelectDB($dbName)
{
$this->database = $dbName;
$this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions
if ($this->_connectionID) {
return @mssql_select_db($dbName);
}
Expand Down
1 change: 0 additions & 1 deletion drivers/adodb-mssqlnative.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ function RowLock($tables,$where,$col='1 as adodbignore')
function SelectDB($dbName)
{
$this->database = $dbName;
$this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions
if ($this->_connectionID) {
$rs = $this->Execute('USE '.$dbName);
if($rs) {
Expand Down
3 changes: 1 addition & 2 deletions drivers/adodb-mysqli.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ function MetaColumns($table, $normalize = true)

$SQL = "SELECT column_name, column_type
FROM information_schema.columns
WHERE table_schema='{$this->databaseName}'
WHERE table_schema='{$this->database}'
AND table_name='$table'";

$schemaArray = $this->getAssoc($SQL);
Expand Down Expand Up @@ -1003,7 +1003,6 @@ function MetaColumns($table, $normalize = true)
function SelectDB($dbName)
{
$this->database = $dbName;
$this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions

if ($this->_connectionID) {
$result = @mysqli_select_db($this->_connectionID, $dbName);
Expand Down
1 change: 0 additions & 1 deletion drivers/adodb-odbtp.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ function SelectDB($dbName)
return false;
}
$this->database = $dbName;
$this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions
return true;
}

Expand Down
1 change: 0 additions & 1 deletion drivers/adodb-pdo.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,6 @@ class ADORecordSet_pdo extends ADORecordSet {
var $bind = false;
var $databaseType = "pdo";
var $dataProvider = "pdo";
var $adodbFetchMode = false;

function __construct($id,$mode=false)
{
Expand Down
5 changes: 2 additions & 3 deletions drivers/adodb-pdo_mysql.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function OffsetDate($dayFraction, $date=false)
return $date . ' + INTERVAL ' . $fraction . ' SECOND';
// return "from_unixtime(unix_timestamp($date)+$fraction)";
}

/**
* Get a list of indexes on the specified table.
*
Expand Down Expand Up @@ -266,7 +266,6 @@ function MetaColumns($table, $normalize=true)
function SelectDB($dbName)
{
$this->database = $dbName;
$this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions
$try = $this->Execute('use ' . $dbName);
return ($try !== false);
}
Expand All @@ -275,7 +274,7 @@ function SelectDB($dbName)
function SelectLimit($sql, $nrows=-1, $offset=-1, $inputarr=false, $secs=0)
{
$nrows = (int) $nrows;
$offset = (int) $offset;
$offset = (int) $offset;
$offsetStr =($offset>=0) ? "$offset," : '';
// jason judge, see PHPLens Issue No: 9220
if ($nrows < 0) {
Expand Down
1 change: 0 additions & 1 deletion drivers/adodb-postgres64.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,6 @@ class ADORecordSet_postgres64 extends ADORecordSet{
var $_blobArr;
var $databaseType = "postgres64";
var $canSeek = true;
var $adodbFetchMode;

function __construct($queryID, $mode=false)
{
Expand Down
1 change: 0 additions & 1 deletion drivers/adodb-sybase.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ function RowLock($tables,$where,$col='top 1 null as ignore')
function SelectDB($dbName)
{
$this->database = $dbName;
$this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions
if ($this->_connectionID) {
return @sybase_select_db($dbName);
}
Expand Down

0 comments on commit 404fb7b

Please sign in to comment.