mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-52286 core: several fixes to ADOdb
This commit is contained in:
parent
bca69f937c
commit
cc3048eb41
5 changed files with 23 additions and 3 deletions
|
@ -381,4 +381,22 @@ class auth_db_testcase extends advanced_testcase {
|
||||||
|
|
||||||
$this->cleanup_auth_database();
|
$this->cleanup_auth_database();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Testing the function _colonscope() from ADOdb.
|
||||||
|
*/
|
||||||
|
public function test_adodb_colonscope() {
|
||||||
|
global $CFG;
|
||||||
|
require_once($CFG->libdir.'/adodb/adodb.inc.php');
|
||||||
|
require_once($CFG->libdir.'/adodb/drivers/adodb-odbc.inc.php');
|
||||||
|
require_once($CFG->libdir.'/adodb/drivers/adodb-db2ora.inc.php');
|
||||||
|
|
||||||
|
$this->resetAfterTest(false);
|
||||||
|
|
||||||
|
$sql = "select * from table WHERE column=:1 AND anothercolumn > :0";
|
||||||
|
$arr = array('b', 1);
|
||||||
|
list($sqlout, $arrout) = _colonscope($sql,$arr);
|
||||||
|
$this->assertEquals("select * from table WHERE column=? AND anothercolumn > ?", $sqlout);
|
||||||
|
$this->assertEquals(array(1, 'b'), $arrout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ global $_COLONARR,$_COLONSZ;
|
||||||
$_COLONARR = array();
|
$_COLONARR = array();
|
||||||
$_COLONSZ = sizeof($arr);
|
$_COLONSZ = sizeof($arr);
|
||||||
|
|
||||||
$sql2 = preg_replace("/(:[0-9]+)/e","_colontrack('\\1')",$sql);
|
$sql2 = preg_replace_callback('/(:[0-9]+)/', create_function('$m', 'return _colontrack($m[0]);'), $sql);
|
||||||
|
|
||||||
if (empty($_COLONARR)) return array($sql,$arr);
|
if (empty($_COLONARR)) return array($sql,$arr);
|
||||||
|
|
||||||
|
|
|
@ -1050,7 +1050,7 @@ class ADORecordSet_mysqli extends ADORecordSet{
|
||||||
//if results are attached to this pointer from Stored Proceedure calls, the next standard query will die 2014
|
//if results are attached to this pointer from Stored Proceedure calls, the next standard query will die 2014
|
||||||
//only a problem with persistant connections
|
//only a problem with persistant connections
|
||||||
|
|
||||||
while(mysqli_more_results($this->connection->_connectionID)){
|
while (@mysqli_more_results($this->connection->_connectionID)) {
|
||||||
@mysqli_next_result($this->connection->_connectionID);
|
@mysqli_next_result($this->connection->_connectionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ class ADORecordSet_mysqlt extends ADORecordSet_mysql{
|
||||||
|
|
||||||
class ADORecordSet_ext_mysqlt extends ADORecordSet_mysqlt {
|
class ADORecordSet_ext_mysqlt extends ADORecordSet_mysqlt {
|
||||||
|
|
||||||
function ADORecordSet_ext_mysqlt($queryID,$mode=false)
|
function __construct($queryID,$mode=false)
|
||||||
{
|
{
|
||||||
parent::__construct($queryID,$mode);
|
parent::__construct($queryID,$mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,5 +24,7 @@ Added:
|
||||||
|
|
||||||
Our changes:
|
Our changes:
|
||||||
* Removed random seed initialization from lib/adodb/adodb.inc.php:216 (see 038f546 and MDL-41198).
|
* Removed random seed initialization from lib/adodb/adodb.inc.php:216 (see 038f546 and MDL-41198).
|
||||||
|
* MDL-52286 fixed usage of /e in preg_replace, incorrect constructor in ADORecordSet_ext_mysqlt
|
||||||
|
and ADORecordSet_mysqli::_close(). Check if fixed upstream during the next upgrade and remove this line.
|
||||||
|
|
||||||
skodak, iarenaza, moodler, stronk7
|
skodak, iarenaza, moodler, stronk7
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue