mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-79662 libraries: upgrade to version 5.22.7 of ADOdb.
This commit is contained in:
parent
513f3b02c7
commit
827a00af52
@ -76,10 +76,10 @@ $ADODB_INCLUDED_CSV = 1;
|
||||
|
||||
$savefetch = isset($rs->adodbFetchMode) ? $rs->adodbFetchMode : $rs->fetchMode;
|
||||
$class = $rs->connection->arrayClass;
|
||||
/** @var ADORecordSet $rs2 */
|
||||
$rs2 = new $class(ADORecordSet::DUMMY_QUERY_ID);
|
||||
$rs2->timeCreated = $rs->timeCreated; # memcache fix
|
||||
$rs2->sql = $rs->sql;
|
||||
$rs2->oldProvider = $rs->dataProvider;
|
||||
$rs2->InitArrayFields($rows,$flds);
|
||||
$rs2->fetchMode = $savefetch;
|
||||
return $line.serialize($rs2);
|
||||
|
@ -37,7 +37,14 @@ if (!defined('ADODB_ERROR_HANDLER')) define('ADODB_ERROR_HANDLER','ADODB_Error_H
|
||||
*/
|
||||
function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection)
|
||||
{
|
||||
if (error_reporting() == 0) return; // obey @ protocol
|
||||
// Do not throw if errors are suppressed by @ operator
|
||||
// error_reporting() value for suppressed errors changed in PHP 8.0.0
|
||||
$suppressed = version_compare(PHP_VERSION, '8.0.0', '<')
|
||||
? 0
|
||||
: E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE;
|
||||
if (error_reporting() == $suppressed) {
|
||||
return;
|
||||
}
|
||||
switch($fn) {
|
||||
case 'EXECUTE':
|
||||
$sql = $p1;
|
||||
|
@ -52,7 +52,15 @@ function ADODB_Error_PEAR($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)
|
||||
{
|
||||
global $ADODB_Last_PEAR_Error;
|
||||
|
||||
if (error_reporting() == 0) return; // obey @ protocol
|
||||
// Do not throw if errors are suppressed by @ operator
|
||||
// error_reporting() value for suppressed errors changed in PHP 8.0.0
|
||||
$suppressed = version_compare(PHP_VERSION, '8.0.0', '<')
|
||||
? 0
|
||||
: E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE;
|
||||
if (error_reporting() == $suppressed) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch($fn) {
|
||||
case 'EXECUTE':
|
||||
$sql = $p1;
|
||||
|
@ -81,10 +81,18 @@ var $database = '';
|
||||
|
||||
function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
|
||||
{
|
||||
global $ADODB_EXCEPTION;
|
||||
global $ADODB_EXCEPTION;
|
||||
|
||||
// Do not throw if errors are suppressed by @ operator
|
||||
// error_reporting() value for suppressed errors changed in PHP 8.0.0
|
||||
$suppressed = version_compare(PHP_VERSION, '8.0.0', '<')
|
||||
? 0
|
||||
: E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE;
|
||||
if (error_reporting() == $suppressed) {
|
||||
return;
|
||||
}
|
||||
|
||||
$errfn = is_string($ADODB_EXCEPTION) ? $ADODB_EXCEPTION : 'ADODB_EXCEPTION';
|
||||
|
||||
if (error_reporting() == 0) return; // obey @ protocol
|
||||
if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION;
|
||||
else $errfn = 'ADODB_EXCEPTION';
|
||||
throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection);
|
||||
}
|
||||
|
@ -508,32 +508,38 @@ function _adodb_getcount($zthis, $sql,$inputarr=false,$secs2cache=0)
|
||||
return $qryRecs;
|
||||
}
|
||||
|
||||
/*
|
||||
Code originally from "Cornel G" <conyg@fx.ro>
|
||||
|
||||
This code might not work with SQL that has UNION in it
|
||||
|
||||
Also if you are using CachePageExecute(), there is a strong possibility that
|
||||
data will get out of synch. use CachePageExecute() only with tables that
|
||||
rarely change.
|
||||
*/
|
||||
function _adodb_pageexecute_all_rows($zthis, $sql, $nrows, $page,
|
||||
$inputarr=false, $secs2cache=0)
|
||||
/**
|
||||
* Execute query with pagination including record count.
|
||||
*
|
||||
* This code might not work with SQL that has UNION in it.
|
||||
* Also if you are using cachePageExecute(), there is a strong possibility that
|
||||
* data will get out of sync. cachePageExecute() should only be used with
|
||||
* tables that rarely change.
|
||||
*
|
||||
* @param ADOConnection $zthis Connection
|
||||
* @param string $sql Query to execute
|
||||
* @param int $nrows Number of rows per page
|
||||
* @param int $page Page number to retrieve (1-based)
|
||||
* @param array $inputarr Array of bind variables
|
||||
* @param int $secs2cache Time-to-live of the cache (in seconds), 0 to force query execution
|
||||
*
|
||||
* @return ADORecordSet|bool
|
||||
*
|
||||
* @author Cornel G <conyg@fx.ro>
|
||||
*/
|
||||
function _adodb_pageexecute_all_rows($zthis, $sql, $nrows, $page, $inputarr=false, $secs2cache=0)
|
||||
{
|
||||
$atfirstpage = false;
|
||||
$atlastpage = false;
|
||||
|
||||
// If an invalid nrows is supplied,
|
||||
// we assume a default value of 10 rows per page
|
||||
// If an invalid nrows is supplied, assume a default value of 10 rows per page
|
||||
if (!isset($nrows) || $nrows <= 0) $nrows = 10;
|
||||
|
||||
$qryRecs = _adodb_getcount($zthis,$sql,$inputarr,$secs2cache);
|
||||
$lastpageno = (int) ceil($qryRecs / $nrows);
|
||||
$zthis->_maxRecordCount = $qryRecs;
|
||||
|
||||
// ***** Here we check whether $page is the last page or
|
||||
// whether we are trying to retrieve
|
||||
// a page number greater than the last page number.
|
||||
// Check whether $page is the last page or if we are trying to retrieve
|
||||
// a page number greater than the last one.
|
||||
if ($page >= $lastpageno) {
|
||||
$page = $lastpageno;
|
||||
$atlastpage = true;
|
||||
@ -565,7 +571,25 @@ function _adodb_pageexecute_all_rows($zthis, $sql, $nrows, $page,
|
||||
return $rsreturn;
|
||||
}
|
||||
|
||||
// Iván Oliva version
|
||||
/**
|
||||
* Execute query with pagination without last page information.
|
||||
*
|
||||
* This code might not work with SQL that has UNION in it.
|
||||
* Also if you are using cachePageExecute(), there is a strong possibility that
|
||||
* data will get out of sync. cachePageExecute() should only be used with
|
||||
* tables that rarely change.
|
||||
*
|
||||
* @param ADOConnection $zthis Connection
|
||||
* @param string $sql Query to execute
|
||||
* @param int $nrows Number of rows per page
|
||||
* @param int $page Page number to retrieve (1-based)
|
||||
* @param array $inputarr Array of bind variables
|
||||
* @param int $secs2cache Time-to-live of the cache (in seconds), 0 to force query execution
|
||||
*
|
||||
* @return ADORecordSet|bool
|
||||
*
|
||||
* @author Iván Oliva
|
||||
*/
|
||||
function _adodb_pageexecute_no_last_page($zthis, $sql, $nrows, $page, $inputarr=false, $secs2cache=0)
|
||||
{
|
||||
$atfirstpage = false;
|
||||
|
@ -38,17 +38,17 @@ class ADOdbLoadBalancer
|
||||
/**
|
||||
* @var bool|array All connections to each database.
|
||||
*/
|
||||
protected $connections = false;
|
||||
protected $connections = [];
|
||||
|
||||
/**
|
||||
* @var bool|array Just connections to the write capable database.
|
||||
*/
|
||||
protected $connections_write = false;
|
||||
protected $connections_write = [];
|
||||
|
||||
/**
|
||||
* @var bool|array Just connections to the readonly database.
|
||||
*/
|
||||
protected $connections_readonly = false;
|
||||
protected $connections_readonly = [];
|
||||
|
||||
/**
|
||||
* @var array Counts of all connections and their types.
|
||||
@ -73,12 +73,12 @@ class ADOdbLoadBalancer
|
||||
/**
|
||||
* @var bool Session variables that must be maintained across all connections, ie: SET TIME ZONE.
|
||||
*/
|
||||
protected $session_variables = false;
|
||||
protected $session_variables = [];
|
||||
|
||||
/**
|
||||
* @var bool Called immediately after connecting to any DB.
|
||||
*/
|
||||
protected $user_defined_session_init_sql = false;
|
||||
protected $user_defined_session_init_sql = [];
|
||||
|
||||
|
||||
/**
|
||||
@ -403,7 +403,7 @@ class ADOdbLoadBalancer
|
||||
*/
|
||||
private function executeSessionVariables($adodb_obj = false)
|
||||
{
|
||||
if (is_array($this->session_variables)) {
|
||||
if (is_array($this->session_variables) && count($this->session_variables) > 0) {
|
||||
$sql = '';
|
||||
foreach ($this->session_variables as $name => $value) {
|
||||
// $sql .= 'SET SESSION '. $name .' '. $value;
|
||||
|
@ -1017,7 +1017,7 @@ Committed_AS: 348732 kB
|
||||
* <code>ADODB_OPT_LOW</code> for CPU-less optimization
|
||||
* Default is LOW <code>ADODB_OPT_LOW</code>
|
||||
* @author Markus Staab
|
||||
* @return Returns <code>true</code> on success and <code>false</code> on error
|
||||
* @return bool true on success, false on error
|
||||
*/
|
||||
function OptimizeTables()
|
||||
{
|
||||
@ -1048,7 +1048,7 @@ Committed_AS: 348732 kB
|
||||
* <code>ADODB_OPT_LOW</code> for CPU-less optimization
|
||||
* Default is LOW <code>ADODB_OPT_LOW</code>
|
||||
* @author Markus Staab
|
||||
* @return Returns <code>true</code> on success and <code>false</code> on error
|
||||
* @return bool true on success, false on error
|
||||
*/
|
||||
function OptimizeTable( $table, $mode = ADODB_OPT_LOW)
|
||||
{
|
||||
@ -1062,7 +1062,7 @@ Committed_AS: 348732 kB
|
||||
* optimize each using <code>optmizeTable()</code>
|
||||
*
|
||||
* @author Markus Staab
|
||||
* @return Returns <code>true</code> on success and <code>false</code> on error
|
||||
* @return bool true on success, false on error
|
||||
*/
|
||||
function optimizeDatabase()
|
||||
{
|
||||
|
@ -2,6 +2,8 @@
|
||||
/**
|
||||
* ADOdb Date Library.
|
||||
*
|
||||
* @deprecated 5.22.6 Use 64-bit PHP native functions instead.
|
||||
*
|
||||
* PHP native date functions use integer timestamps for computations.
|
||||
* Because of this, dates are restricted to the years 1901-2038 on Unix
|
||||
* and 1970-2038 on Windows due to integer overflow for dates beyond
|
||||
|
@ -412,7 +412,7 @@ class dbTable extends dbObject {
|
||||
* @param string $type ADODB datadict field type.
|
||||
* @param string $size Field size
|
||||
* @param array $opts Field options array
|
||||
* @return array Field specifier array
|
||||
* @return void
|
||||
*/
|
||||
function addField( $name, $type, $size = NULL, $opts = NULL ) {
|
||||
$field_id = $this->FieldID( $name );
|
||||
@ -446,7 +446,7 @@ class dbTable extends dbObject {
|
||||
* @param string $field Field name
|
||||
* @param string $opt ADOdb field option
|
||||
* @param mixed $value Field option value
|
||||
* @return array Field specifier array
|
||||
* @return void
|
||||
*/
|
||||
function addFieldOpt( $field, $opt, $value = NULL ) {
|
||||
if( !isset( $value ) ) {
|
||||
|
@ -450,7 +450,7 @@ class dbTable extends dbObject {
|
||||
* @param string $type ADODB datadict field type.
|
||||
* @param string $size Field size
|
||||
* @param array $opts Field options array
|
||||
* @return array Field specifier array
|
||||
* @return void
|
||||
*/
|
||||
function addField( $name, $type, $size = NULL, $opts = NULL ) {
|
||||
$field_id = $this->fieldID( $name );
|
||||
@ -486,7 +486,7 @@ class dbTable extends dbObject {
|
||||
* @param string $field Field name
|
||||
* @param string $opt ADOdb field option
|
||||
* @param mixed $value Field option value
|
||||
* @return array Field specifier array
|
||||
* @return void
|
||||
*/
|
||||
function addFieldOpt( $field, $opt, $value = NULL ) {
|
||||
if( $this->currentPlatform ) {
|
||||
@ -766,7 +766,7 @@ class dbIndex extends dbObject {
|
||||
* Adds a field to the index
|
||||
*
|
||||
* @param string $name Field name
|
||||
* @return string Field list
|
||||
* @return string[] Field list
|
||||
*/
|
||||
function addField( $name ) {
|
||||
$this->columns[$this->fieldID( $name )] = $name;
|
||||
@ -779,7 +779,7 @@ class dbIndex extends dbObject {
|
||||
* Adds options to the index
|
||||
*
|
||||
* @param string $opt Comma-separated list of index options.
|
||||
* @return string Option list
|
||||
* @return string[] Option list
|
||||
*/
|
||||
function addIndexOpt( $opt ) {
|
||||
$this->opts[] = $opt;
|
||||
@ -929,10 +929,10 @@ class dbData extends dbObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds options to the index
|
||||
* Adds data.
|
||||
*
|
||||
* @param string $opt Comma-separated list of index options.
|
||||
* @return string Option list
|
||||
* @param string $cdata Data to add
|
||||
* @return void
|
||||
*/
|
||||
function addData( $cdata ) {
|
||||
// check we're in a valid field
|
||||
@ -1782,7 +1782,7 @@ class adoSchema {
|
||||
$sqlArray = $this->sqlArray;
|
||||
}
|
||||
if( !isset( $sqlArray ) ) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
$fp = fopen( $filename, "w" );
|
||||
|
@ -198,7 +198,7 @@ if (!defined('_ADODB_LAYER')) {
|
||||
/**
|
||||
* ADODB version as a string.
|
||||
*/
|
||||
$ADODB_vers = 'v5.22.5 2023-04-03';
|
||||
$ADODB_vers = 'v5.22.7 2023-11-04';
|
||||
|
||||
/**
|
||||
* Determines whether recordset->RecordCount() is used.
|
||||
@ -1466,7 +1466,7 @@ if (!defined('_ADODB_LAYER')) {
|
||||
* @param array|bool $inputarr holds the input data to bind to.
|
||||
* Null elements will be set to null.
|
||||
*
|
||||
* @return ADORecordSet|bool
|
||||
* @return ADORecordSet|false
|
||||
*/
|
||||
public function Execute($sql, $inputarr = false) {
|
||||
if ($this->fnExecute) {
|
||||
@ -1666,6 +1666,18 @@ if (!defined('_ADODB_LAYER')) {
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a query.
|
||||
*
|
||||
* @param string|array $sql Query to execute.
|
||||
* @param array $inputarr An optional array of parameters.
|
||||
*
|
||||
* @return mixed|bool Query identifier or true if execution successful, false if failed.
|
||||
*/
|
||||
function _query($sql, $inputarr = false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function CreateSequence($seqname='adodbseq',$startID=1) {
|
||||
if (empty($this->_genSeqSQL)) {
|
||||
return false;
|
||||
@ -3554,20 +3566,21 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1
|
||||
|
||||
|
||||
/**
|
||||
* Will select the supplied $page number from a recordset, given that it is paginated in pages of
|
||||
* $nrows rows per page. It also saves two boolean values saying if the given page is the first
|
||||
* and/or last one of the recordset. Added by Iván Oliva to provide recordset pagination.
|
||||
* Execute query with pagination.
|
||||
*
|
||||
* See docs-adodb.htm#ex8 for an example of usage.
|
||||
* NOTE: phpLens uses a different algorithm and does not use PageExecute().
|
||||
* Will select the supplied $page number from a recordset, divided in
|
||||
* pages of $nrows rows each. It also saves two boolean values saying
|
||||
* if the given page is the first and/or last one of the recordset.
|
||||
*
|
||||
* @param string $sql
|
||||
* @param int $nrows Number of rows per page to get
|
||||
* @param int $page Page number to get (1-based)
|
||||
* @param mixed[]|bool $inputarr Array of bind variables
|
||||
* @param int $secs2cache Private parameter only used by jlim
|
||||
* @param string $sql Query to execute
|
||||
* @param int $nrows Number of rows per page
|
||||
* @param int $page Page number to retrieve (1-based)
|
||||
* @param array|bool $inputarr Array of bind variables
|
||||
* @param int $secs2cache Time-to-live of the cache (in seconds), 0 to force query execution
|
||||
*
|
||||
* @return mixed the recordset ($rs->databaseType == 'array')
|
||||
* @return ADORecordSet|bool the recordset ($rs->databaseType == 'array')
|
||||
*
|
||||
* @author Iván Oliva
|
||||
*/
|
||||
function PageExecute($sql, $nrows, $page, $inputarr=false, $secs2cache=0) {
|
||||
global $ADODB_INCLUDED_LIB;
|
||||
@ -3743,7 +3756,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1
|
||||
/**
|
||||
* Internal placeholder for record objects. Used by ADORecordSet->FetchObj().
|
||||
*/
|
||||
#[AllowDynamicProperties]
|
||||
#[\AllowDynamicProperties]
|
||||
class ADOFetchObj {
|
||||
};
|
||||
|
||||
@ -3983,11 +3996,20 @@ class ADORecordSet implements IteratorAggregate {
|
||||
var $_obj; /** Used by FetchObj */
|
||||
var $_names; /** Used by FetchObj */
|
||||
|
||||
var $_currentPage = -1; /** Added by Iván Oliva to implement recordset pagination */
|
||||
var $_atFirstPage = false; /** Added by Iván Oliva to implement recordset pagination */
|
||||
var $_atLastPage = false; /** Added by Iván Oliva to implement recordset pagination */
|
||||
// Recordset pagination
|
||||
/** @var int Number of rows per page */
|
||||
var $rowsPerPage;
|
||||
/** @var int Current page number */
|
||||
var $_currentPage = -1;
|
||||
/** @var bool True if current page is the first page */
|
||||
var $_atFirstPage = false;
|
||||
/** @var bool True if current page is the last page */
|
||||
var $_atLastPage = false;
|
||||
/** @var int Last page number */
|
||||
var $_lastPageNo = -1;
|
||||
/** @var int Total number of rows in recordset */
|
||||
var $_maxRecordCount = 0;
|
||||
|
||||
var $datetime = false;
|
||||
|
||||
public $customActualTypes;
|
||||
|
@ -208,10 +208,6 @@ class ADODB_ado extends ADOConnection {
|
||||
return empty($arr) ? $false : $arr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* returns queryID or false */
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
|
||||
@ -504,7 +500,7 @@ class ADORecordSet_ado extends ADORecordSet {
|
||||
$t = $fieldobj->type;
|
||||
$len = $fieldobj->max_length;
|
||||
}
|
||||
|
||||
|
||||
if (array_key_exists($t,$this->connection->customActualTypes))
|
||||
return $this->connection->customActualTypes[$t];
|
||||
|
||||
|
@ -233,7 +233,6 @@ class ADODB_ado extends ADOConnection {
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/* returns queryID or false */
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
try { // In PHP5, all COM errors are exceptions, so to maintain old behaviour...
|
||||
@ -545,13 +544,13 @@ class ADORecordSet_ado extends ADORecordSet {
|
||||
$t = $fieldobj->type;
|
||||
$len = $fieldobj->max_length;
|
||||
}
|
||||
|
||||
|
||||
$t = strtoupper($t);
|
||||
|
||||
|
||||
if (array_key_exists($t,$this->connection->customActualTypes))
|
||||
return $this->connection->customActualTypes[$t];
|
||||
|
||||
if (!is_numeric($t))
|
||||
if (!is_numeric($t))
|
||||
return $t;
|
||||
|
||||
switch ($t) {
|
||||
|
@ -564,7 +564,6 @@ class ADODB_ads extends ADOConnection
|
||||
return array($sql, $stmt, false);
|
||||
}
|
||||
|
||||
/* returns queryID or false */
|
||||
function _query($sql, $inputarr = false)
|
||||
{
|
||||
$last_php_error = $this->resetLastError();
|
||||
|
@ -199,7 +199,7 @@ class ADODB_csv extends ADOConnection {
|
||||
}
|
||||
} // class
|
||||
|
||||
class ADORecordset_csv extends ADORecordset {
|
||||
class ADORecordset_csv extends ADORecordSet {
|
||||
|
||||
function _close()
|
||||
{
|
||||
|
@ -1568,7 +1568,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2
|
||||
*
|
||||
* @return mixed either the queryID or false
|
||||
*/
|
||||
function _query(&$sql,$inputarr=false)
|
||||
function _query($sql, $inputarr = false)
|
||||
{
|
||||
$db2Options = array();
|
||||
/*
|
||||
|
@ -134,7 +134,6 @@ class ADODB_fbsql extends ADOConnection {
|
||||
}
|
||||
|
||||
|
||||
// returns queryID or false
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
return fbsql_query("$sql;",$this->_connectionID);
|
||||
|
@ -483,14 +483,14 @@ class ADODB_firebird extends ADOConnection {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the query id.
|
||||
*
|
||||
* @param string|array $sql
|
||||
* @param array $iarr
|
||||
*
|
||||
* @return bool|object
|
||||
*/
|
||||
function _query($sql, $iarr = false)
|
||||
* Execute a query.
|
||||
*
|
||||
* @param string|array $sql Query to execute.
|
||||
* @param array $inputarr An optional array of parameters.
|
||||
*
|
||||
* @return object|bool Query identifier or true if execution successful, false if failed.
|
||||
*/
|
||||
function _query($sql, $inputarr = false)
|
||||
{
|
||||
if (!$this->isConnected()) {
|
||||
return false;
|
||||
@ -512,8 +512,8 @@ class ADODB_firebird extends ADOConnection {
|
||||
$fn = 'fbird_query';
|
||||
$args = [$conn, $sql];
|
||||
}
|
||||
if (is_array($iarr)) {
|
||||
$args = array_merge($args, $iarr);
|
||||
if (is_array($inputarr)) {
|
||||
$args = array_merge($args, $inputarr);
|
||||
}
|
||||
$ret = call_user_func_array($fn, $args);
|
||||
|
||||
|
@ -256,7 +256,7 @@ class ADODB_ibase extends ADOConnection {
|
||||
|
||||
|
||||
// See http://community.borland.com/article/0,1410,25844,00.html
|
||||
function RowLock($tables,$where,$col=false)
|
||||
function rowLock($table, $where, $col = false)
|
||||
{
|
||||
if ($this->autoCommit) {
|
||||
$this->BeginTrans();
|
||||
@ -332,7 +332,7 @@ class ADODB_ibase extends ADOConnection {
|
||||
|
||||
// returns query ID if successful, otherwise false
|
||||
// there have been reports of problems with nested queries - the code is probably not re-entrant?
|
||||
function _query($sql,$iarr=false)
|
||||
function _query($sql, $inputarr = false)
|
||||
{
|
||||
if (!$this->autoCommit && $this->_transactionID) {
|
||||
$conn = $this->_transactionID;
|
||||
@ -344,11 +344,11 @@ class ADODB_ibase extends ADOConnection {
|
||||
if (is_array($sql)) {
|
||||
$fn = 'ibase_execute';
|
||||
$sql = $sql[1];
|
||||
if (is_array($iarr)) {
|
||||
if (!isset($iarr[0])) {
|
||||
$iarr[0] = ''; // PHP5 compat hack
|
||||
if (is_array($inputarr)) {
|
||||
if (!isset($inputarr[0])) {
|
||||
$inputarr[0] = ''; // PHP5 compat hack
|
||||
}
|
||||
$fnarr = array_merge(array($sql), $iarr);
|
||||
$fnarr = array_merge(array($sql), $inputarr);
|
||||
$ret = call_user_func_array($fn, $fnarr);
|
||||
} else {
|
||||
$ret = $fn($sql);
|
||||
@ -356,11 +356,11 @@ class ADODB_ibase extends ADOConnection {
|
||||
} else {
|
||||
$fn = 'ibase_query';
|
||||
|
||||
if (is_array($iarr)) {
|
||||
if (sizeof($iarr) == 0) {
|
||||
$iarr[0] = ''; // PHP5 compat hack
|
||||
if (is_array($inputarr)) {
|
||||
if (sizeof($inputarr) == 0) {
|
||||
$inputarr[0] = ''; // PHP5 compat hack
|
||||
}
|
||||
$fnarr = array_merge(array($conn, $sql), $iarr);
|
||||
$fnarr = array_merge(array($conn, $sql), $inputarr);
|
||||
$ret = call_user_func_array($fn, $fnarr);
|
||||
} else {
|
||||
$ret = $fn($conn, $sql);
|
||||
@ -734,7 +734,7 @@ class ADODB_ibase extends ADOConnection {
|
||||
Class Name: Recordset
|
||||
--------------------------------------------------------------------------------------*/
|
||||
|
||||
class ADORecordset_ibase extends ADORecordSet
|
||||
class ADORecordSet_ibase extends ADORecordSet
|
||||
{
|
||||
|
||||
var $databaseType = "ibase";
|
||||
|
@ -334,7 +334,6 @@ class ADODB_informix72 extends ADOConnection {
|
||||
else return array($sql,$stmt);
|
||||
}
|
||||
*/
|
||||
// returns query ID if successful, otherwise false
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
global $ADODB_COUNTRECS;
|
||||
|
@ -157,7 +157,6 @@ class ADODB_ldap extends ADOConnection {
|
||||
}
|
||||
}
|
||||
|
||||
/* returns _queryID or false */
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
$rs = @ldap_search( $this->_connectionID, $this->database, $sql );
|
||||
|
@ -725,7 +725,6 @@ order by constraint_name, referenced_table_name, keyno";
|
||||
return $this->Execute($sql) != false;
|
||||
}
|
||||
|
||||
// returns query ID if successful, otherwise false
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
$this->_errorMsg = false;
|
||||
|
@ -167,6 +167,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)) {
|
||||
@ -1091,16 +1099,6 @@ class ADODB_mysqli extends ADOConnection {
|
||||
return array($sql,$stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute SQL
|
||||
*
|
||||
* @param string $sql SQL statement to execute, or possibly an array
|
||||
* holding prepared statement ($sql[0] will hold sql text)
|
||||
* @param array|bool $inputarr holds the input data to bind to.
|
||||
* Null elements will be set to null.
|
||||
*
|
||||
* @return ADORecordSet|bool
|
||||
*/
|
||||
public function execute($sql, $inputarr = false)
|
||||
{
|
||||
if ($this->fnExecute) {
|
||||
@ -1146,8 +1144,10 @@ class ADODB_mysqli extends ADOConnection {
|
||||
}
|
||||
$bulkTypeArray[] = $typeArray;
|
||||
}
|
||||
$currentBulkBind = $this->bulkBind;
|
||||
$this->bulkBind = false;
|
||||
$ret = $this->_execute($sql, $bulkTypeArray);
|
||||
$this->bulkBind = $currentBulkBind;
|
||||
} else {
|
||||
$typeArray = $this->getBindParamWithType($inputarr);
|
||||
$ret = $this->_execute($sql, $typeArray);
|
||||
@ -1189,14 +1189,14 @@ class ADODB_mysqli extends ADOConnection {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the query id.
|
||||
*
|
||||
* @param string|array $sql
|
||||
* @param array $inputarr
|
||||
*
|
||||
* @return bool|mysqli_result
|
||||
* Execute a query.
|
||||
*
|
||||
* @param string|array $sql Query to execute.
|
||||
* @param array $inputarr An optional array of parameters.
|
||||
*
|
||||
* @return mysqli_result|bool
|
||||
*/
|
||||
function _query($sql, $inputarr)
|
||||
function _query($sql, $inputarr = false)
|
||||
{
|
||||
global $ADODB_COUNTRECS;
|
||||
// Move to the next recordset, or return false if there is none. In a stored proc
|
||||
@ -1466,6 +1466,9 @@ class ADODB_mysqli extends ADOConnection {
|
||||
return $this->charSet ?: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 5.21.0 Use {@see setConnectionParameter()} instead
|
||||
*/
|
||||
function setCharSet($charset)
|
||||
{
|
||||
if (!$this->_connectionID || !method_exists($this->_connectionID,'set_charset')) {
|
||||
|
@ -92,7 +92,7 @@ END;
|
||||
var $random = "abs(mod(DBMS_RANDOM.RANDOM,10000001)/10000000)";
|
||||
var $noNullStrings = false;
|
||||
var $connectSID = false;
|
||||
var $_bind = false;
|
||||
var $_bind = array();
|
||||
var $_nestedSQL = true;
|
||||
var $_getarray = false; // currently not working
|
||||
var $leftOuter = ''; // oracle wierdness, $col = $value (+) for LEFT OUTER, $col (+)= $value for RIGHT OUTER
|
||||
@ -781,6 +781,11 @@ END;
|
||||
$hint = '';
|
||||
}
|
||||
|
||||
// If non-bound statement, $inputarr is false
|
||||
if (!$inputarr) {
|
||||
$inputarr = array();
|
||||
}
|
||||
|
||||
if ($offset == -1 || ($offset < $this->selectOffsetAlg1 && 0 < $nrows && $nrows < 1000)) {
|
||||
if ($nrows > 0) {
|
||||
if ($offset > 0) {
|
||||
@ -788,10 +793,6 @@ END;
|
||||
}
|
||||
$sql = "select * from (".$sql.") where rownum <= :adodb_offset";
|
||||
|
||||
// If non-bound statement, $inputarr is false
|
||||
if (!$inputarr) {
|
||||
$inputarr = array();
|
||||
}
|
||||
$inputarr['adodb_offset'] = $nrows;
|
||||
$nrows = -1;
|
||||
}
|
||||
@ -809,32 +810,31 @@ END;
|
||||
}
|
||||
$stmt = $stmt_arr[1];
|
||||
|
||||
if (is_array($inputarr)) {
|
||||
foreach($inputarr as $k => $v) {
|
||||
$i=0;
|
||||
if ($this->databaseType == 'oci8po') {
|
||||
$bv_name = ":".$i++;
|
||||
foreach($inputarr as $k => $v) {
|
||||
$i = 0;
|
||||
if ($this->databaseType == 'oci8po') {
|
||||
$bv_name = ":" . $i++;
|
||||
} else {
|
||||
$bv_name = ":" . $k;
|
||||
}
|
||||
if (is_array($v)) {
|
||||
// suggested by g.giunta@libero.
|
||||
if (sizeof($v) == 2) {
|
||||
oci_bind_by_name($stmt, $bv_name, $inputarr[$k][0], $v[1]);
|
||||
} else {
|
||||
$bv_name = ":".$k;
|
||||
oci_bind_by_name($stmt, $bv_name, $inputarr[$k][0], $v[1], $v[2]);
|
||||
}
|
||||
if (is_array($v)) {
|
||||
// suggested by g.giunta@libero.
|
||||
if (sizeof($v) == 2) {
|
||||
oci_bind_by_name($stmt,$bv_name,$inputarr[$k][0],$v[1]);
|
||||
}
|
||||
else {
|
||||
oci_bind_by_name($stmt,$bv_name,$inputarr[$k][0],$v[1],$v[2]);
|
||||
}
|
||||
} else {
|
||||
$len = -1;
|
||||
if ($v === ' ') {
|
||||
$len = 1;
|
||||
}
|
||||
if (isset($bindarr)) {
|
||||
// prepared sql, so no need to oci_bind_by_name again
|
||||
$bindarr[$k] = $v;
|
||||
} else {
|
||||
$len = -1;
|
||||
if ($v === ' ') {
|
||||
$len = 1;
|
||||
}
|
||||
if (isset($bindarr)) { // is prepared sql, so no need to oci_bind_by_name again
|
||||
$bindarr[$k] = $v;
|
||||
} else { // dynamic sql, so rebind every time
|
||||
oci_bind_by_name($stmt,$bv_name,$inputarr[$k],$len);
|
||||
}
|
||||
// dynamic sql, so rebind every time
|
||||
oci_bind_by_name($stmt, $bv_name, $inputarr[$k], $len);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -971,16 +971,6 @@ END;
|
||||
return $rez;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute SQL
|
||||
*
|
||||
* @param string|array $sql SQL statement to execute, or possibly an array holding
|
||||
* prepared statement ($sql[0] will hold sql text).
|
||||
* @param array|false $inputarr holds the input data to bind to.
|
||||
* Null elements will be set to null.
|
||||
*
|
||||
* @return ADORecordSet|false
|
||||
*/
|
||||
function Execute($sql,$inputarr=false)
|
||||
{
|
||||
if ($this->fnExecute) {
|
||||
@ -1282,7 +1272,8 @@ END;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns query ID if successful, otherwise false
|
||||
* Execute a query.
|
||||
*
|
||||
* this version supports:
|
||||
*
|
||||
* 1. $db->execute('select * from table');
|
||||
@ -1295,6 +1286,11 @@ END;
|
||||
* 4. $db->prepare('insert into table (a,b,c) values (:0,:1,:2)');
|
||||
* $db->bind($stmt,1); $db->bind($stmt,2); $db->bind($stmt,3);
|
||||
* $db->execute($stmt);
|
||||
*
|
||||
* @param string|array $sql Query to execute.
|
||||
* @param array $inputarr An optional array of parameters.
|
||||
*
|
||||
* @return mixed|bool Query identifier or true if execution successful, false if failed.
|
||||
*/
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
@ -1583,6 +1579,9 @@ SELECT /*+ RULE */ distinct b.column_name
|
||||
if ($this->noNullStrings && strlen($s) == 0) {
|
||||
$s = ' ';
|
||||
}
|
||||
else if (strlen($s) == 0) {
|
||||
return "''";
|
||||
}
|
||||
if ($this->replaceQuote[0] == '\\'){
|
||||
$s = str_replace('\\','\\\\',$s);
|
||||
}
|
||||
|
@ -70,7 +70,16 @@ class ADODB_oci8po extends ADODB_oci8 {
|
||||
return ADOConnection::SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
|
||||
}
|
||||
|
||||
// emulate handling of parameters ? ?, replacing with :bind0 :bind1
|
||||
/**
|
||||
* Execute a query.
|
||||
*
|
||||
* Emulate handling of parameters ? ?, replacing with :bind0 :bind1
|
||||
*
|
||||
* @param string|array $sql Query to execute.
|
||||
* @param array $inputarr An optional array of parameters.
|
||||
*
|
||||
* @return mixed|bool Query identifier or true if execution successful, false if failed.
|
||||
*/
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
if (is_array($inputarr)) {
|
||||
|
@ -26,7 +26,7 @@ if (!defined('ADODB_DIR')) die();
|
||||
|
||||
/*
|
||||
* These constants are used to set define MetaColumns() method's behavior.
|
||||
* - METACOLUMNS_RETURNS_ACTUAL makes the driver return the actual type,
|
||||
* - METACOLUMNS_RETURNS_ACTUAL makes the driver return the actual type,
|
||||
* like all other drivers do (default)
|
||||
* - METACOLUMNS_RETURNS_META is provided for legacy compatibility (makes
|
||||
* driver behave as it did prior to v5.21)
|
||||
@ -35,7 +35,7 @@ if (!defined('ADODB_DIR')) die();
|
||||
*/
|
||||
DEFINE('METACOLUMNS_RETURNS_ACTUAL', 0);
|
||||
DEFINE('METACOLUMNS_RETURNS_META', 1);
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------------*/
|
||||
|
||||
@ -57,7 +57,7 @@ class ADODB_odbc extends ADOConnection {
|
||||
var $_autocommit = true;
|
||||
var $_lastAffectedRows = 0;
|
||||
var $uCaseTables = true; // for meta* functions, uppercase table names
|
||||
|
||||
|
||||
/*
|
||||
* Tells the metaColumns feature whether to return actual or meta type
|
||||
*/
|
||||
@ -473,7 +473,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od
|
||||
$fld = new ADOFieldObject();
|
||||
$fld->name = $rs->fields[3];
|
||||
if ($this->metaColumnsReturnType == METACOLUMNS_RETURNS_META)
|
||||
/*
|
||||
/*
|
||||
* This is the broken, original value
|
||||
*/
|
||||
$fld->type = $this->ODBCTypes($rs->fields[4]);
|
||||
@ -518,7 +518,6 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od
|
||||
return array($sql,$stmt,false);
|
||||
}
|
||||
|
||||
/* returns queryID or false */
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
$last_php_error = $this->resetLastError();
|
||||
|
@ -181,7 +181,6 @@ class ADODB_oracle extends ADOConnection {
|
||||
}
|
||||
|
||||
|
||||
// returns query ID if successful, otherwise false
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
// <G. Giunta 2003/03/03/> Reset error messages before executing
|
||||
|
@ -578,7 +578,6 @@ class ADODB_pdo extends ADOConnection {
|
||||
}
|
||||
|
||||
|
||||
/* returns queryID or false */
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
$ok = false;
|
||||
|
@ -258,7 +258,9 @@ class ADODB_postgres64 extends ADOConnection{
|
||||
if ($this->_connectionID) {
|
||||
return "'" . pg_escape_string($this->_connectionID, $s) . "'";
|
||||
} else {
|
||||
return "'" . pg_escape_string($s) . "'";
|
||||
// Fall back to emulated escaping when there is no database connection.
|
||||
// Avoids errors when using setSessionVariables() in the load balancer.
|
||||
return parent::qStr( $s );
|
||||
}
|
||||
}
|
||||
|
||||
@ -782,7 +784,6 @@ class ADODB_postgres64 extends ADOConnection{
|
||||
}
|
||||
|
||||
|
||||
// returns queryID or false
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
$this->_pnum = 0;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ if (!defined('ADODB_SYBASE_SQLANYWHERE')){
|
||||
$conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
|
||||
$conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');
|
||||
*/
|
||||
function UpdateBlob($table,$column,&$val,$where,$blobtype='BLOB')
|
||||
function updateBlob($table, $column, $val, $where, $blobtype = 'BLOB')
|
||||
{
|
||||
$blobVarName = 'hold_blob';
|
||||
$this->create_blobvar($blobVarName);
|
||||
|
@ -211,7 +211,6 @@ class ADODB_sqlite extends ADOConnection {
|
||||
return true;
|
||||
}
|
||||
|
||||
// returns query ID if successful, otherwise false
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
$rez = sqlite_query($sql,$this->_connectionID);
|
||||
|
@ -331,7 +331,6 @@ class ADODB_sqlite3 extends ADOConnection {
|
||||
return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
|
||||
}
|
||||
|
||||
// returns query ID if successful, otherwise false
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
$rez = $this->_connectionID->query($sql);
|
||||
|
@ -170,7 +170,6 @@ class ADODB_sybase extends ADOConnection {
|
||||
return true;
|
||||
}
|
||||
|
||||
// returns query ID if successful, otherwise false
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
global $ADODB_COUNTRECS;
|
||||
|
@ -129,14 +129,21 @@ class ADODB_text extends ADOConnection {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// returns queryID or false
|
||||
// We presume that the select statement is on the same table (what else?),
|
||||
// with the only difference being the order by.
|
||||
//You can filter by using $eval and each clause is stored in $arr .eg. $arr[1] == 'name'
|
||||
// also supports SELECT [DISTINCT] COL FROM ... -- only 1 col supported
|
||||
function _query($sql,$input_arr,$eval=false)
|
||||
/**
|
||||
* Execute a query.
|
||||
*
|
||||
* We presume that the select statement is on the same table (what else?),
|
||||
* with the only difference being the order by.
|
||||
* You can filter by using $eval and each clause is stored in $arr e.g. $arr[1] == 'name'
|
||||
* also supports SELECT [DISTINCT] COL FROM ... -- only 1 col supported
|
||||
*
|
||||
* @param string|array $sql Query to execute.
|
||||
* @param array $inputarr An optional array of parameters.
|
||||
* @param string $eval Optional eval string
|
||||
*
|
||||
* @return mixed|bool Query identifier or true if execution successful, false if failed.
|
||||
*/
|
||||
function _query($sql, $inputarr=false, $eval=false)
|
||||
{
|
||||
if ($this->_origarray === false) return false;
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
if (!defined('ADODB_DIR')) die();
|
||||
|
||||
|
||||
class perf_oci8 extends ADODB_perf{
|
||||
class perf_oci8 extends adodb_perf{
|
||||
|
||||
var $noShowIxora = 15; // if the sql for suspicious sql is taking too long, then disable ixora
|
||||
|
||||
|
@ -23,6 +23,3 @@ Removed:
|
||||
Added:
|
||||
* index.html - prevent directory browsing on misconfigured servers
|
||||
* readme_moodle.txt - this file ;-)
|
||||
|
||||
Notes:
|
||||
* 2023-09-28 Added #[AllowDynamicProperties] above the ADOFetchObj class.
|
@ -141,7 +141,10 @@ GLOBAL $gSQLMaxRows,$gSQLBlockRows,$ADODB_ROUND;
|
||||
|
||||
default:
|
||||
if ($v) {
|
||||
$v = htmlspecialchars(stripslashes(trim($v)));
|
||||
$v = trim($v);
|
||||
if ($htmlspecialchars) {
|
||||
$v = htmlspecialchars($v);
|
||||
}
|
||||
} elseif ($v === null) {
|
||||
$v = '(NULL)';
|
||||
} else {
|
||||
|
@ -4,7 +4,7 @@
|
||||
<location>adodb</location>
|
||||
<name>AdoDB</name>
|
||||
<description>Database abstraction library for MySQL, PostgreSQL, MSSQL, Oracle, Interbase, Foxpro, Access, ADO, Sybase, DB2 and ODBC.</description>
|
||||
<version>5.22.5</version>
|
||||
<version>5.22.7</version>
|
||||
<license>BSD/LGPL</license>
|
||||
<licenseversion>3-Clause/2.1+</licenseversion>
|
||||
<repository>https://github.com/ADOdb/ADOdb</repository>
|
||||
|
Loading…
x
Reference in New Issue
Block a user