Merge branch 'MDL-86406' of https://github.com/paulholden/moodle
This commit is contained in:
+1
-1
@@ -82,7 +82,7 @@
|
||||
"mtdowling/jmespath.php": "2.8.0",
|
||||
"spatie/php-cloneable": "1.0.2",
|
||||
"lbuchs/webauthn": "2.2.0",
|
||||
"adodb/adodb-php": "5.22.9",
|
||||
"adodb/adodb-php": "5.22.11",
|
||||
"html2text/html2text": "4.3.2",
|
||||
"michelf/php-markdown": "2.0.0",
|
||||
"mustache/mustache": "3.0.0",
|
||||
|
||||
Generated
+23
-9
@@ -4,20 +4,20 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "bef2866d8b72f97a7a3524c5b08a3cb6",
|
||||
"content-hash": "f55782767c6df3ed6acb19c27d3a21f8",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adodb/adodb-php",
|
||||
"version": "v5.22.9",
|
||||
"version": "v5.22.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ADOdb/ADOdb.git",
|
||||
"reference": "a568bfeb72d6b5942df747adc36b95165a083e60"
|
||||
"reference": "a741375176f48b084ca9a110c112323fc7101b75"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ADOdb/ADOdb/zipball/a568bfeb72d6b5942df747adc36b95165a083e60",
|
||||
"reference": "a568bfeb72d6b5942df747adc36b95165a083e60",
|
||||
"url": "https://api.github.com/repos/ADOdb/ADOdb/zipball/a741375176f48b084ca9a110c112323fc7101b75",
|
||||
"reference": "a741375176f48b084ca9a110c112323fc7101b75",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -65,7 +65,21 @@
|
||||
"issues": "https://github.com/ADOdb/ADOdb/issues",
|
||||
"source": "https://github.com/ADOdb/ADOdb"
|
||||
},
|
||||
"time": "2025-05-01T11:49:24+00:00"
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/ADOdb",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/dregad",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://thanks.dev/u/gh/adodb",
|
||||
"type": "thanks_dev"
|
||||
}
|
||||
],
|
||||
"time": "2025-11-22T15:37:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "aws/aws-crt-php",
|
||||
@@ -7749,7 +7763,7 @@
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": {},
|
||||
"stability-flags": [],
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
@@ -7774,6 +7788,6 @@
|
||||
"ext-fileinfo": "*",
|
||||
"ext-sodium": "*"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.9.0"
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
||||
@@ -717,35 +717,36 @@ class ADODB_Active_Record {
|
||||
}
|
||||
|
||||
// quote data in where clause
|
||||
function doquote(&$db, $val,$t)
|
||||
function doQuote($db, $val, $t)
|
||||
{
|
||||
switch($t) {
|
||||
case 'L':
|
||||
if (strpos($db->databaseType,'postgres') !== false) {
|
||||
return $db->qstr($val);
|
||||
}
|
||||
case 'D':
|
||||
case 'T':
|
||||
if (empty($val)) {
|
||||
return 'null';
|
||||
}
|
||||
case 'B':
|
||||
case 'N':
|
||||
case 'C':
|
||||
case 'X':
|
||||
if (is_null($val)) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
if (strlen($val)>0 &&
|
||||
(strncmp($val,"'",1) != 0 || substr($val,strlen($val)-1,1) != "'")
|
||||
) {
|
||||
return $db->qstr($val);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return $val;
|
||||
break;
|
||||
switch ($t) {
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case 'L':
|
||||
if (strpos($db->databaseType, 'postgres') !== false) {
|
||||
return $db->qstr($val);
|
||||
}
|
||||
case 'D':
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case 'T':
|
||||
if (empty($val)) {
|
||||
return 'null';
|
||||
}
|
||||
case 'B':
|
||||
case 'N':
|
||||
case 'C':
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case 'X':
|
||||
if (is_null($val)) {
|
||||
return 'null';
|
||||
}
|
||||
if ('' === (string)$val) {
|
||||
return "''";
|
||||
}
|
||||
if (substr($val, 0, 1) != "'" || substr($val,-1) != "'") {
|
||||
return $db->qstr($val);
|
||||
}
|
||||
default:
|
||||
return $val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -759,27 +760,12 @@ class ADODB_Active_Record {
|
||||
$f = $table->flds[$k];
|
||||
if ($f) {
|
||||
$columnName = $this->nameQuoter($db,$k);
|
||||
$parr[] = $columnName.' = '.$this->doquote($db,$this->$k,$db->MetaType($f->type));
|
||||
$parr[] = $columnName . ' = ' . $this->doQuote($db, $this->$k, $db->MetaType($f->type));
|
||||
}
|
||||
}
|
||||
return implode(' AND ', $parr);
|
||||
}
|
||||
|
||||
|
||||
function _QName($n,$db=false)
|
||||
{
|
||||
if (!ADODB_Active_Record::$_quoteNames) {
|
||||
return $n;
|
||||
}
|
||||
if (!$db) {
|
||||
$db = $this->DB();
|
||||
if (!$db) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $db->nameQuote.$n.$db->nameQuote;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------ Public functions below
|
||||
|
||||
function Load($where=null,$bindarr=false, $lock = false)
|
||||
@@ -983,7 +969,7 @@ class ADODB_Active_Record {
|
||||
}
|
||||
|
||||
$t = $db->MetaType($fld->type);
|
||||
$arr[$name] = $this->doquote($db,$val,$t);
|
||||
$arr[$name] = $this->doQuote($db, $val, $t);
|
||||
$valarr[] = $val;
|
||||
}
|
||||
|
||||
|
||||
@@ -762,28 +762,36 @@ class ADODB_Active_Record {
|
||||
}
|
||||
|
||||
// quote data in where clause
|
||||
function doquote(&$db, $val,$t)
|
||||
function doQuote($db, $val, $t)
|
||||
{
|
||||
switch($t) {
|
||||
case 'D':
|
||||
case 'T':
|
||||
if (empty($val)) {
|
||||
return 'null';
|
||||
}
|
||||
case 'C':
|
||||
case 'X':
|
||||
if (is_null($val)) {
|
||||
return 'null';
|
||||
}
|
||||
if (strlen($val)>0 &&
|
||||
(strncmp($val,"'",1) != 0 || substr($val,strlen($val)-1,1) != "'")
|
||||
) {
|
||||
return $db->qstr($val);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return $val;
|
||||
break;
|
||||
switch ($t) {
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case 'L':
|
||||
if (strpos($db->databaseType, 'postgres') !== false) {
|
||||
return $db->qstr($val);
|
||||
}
|
||||
case 'D':
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case 'T':
|
||||
if (empty($val)) {
|
||||
return 'null';
|
||||
}
|
||||
case 'B':
|
||||
case 'N':
|
||||
case 'C':
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case 'X':
|
||||
if (is_null($val)) {
|
||||
return 'null';
|
||||
}
|
||||
if ('' === (string)$val) {
|
||||
return "''";
|
||||
}
|
||||
if (substr($val, 0, 1) != "'" || substr($val,-1) != "'") {
|
||||
return $db->qstr($val);
|
||||
}
|
||||
default:
|
||||
return $val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -796,7 +804,7 @@ class ADODB_Active_Record {
|
||||
foreach($keys as $k) {
|
||||
$f = $table->flds[$k];
|
||||
if ($f) {
|
||||
$parr[] = $k.' = '.$this->doquote($db,$this->$k,$db->MetaType($f->type));
|
||||
$parr[] = $k . ' = ' . $this->doQuote($db, $this->$k, $db->MetaType($f->type));
|
||||
}
|
||||
}
|
||||
return implode(' and ', $parr);
|
||||
@@ -1081,7 +1089,7 @@ class ADODB_Active_Record {
|
||||
continue;
|
||||
}
|
||||
$t = $db->MetaType($fld->type);
|
||||
$arr[$name] = $this->doquote($db,$val,$t);
|
||||
$arr[$name] = $this->doQuote($db, $val, $t);
|
||||
$valarr[] = $val;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ $ADODB_INCLUDED_CSV = 1;
|
||||
$rs->EOF = true;
|
||||
$rs->_numOfFields = 0;
|
||||
$rs->sql = urldecode($meta[2]);
|
||||
$rs->affectedrows = (integer)$meta[3];
|
||||
$rs->affectedrows = (int)$meta[3];
|
||||
$rs->insertid = $meta[4];
|
||||
return $rs;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ $ADODB_INCLUDED_CSV = 1;
|
||||
# +0 sec after timeout, give processes 100% chance of timing out
|
||||
if (sizeof($meta) > 1) {
|
||||
if($timeout >0){
|
||||
$tdiff = (integer)( $meta[1]+$timeout - time());
|
||||
$tdiff = (int)( $meta[1]+$timeout - time());
|
||||
if ($tdiff <= 2) {
|
||||
switch($tdiff) {
|
||||
case 4:
|
||||
|
||||
@@ -107,7 +107,7 @@ function adodb_error($provider,$dbType,$errno)
|
||||
|
||||
function adodb_error_pg($errormsg)
|
||||
{
|
||||
if (is_numeric($errormsg)) return (integer) $errormsg;
|
||||
if (is_numeric($errormsg)) return (int) $errormsg;
|
||||
// Postgres has no lock-wait timeout. The best we could do would be to set a statement timeout.
|
||||
static $error_regexps = array(
|
||||
'(Table does not exist\.|Relation [\"\'].*[\"\'] does not exist|sequence does not exist|class ".+" not found)$' => DB_ERROR_NOSUCHTABLE,
|
||||
|
||||
@@ -1158,7 +1158,7 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $fnameq, $arrFields,
|
||||
case "I":
|
||||
case "R":
|
||||
$val = $arrFields[$fname];
|
||||
if (!is_numeric($val)) $val = (integer) $val;
|
||||
if (!is_numeric($val)) $val = (int) $val;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -68,7 +68,7 @@ class ADODB_Pager {
|
||||
$next_page = $id.'_next_page';
|
||||
|
||||
if (isset($_GET[$next_page])) {
|
||||
$_SESSION[$curr_page] = (integer) $_GET[$next_page];
|
||||
$_SESSION[$curr_page] = (int) $_GET[$next_page];
|
||||
}
|
||||
if (empty($_SESSION[$curr_page])) $_SESSION[$curr_page] = 1; ## at first page
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ $ADODB_PERF_MIN = 0.05; // log only if >= minimum number of secs to run
|
||||
function adodb_getmem()
|
||||
{
|
||||
if (function_exists('memory_get_usage'))
|
||||
return (integer) ((memory_get_usage()+512)/1024);
|
||||
return (int) ((memory_get_usage()+512)/1024);
|
||||
|
||||
$pid = getmypid();
|
||||
|
||||
@@ -49,7 +49,7 @@ function adodb_getmem()
|
||||
if (sizeof($output) == 0) return 0;
|
||||
|
||||
$memarr = explode(' ',$output[0]);
|
||||
if (sizeof($memarr)>=2) return (integer) $memarr[1];
|
||||
if (sizeof($memarr)>=2) return (int) $memarr[1];
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -361,7 +361,7 @@ Committed_AS: 348732 kB
|
||||
if (!$info) return false;
|
||||
|
||||
if (strncmp(PHP_OS,'WIN',3)==0) {
|
||||
return (integer) $info[0];
|
||||
return (int) $info[0];
|
||||
}else {
|
||||
if (empty($this->_lastLoad)) {
|
||||
sleep(1);
|
||||
@@ -601,7 +601,7 @@ Committed_AS: 348732 kB
|
||||
$arr[0] = (float)$this->DBParameter('data cache hit ratio');
|
||||
$arr[1] = (float)$this->DBParameter('data reads');
|
||||
$arr[2] = (float)$this->DBParameter('data writes');
|
||||
$arr[3] = (integer) $this->DBParameter('current connections');
|
||||
$arr[3] = (int) $this->DBParameter('current connections');
|
||||
return $arr;
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ Committed_AS: 348732 kB
|
||||
else $do = 'stats';
|
||||
|
||||
if (isset($_GET['nsql'])) {
|
||||
if ($_GET['nsql'] > 0) $nsql = $_SESSION['ADODB_PERF_SQL'] = (integer) $_GET['nsql'];
|
||||
if ($_GET['nsql'] > 0) $nsql = $_SESSION['ADODB_PERF_SQL'] = (int) $_GET['nsql'];
|
||||
}
|
||||
echo "<title>ADOdb Performance Monitor on $app</title><body bgcolor=white>";
|
||||
if ($do == 'viewsql') $form = "<td><form># SQL:<input type=hidden value=viewsql name=do> <input type=text size=4 name=nsql value=$nsql><input type=submit value=Go></td></form>";
|
||||
@@ -976,7 +976,7 @@ Committed_AS: 348732 kB
|
||||
rs2html($rs);
|
||||
}
|
||||
} else {
|
||||
$e1 = (integer) $this->conn->ErrorNo();
|
||||
$e1 = (int) $this->conn->ErrorNo();
|
||||
$e2 = $this->conn->ErrorMsg();
|
||||
if (($e1) || ($e2)) {
|
||||
if (empty($e1)) $e1 = '-1'; // postgresql fix
|
||||
|
||||
@@ -687,8 +687,8 @@ function adodb_year_digit_check($y)
|
||||
{
|
||||
if ($y < 100) {
|
||||
|
||||
$yr = (integer) date("Y");
|
||||
$century = (integer) ($yr /100);
|
||||
$yr = (int) date("Y");
|
||||
$century = (int) ($yr /100);
|
||||
|
||||
if ($yr%100 > 50) {
|
||||
$c1 = $century + 1;
|
||||
|
||||
@@ -198,7 +198,7 @@ if (!defined('_ADODB_LAYER')) {
|
||||
/**
|
||||
* ADODB version as a string.
|
||||
*/
|
||||
$ADODB_vers = 'v5.22.9 2025-05-01';
|
||||
$ADODB_vers = 'v5.22.11 2025-11-22';
|
||||
|
||||
/**
|
||||
* Determines whether recordset->RecordCount() is used.
|
||||
@@ -2176,7 +2176,7 @@ if (!defined('_ADODB_LAYER')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$midrow = (integer) ($total/2);
|
||||
$midrow = (int) ($total/2);
|
||||
$rs = $this->SelectLimit("select $field from $table $where order by 1",1,$midrow);
|
||||
if ($rs && !$rs->EOF) {
|
||||
return reset($rs->fields);
|
||||
@@ -2655,39 +2655,48 @@ if (!defined('_ADODB_LAYER')) {
|
||||
* @noinspection PhpUnusedParameterInspection
|
||||
*/
|
||||
function autoExecute($table, $fields_values, $mode = 'INSERT', $where = '', $forceUpdate = true, $magic_quotes = false) {
|
||||
switch($mode) {
|
||||
case DB_AUTOQUERY_INSERT:
|
||||
case DB_AUTOQUERY_UPDATE:
|
||||
break;
|
||||
case 'UPDATE':
|
||||
$mode = DB_AUTOQUERY_UPDATE;
|
||||
break;
|
||||
case 'INSERT':
|
||||
$mode = DB_AUTOQUERY_INSERT;
|
||||
break;
|
||||
default:
|
||||
$this->outp_throw("AutoExecute: Unknown mode=$mode", 'AutoExecute');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($fields_values)) {
|
||||
$this->outp_throw('AutoExecute: Empty fields array', 'AutoExecute');
|
||||
return false;
|
||||
}
|
||||
if (empty($where) && ($mode == 'UPDATE' || $mode == 2 /* DB_AUTOQUERY_UPDATE */)) {
|
||||
if (empty($where) && $mode == DB_AUTOQUERY_UPDATE) {
|
||||
$this->outp_throw('AutoExecute: Illegal mode=UPDATE with empty WHERE clause', 'AutoExecute');
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM $table";
|
||||
$rs = $this->SelectLimit($sql, 1);
|
||||
if (!$rs) {
|
||||
return false; // table does not exist
|
||||
}
|
||||
|
||||
$rs->tableName = $table;
|
||||
if (!empty($where)) {
|
||||
$sql .= " WHERE $where";
|
||||
}
|
||||
|
||||
$rs = $this->SelectLimit($sql, 1);
|
||||
if (!$rs || $mode == DB_AUTOQUERY_UPDATE && $rs->EOF) {
|
||||
// Table does not exist or udpate where clause matches no rows
|
||||
return false;
|
||||
}
|
||||
|
||||
$rs->tableName = $table;
|
||||
$rs->sql = $sql;
|
||||
|
||||
switch($mode) {
|
||||
case 'UPDATE':
|
||||
case DB_AUTOQUERY_UPDATE:
|
||||
$sql = $this->GetUpdateSQL($rs, $fields_values, $forceUpdate);
|
||||
break;
|
||||
case 'INSERT':
|
||||
case DB_AUTOQUERY_INSERT:
|
||||
$sql = $this->GetInsertSQL($rs, $fields_values);
|
||||
break;
|
||||
default:
|
||||
$this->outp_throw("AutoExecute: Unknown mode=$mode", 'AutoExecute');
|
||||
return false;
|
||||
if ($mode == DB_AUTOQUERY_UPDATE) {
|
||||
$sql = $this->getUpdateSQL($rs, $fields_values, $forceUpdate);
|
||||
} else {
|
||||
$sql = $this->getInsertSQL($rs, $fields_values);
|
||||
}
|
||||
return $sql && $this->Execute($sql);
|
||||
}
|
||||
@@ -5701,10 +5710,10 @@ class ADORecordSet implements IteratorAggregate {
|
||||
$nconnect = true; $persist = true; break;
|
||||
case 'persist':
|
||||
case 'persistent': $persist = $v; break;
|
||||
case 'debug': $obj->debug = (integer) $v; break;
|
||||
case 'debug': $obj->debug = (int) $v; break;
|
||||
#ibase
|
||||
case 'role': $obj->role = $v; break;
|
||||
case 'dialect': $obj->dialect = (integer) $v; break;
|
||||
case 'dialect': $obj->dialect = (int) $v; break;
|
||||
case 'charset': $obj->charset = $v; $obj->charSet=$v; break;
|
||||
case 'buffers': $obj->buffers = $v; break;
|
||||
case 'fetchmode': $obj->SetFetchMode($v); break;
|
||||
|
||||
@@ -407,7 +407,7 @@ class ADORecordSet_ado extends ADORecordSet {
|
||||
// $rs->AbsolutePosition->$row-2;
|
||||
// return true;
|
||||
if ($this->_currentRow > $row) return false;
|
||||
@$rs->Move((integer)$row - $this->_currentRow-1); //adBookmarkFirst
|
||||
@$rs->Move((int)$row - $this->_currentRow-1); //adBookmarkFirst
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ class ADORecordSet_ado extends ADORecordSet {
|
||||
// $rs->AbsolutePosition->$row-2;
|
||||
// return true;
|
||||
if ($this->_currentRow > $row) return false;
|
||||
@$rs->Move((integer)$row - $this->_currentRow-1); //adBookmarkFirst
|
||||
@$rs->Move((int)$row - $this->_currentRow-1); //adBookmarkFirst
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ class ADODB_ads extends ADOConnection
|
||||
*/
|
||||
function ODBCTypes($t)
|
||||
{
|
||||
switch ((integer)$t) {
|
||||
switch ((int)$t) {
|
||||
case 1:
|
||||
case 12:
|
||||
case 0:
|
||||
|
||||
@@ -103,7 +103,7 @@ class ADODB_csv extends ADOConnection {
|
||||
$at = strpos($err,'::::');
|
||||
if ($at === false) {
|
||||
$this->_errorMsg = $err;
|
||||
$this->_errorNo = (integer)$err;
|
||||
$this->_errorNo = (int)$err;
|
||||
} else {
|
||||
$this->_errorMsg = substr($err,$at+4,1024);
|
||||
$this->_errorNo = -9999;
|
||||
@@ -159,7 +159,7 @@ class ADODB_csv extends ADOConnection {
|
||||
$at = strpos($err,'::::');
|
||||
if ($at === false) {
|
||||
$this->_errorMsg = $err;
|
||||
$this->_errorNo = (integer)$err;
|
||||
$this->_errorNo = (int)$err;
|
||||
} else {
|
||||
$this->_errorMsg = substr($err,$at+4,1024);
|
||||
$this->_errorNo = -9999;
|
||||
|
||||
@@ -179,7 +179,7 @@ class ADODB_db2 extends ADOConnection {
|
||||
$db2Options);
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
$this->_connectionID = $db2Function($argDSN,
|
||||
'',
|
||||
'',
|
||||
@@ -193,7 +193,7 @@ class ADODB_db2 extends ADOConnection {
|
||||
|
||||
if ($this->_connectionID && $argDatabasename)
|
||||
$this->execute("SET SCHEMA=$argDatabasename");
|
||||
|
||||
|
||||
return $this->_connectionID != false;
|
||||
|
||||
}
|
||||
@@ -228,7 +228,7 @@ class ADODB_db2 extends ADOConnection {
|
||||
$connectionParameters['dsn'] = $argDSN;
|
||||
$connectionParameters['database'] = $argDatabasename;
|
||||
$connectionParameters['catalogue'] = false;
|
||||
|
||||
|
||||
return $connectionParameters;
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ class ADODB_db2 extends ADOConnection {
|
||||
|
||||
function selectLimit($sql,$nrows=-1,$offset=-1,$inputArr=false,$secs2cache=0)
|
||||
{
|
||||
$nrows = (integer) $nrows;
|
||||
$nrows = (int) $nrows;
|
||||
|
||||
if ($offset <= 0)
|
||||
{
|
||||
@@ -1059,7 +1059,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2
|
||||
*/
|
||||
function DB2Types($t)
|
||||
{
|
||||
switch ((integer)$t) {
|
||||
switch ((int)$t) {
|
||||
case 1:
|
||||
case 12:
|
||||
case 0:
|
||||
|
||||
@@ -101,7 +101,7 @@ function _colonparser($sql,$arr)
|
||||
$ch2 = $at < $lensql ? $sql[$at] : '';
|
||||
} while ('0' <= $ch && $ch <= '9');
|
||||
#echo "$n $arrsize ] ";
|
||||
$n = (integer) $n;
|
||||
$n = (int) $n;
|
||||
if ($n < $arrsize) {
|
||||
$sql2 .= substr($sql,$nprev,$nat-$nprev-1).'?';
|
||||
$nprev = $at-1;
|
||||
|
||||
@@ -41,7 +41,7 @@ define('ADODB_DB2OCI',1);
|
||||
function _colontrack($p)
|
||||
{
|
||||
global $_COLONARR, $_COLONSZ;
|
||||
$v = (integer) substr($p[1], 1);
|
||||
$v = (int) substr($p[1], 1);
|
||||
if ($v > $_COLONSZ) return $p[1];
|
||||
$_COLONARR[] = $v;
|
||||
return '?';
|
||||
|
||||
@@ -427,7 +427,7 @@ class ADODB_firebird extends ADOConnection {
|
||||
$rs = $this->Execute($getnext);
|
||||
}
|
||||
if ($rs && !$rs->EOF) {
|
||||
$this->genID = (integer) reset($rs->fields);
|
||||
$this->genID = (int) reset($rs->fields);
|
||||
}
|
||||
else {
|
||||
$this->genID = 0; // false
|
||||
@@ -454,7 +454,7 @@ class ADODB_firebird extends ADOConnection {
|
||||
|
||||
public function errorNo()
|
||||
{
|
||||
return (integer) $this->_errorCode;
|
||||
return (int) $this->_errorCode;
|
||||
}
|
||||
|
||||
function errorMsg()
|
||||
@@ -989,8 +989,8 @@ class ADODB_firebird extends ADOConnection {
|
||||
*/
|
||||
public function selectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $secs2cache=0)
|
||||
{
|
||||
$nrows = (integer) $nrows;
|
||||
$offset = (integer) $offset;
|
||||
$nrows = (int) $nrows;
|
||||
$offset = (int) $offset;
|
||||
$str = 'SELECT ';
|
||||
if ($nrows >= 0) $str .= "FIRST $nrows ";
|
||||
$str .=($offset>=0) ? "SKIP $offset " : '';
|
||||
|
||||
@@ -289,7 +289,7 @@ class ADODB_ibase extends ADOConnection {
|
||||
$rs = $this->Execute($getnext);
|
||||
}
|
||||
if ($rs && !$rs->EOF) {
|
||||
$this->genID = (integer) reset($rs->fields);
|
||||
$this->genID = (int) reset($rs->fields);
|
||||
}
|
||||
else {
|
||||
$this->genID = 0; // false
|
||||
@@ -314,7 +314,7 @@ class ADODB_ibase extends ADOConnection {
|
||||
|
||||
function ErrorNo()
|
||||
{
|
||||
if (preg_match('/error code = ([\-0-9]*)/i', $this->_errorMsg,$arr)) return (integer) $arr[1];
|
||||
if (preg_match('/error code = ([\-0-9]*)/i', $this->_errorMsg,$arr)) return (int) $arr[1];
|
||||
else return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,11 +101,11 @@ class ADODB_ldap extends ADOConnection {
|
||||
/*
|
||||
Valid Domain Values for LDAP Options:
|
||||
|
||||
LDAP_OPT_DEREF (integer)
|
||||
LDAP_OPT_SIZELIMIT (integer)
|
||||
LDAP_OPT_TIMELIMIT (integer)
|
||||
LDAP_OPT_PROTOCOL_VERSION (integer)
|
||||
LDAP_OPT_ERROR_NUMBER (integer)
|
||||
LDAP_OPT_DEREF (int)
|
||||
LDAP_OPT_SIZELIMIT (int)
|
||||
LDAP_OPT_TIMELIMIT (int)
|
||||
LDAP_OPT_PROTOCOL_VERSION (int)
|
||||
LDAP_OPT_ERROR_NUMBER (int)
|
||||
LDAP_OPT_REFERRALS (boolean)
|
||||
LDAP_OPT_RESTART (boolean)
|
||||
LDAP_OPT_HOST_NAME (string)
|
||||
|
||||
@@ -149,9 +149,9 @@ class ADODB_mysqli extends ADOConnection {
|
||||
*
|
||||
* Parameter must be one of the constants listed in mysqli_options().
|
||||
* @see https://www.php.net/manual/en/mysqli.options.php
|
||||
*
|
||||
* OR
|
||||
*
|
||||
*
|
||||
* OR
|
||||
*
|
||||
* Parameter must be a string matching one of the following special cases.
|
||||
* 'ssl' - SSL values e.g. ('ssl' => ['ca' => '/path/to/ca.crt.pem'])
|
||||
* 'clientflags' - Client flags of type 'MYSQLI_CLIENT_'
|
||||
@@ -159,7 +159,7 @@ class ADODB_mysqli extends ADOConnection {
|
||||
* @see https://www.php.net/manual/en/mysqli.constants.php
|
||||
* 'socket' - The socket or named pipe that should be used
|
||||
* 'port' - The port number to attempt to connect to the MySQL server
|
||||
*
|
||||
*
|
||||
* @param string|int $parameter The parameter to set
|
||||
* @param string|int|array $value The value of the parameter
|
||||
*
|
||||
@@ -1256,7 +1256,7 @@ class ADODB_mysqli extends ADOConnection {
|
||||
$typeString .= 'i';
|
||||
} elseif (is_float($v)) {
|
||||
$typeString .= 'd';
|
||||
} elseif (is_object($v)) {
|
||||
} elseif (is_object($v) && !method_exists($v, '__toString')) {
|
||||
// Assume a blob
|
||||
$typeString .= 'b';
|
||||
} else {
|
||||
|
||||
@@ -355,7 +355,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od
|
||||
*/
|
||||
function ODBCTypes($t)
|
||||
{
|
||||
switch ((integer)$t) {
|
||||
switch ((int)$t) {
|
||||
case 1:
|
||||
case 12:
|
||||
case 0:
|
||||
|
||||
@@ -212,7 +212,7 @@ class ADODB_ODBC_DB2 extends ADODB_odbc {
|
||||
|
||||
function SelectLimit($sql, $nrows = -1, $offset = -1, $inputArr = false, $secs2cache = 0)
|
||||
{
|
||||
$nrows = (integer) $nrows;
|
||||
$nrows = (int) $nrows;
|
||||
if ($offset <= 0) {
|
||||
// could also use " OPTIMIZE FOR $nrows ROWS "
|
||||
if ($nrows >= 0) $sql .= " FETCH FIRST $nrows ROWS ONLY ";
|
||||
|
||||
@@ -404,7 +404,7 @@ class ADODB_pdo extends ADOConnection {
|
||||
if (sizeof($arr)<2) {
|
||||
return '';
|
||||
}
|
||||
if ((integer)$arr[0]) {
|
||||
if ((int)$arr[0]) {
|
||||
return $arr[2];
|
||||
}
|
||||
else {
|
||||
@@ -616,7 +616,7 @@ class ADODB_pdo extends ADOConnection {
|
||||
if ($stmt) {
|
||||
|
||||
$arr = $stmt->errorinfo();
|
||||
if ((integer)$arr[1]) {
|
||||
if ((int)$arr[1]) {
|
||||
$this->_errormsg = $arr[2];
|
||||
$this->_errorno = $arr[1];
|
||||
}
|
||||
@@ -752,7 +752,7 @@ class ADOPDOStatement {
|
||||
}
|
||||
|
||||
if (is_array($arr)) {
|
||||
if ((integer) $arr[0] && isset($arr[2])) {
|
||||
if ((int) $arr[0] && isset($arr[2])) {
|
||||
return $arr[2];
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -163,7 +163,7 @@ class ADODB_pdo_dblib extends ADODB_pdo
|
||||
if ($stmt) {
|
||||
|
||||
$arr = $stmt->errorinfo();
|
||||
if ((integer)$arr[1]) {
|
||||
if ((int)$arr[1]) {
|
||||
$this->_errormsg = $arr[2];
|
||||
$this->_errorno = $arr[1];
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
/**
|
||||
* Class ADODB_pdo_firebird
|
||||
*/
|
||||
class ADODB_pdo_firebird extends ADODB_pdo
|
||||
class ADODB_pdo_firebird extends ADODB_pdo_base
|
||||
{
|
||||
public $dialect = 3;
|
||||
public $metaTablesSQL = "select lower(rdb\$relation_name) from rdb\$relations where rdb\$relation_name not like 'RDB\$%'";
|
||||
@@ -245,7 +245,7 @@ class ADODB_pdo_firebird extends ADODB_pdo
|
||||
$rs = $this->execute($getnext);
|
||||
}
|
||||
if ($rs && !$rs->EOF) {
|
||||
$this->genID = (integer)reset($rs->fields);
|
||||
$this->genID = (int)reset($rs->fields);
|
||||
} else {
|
||||
$this->genID = 0; // false
|
||||
}
|
||||
@@ -259,8 +259,8 @@ class ADODB_pdo_firebird extends ADODB_pdo
|
||||
|
||||
public function selectLimit($sql, $nrows = -1, $offset = -1, $inputarr = false, $secs = 0)
|
||||
{
|
||||
$nrows = (integer)$nrows;
|
||||
$offset = (integer)$offset;
|
||||
$nrows = (int)$nrows;
|
||||
$offset = (int)$offset;
|
||||
$str = 'SELECT ';
|
||||
if ($nrows >= 0) {
|
||||
$str .= "FIRST $nrows ";
|
||||
|
||||
@@ -117,8 +117,8 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
{
|
||||
$nrows = (int) $nrows;
|
||||
$offset = (int) $offset;
|
||||
$offsetStr = ($offset >= 0) ? " OFFSET ".((integer)$offset) : '';
|
||||
$limitStr = ($nrows >= 0) ? " LIMIT ".((integer)$nrows) : '';
|
||||
$offsetStr = ($offset >= 0) ? " OFFSET ".((int)$offset) : '';
|
||||
$limitStr = ($nrows >= 0) ? " LIMIT ".((int)$nrows) : '';
|
||||
if ($secs2cache)
|
||||
$rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
|
||||
else
|
||||
|
||||
@@ -55,7 +55,7 @@ if (!defined('ADODB_SYBASE_SQLANYWHERE')){
|
||||
|
||||
$fd = fopen ($filename, "rb");
|
||||
|
||||
$integer_chunks = (integer)filesize($filename) / $chunk_size;
|
||||
$integer_chunks = (int)filesize($filename) / $chunk_size;
|
||||
$modulus = filesize($filename) % $chunk_size;
|
||||
if ($modulus != 0){
|
||||
$integer_chunks += 1;
|
||||
@@ -83,7 +83,7 @@ if (!defined('ADODB_SYBASE_SQLANYWHERE')){
|
||||
function load_blobvar_from_var($blobVarName, &$varName) {
|
||||
$chunk_size = 1000;
|
||||
|
||||
$integer_chunks = (integer)strlen($varName) / $chunk_size;
|
||||
$integer_chunks = (int)strlen($varName) / $chunk_size;
|
||||
$modulus = strlen($varName) % $chunk_size;
|
||||
if ($modulus != 0){
|
||||
$integer_chunks += 1;
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
*
|
||||
* @copyright 2000-2013 John Lim
|
||||
* @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
|
||||
*
|
||||
* @TODO Duplicate code is due to the legacy sqlite driver - delete this when removing the old driver
|
||||
* @noinspection DuplicatedCode
|
||||
*/
|
||||
|
||||
// security - hide paths
|
||||
@@ -95,7 +98,6 @@ class ADODB_sqlite3 extends ADOConnection {
|
||||
{
|
||||
$fieldobj = $t;
|
||||
$t = $fieldobj->type;
|
||||
$len = $fieldobj->max_length;
|
||||
}
|
||||
|
||||
$t = strtoupper($t);
|
||||
@@ -162,28 +164,30 @@ class ADODB_sqlite3 extends ADOConnection {
|
||||
function MetaColumns($table, $normalize=true)
|
||||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
$false = false;
|
||||
$save = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||
if ($this->fetchMode !== false) {
|
||||
$savem = $this->SetFetchMode(false);
|
||||
}
|
||||
$rs = $this->Execute("PRAGMA table_info('$table')");
|
||||
|
||||
$rs = $this->execute("PRAGMA table_info(?)", array($table));
|
||||
|
||||
if (isset($savem)) {
|
||||
$this->SetFetchMode($savem);
|
||||
}
|
||||
|
||||
if (!$rs) {
|
||||
$ADODB_FETCH_MODE = $save;
|
||||
return $false;
|
||||
return false;
|
||||
}
|
||||
|
||||
$arr = array();
|
||||
while ($r = $rs->FetchRow()) {
|
||||
$type = explode('(',$r['type']);
|
||||
$type = explode('(', $r['type']);
|
||||
$size = '';
|
||||
if (sizeof($type)==2) {
|
||||
$size = trim($type[1],')');
|
||||
if (sizeof($type) == 2) {
|
||||
$size = trim($type[1], ')');
|
||||
}
|
||||
$fn = strtoupper($r['name']);
|
||||
$fld = new ADOFieldObject;
|
||||
$fld->name = $r['name'];
|
||||
$fld->type = $type[0];
|
||||
@@ -192,7 +196,7 @@ class ADODB_sqlite3 extends ADOConnection {
|
||||
$fld->default_value = $r['dflt_value'];
|
||||
$fld->scale = 0;
|
||||
if (isset($r['pk']) && $r['pk']) {
|
||||
$fld->primary_key=1;
|
||||
$fld->primary_key = 1;
|
||||
}
|
||||
if ($save == ADODB_FETCH_NUM) {
|
||||
$arr[] = $fld;
|
||||
@@ -207,58 +211,44 @@ class ADODB_sqlite3 extends ADOConnection {
|
||||
|
||||
public function metaForeignKeys($table, $owner = '', $upper = false, $associative = false)
|
||||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
if ($ADODB_FETCH_MODE == ADODB_FETCH_ASSOC
|
||||
|| $this->fetchMode == ADODB_FETCH_ASSOC)
|
||||
$associative = true;
|
||||
global $ADODB_FETCH_MODE;
|
||||
if ($ADODB_FETCH_MODE == ADODB_FETCH_ASSOC || $this->fetchMode == ADODB_FETCH_ASSOC) {
|
||||
$associative = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read sqlite master to find foreign keys
|
||||
*/
|
||||
// Read sqlite master to find foreign keys
|
||||
$sql = "SELECT sql
|
||||
FROM (
|
||||
SELECT sql sql, type type, tbl_name tbl_name, name name
|
||||
FROM sqlite_master
|
||||
)
|
||||
WHERE type != 'meta'
|
||||
AND sql NOTNULL
|
||||
AND LOWER(name) ='" . strtolower($table) . "'";
|
||||
FROM sqlite_master
|
||||
WHERE sql NOTNULL
|
||||
AND LOWER(name) = ?";
|
||||
$tableSql = $this->getOne($sql, [strtolower($table)]);
|
||||
|
||||
$tableSql = $this->getOne($sql);
|
||||
// Regex will identify foreign keys in both column and table constraints
|
||||
// Reference: https://sqlite.org/syntax/foreign-key-clause.html
|
||||
// Subpatterns: 1/2 = source columns; 3 = parent table; 4 = parent columns.
|
||||
preg_match_all(
|
||||
'/[(,]\s*(?:FOREIGN\s+KEY\s*\(([^)]+)\)|(\w+).*?)\s*REFERENCES\s+(\w+|"[^"]+")\(([^)]+)\)/i',
|
||||
$tableSql,
|
||||
$fkeyMatches,
|
||||
PREG_SET_ORDER
|
||||
);
|
||||
|
||||
$fkeyList = array();
|
||||
$ylist = preg_split("/,+/",$tableSql);
|
||||
foreach ($ylist as $y)
|
||||
{
|
||||
if (!preg_match('/FOREIGN/',$y))
|
||||
continue;
|
||||
foreach ($fkeyMatches as $fkey) {
|
||||
$src_col = $fkey[1] ?: $fkey[2];
|
||||
$ref_table = $upper ? strtoupper($fkey[3]) : $fkey[3];
|
||||
$ref_col = $fkey[4];
|
||||
|
||||
$matches = false;
|
||||
preg_match_all('/\((.+?)\)/i',$y,$matches);
|
||||
$tmatches = false;
|
||||
preg_match_all('/REFERENCES (.+?)\(/i',$y,$tmatches);
|
||||
|
||||
if ($associative)
|
||||
{
|
||||
if (!isset($fkeyList[$tmatches[1][0]]))
|
||||
$fkeyList[$tmatches[1][0]] = array();
|
||||
$fkeyList[$tmatches[1][0]][$matches[1][0]] = $matches[1][1];
|
||||
if ($associative) {
|
||||
$fkeyList[$ref_table][$src_col] = $ref_col;
|
||||
} else {
|
||||
$fkeyList[$ref_table][] = $src_col . '=' . $ref_col;
|
||||
}
|
||||
else
|
||||
$fkeyList[$tmatches[1][0]][] = $matches[1][0] . '=' . $matches[1][1];
|
||||
}
|
||||
|
||||
if ($associative)
|
||||
{
|
||||
if ($upper)
|
||||
$fkeyList = array_change_key_case($fkeyList,CASE_UPPER);
|
||||
else
|
||||
$fkeyList = array_change_key_case($fkeyList,CASE_LOWER);
|
||||
}
|
||||
return $fkeyList;
|
||||
}
|
||||
|
||||
|
||||
function _init($parentDriver)
|
||||
{
|
||||
$parentDriver->hasTransactions = false;
|
||||
@@ -371,24 +361,24 @@ class ADODB_sqlite3 extends ADOConnection {
|
||||
*/
|
||||
var $_genSeqSQL = "create table %s (id integer)";
|
||||
|
||||
function GenID($seq='adodbseq',$start=1)
|
||||
function GenID($seqname='adodbseq', $startID=1)
|
||||
{
|
||||
// if you have to modify the parameter below, your database is overloaded,
|
||||
// or you need to implement generation of id's yourself!
|
||||
$MAXLOOPS = 100;
|
||||
//$this->debug=1;
|
||||
while (--$MAXLOOPS>=0) {
|
||||
@($num = $this->GetOne("select id from $seq"));
|
||||
@($num = $this->GetOne("select id from $seqname"));
|
||||
if ($num === false) {
|
||||
$this->Execute(sprintf($this->_genSeqSQL ,$seq));
|
||||
$start -= 1;
|
||||
$this->Execute(sprintf($this->_genSeqSQL ,$seqname));
|
||||
$startID -= 1;
|
||||
$num = '0';
|
||||
$ok = $this->Execute("insert into $seq values($start)");
|
||||
$ok = $this->Execute("insert into $seqname values($startID)");
|
||||
if (!$ok) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->Execute("update $seq set id=id+1 where id=$num");
|
||||
$this->Execute("update $seqname set id=id+1 where id=$num");
|
||||
|
||||
if ($this->affected_rows() > 0) {
|
||||
$num += 1;
|
||||
@@ -397,7 +387,7 @@ class ADODB_sqlite3 extends ADOConnection {
|
||||
}
|
||||
}
|
||||
if ($fn = $this->raiseErrorFn) {
|
||||
$fn($this->databaseType,'GENID',-32000,"Unable to generate unique id after $MAXLOOPS attempts",$seq,$num);
|
||||
$fn($this->databaseType, 'GENID', -32000, "Unable to generate unique id after $MAXLOOPS attempts", $seqname, $num);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -430,72 +420,65 @@ class ADODB_sqlite3 extends ADOConnection {
|
||||
return $this->_connectionID->close();
|
||||
}
|
||||
|
||||
function metaIndexes($table, $primary = FALSE, $owner = false)
|
||||
function metaIndexes($table, $primary = false, $owner = false)
|
||||
{
|
||||
$false = false;
|
||||
// save old fetch mode
|
||||
global $ADODB_FETCH_MODE;
|
||||
$save = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||
if ($this->fetchMode !== FALSE) {
|
||||
$savem = $this->SetFetchMode(FALSE);
|
||||
if ($this->fetchMode !== false) {
|
||||
$savem = $this->SetFetchMode(false);
|
||||
}
|
||||
|
||||
$pragmaData = array();
|
||||
$table = strtolower($table);
|
||||
|
||||
/*
|
||||
* If we want the primary key, we must extract
|
||||
* it from the table statement, and the pragma
|
||||
*/
|
||||
if ($primary)
|
||||
{
|
||||
$sql = sprintf('PRAGMA table_info([%s]);',
|
||||
strtolower($table)
|
||||
);
|
||||
$pragmaData = $this->getAll($sql);
|
||||
}
|
||||
|
||||
/*
|
||||
* Exclude the empty entry for the primary index
|
||||
*/
|
||||
$sqlite = "SELECT name,sql
|
||||
FROM sqlite_master
|
||||
WHERE type='index'
|
||||
AND sql IS NOT NULL
|
||||
AND LOWER(tbl_name)='%s'";
|
||||
|
||||
$SQL = sprintf($sqlite,
|
||||
strtolower($table)
|
||||
);
|
||||
|
||||
$rs = $this->execute($SQL);
|
||||
// Exclude the empty entry for the primary index
|
||||
$sql = "SELECT name,sql
|
||||
FROM sqlite_master
|
||||
WHERE type='index'
|
||||
AND sql IS NOT NULL
|
||||
AND LOWER(tbl_name)=?";
|
||||
$rs = $this->execute($sql, [$table]);
|
||||
|
||||
if (!is_object($rs)) {
|
||||
if (isset($savem)) {
|
||||
$this->SetFetchMode($savem);
|
||||
}
|
||||
$ADODB_FETCH_MODE = $save;
|
||||
return $false;
|
||||
return false;
|
||||
}
|
||||
|
||||
$indexes = array ();
|
||||
|
||||
while ($row = $rs->FetchRow())
|
||||
{
|
||||
$indexes = array();
|
||||
|
||||
while ($row = $rs->FetchRow()) {
|
||||
if (!isset($indexes[$row[0]])) {
|
||||
$indexes[$row[0]] = array(
|
||||
'unique' => preg_match("/unique/i",$row[1]),
|
||||
'columns' => array()
|
||||
'unique' => preg_match("/unique/i", $row[1]),
|
||||
);
|
||||
}
|
||||
/**
|
||||
* The index elements appear in the SQL statement
|
||||
* in cols[1] between parentheses
|
||||
* e.g CREATE UNIQUE INDEX ware_0 ON warehouse (org,warehouse)
|
||||
*/
|
||||
preg_match_all('/\((.*)\)/',$row[1],$indexExpression);
|
||||
$indexes[$row[0]]['columns'] = array_map('trim',explode(',',$indexExpression[1][0]));
|
||||
// Index elements appear in the SQL statement in cols[1] between parentheses
|
||||
// e.g CREATE UNIQUE INDEX ware_0 ON warehouse (org,warehouse)
|
||||
preg_match_all('/\((.*)\)/', $row[1], $indexExpression);
|
||||
$indexes[$row[0]]['columns'] = array_map('trim', explode(',', $indexExpression[1][0]));
|
||||
}
|
||||
|
||||
// If we want the primary key, we must extract it from the pragma
|
||||
if ($primary){
|
||||
$pragmaData = $this->getAll('PRAGMA table_info(?);', [$table]);
|
||||
$pkIndexData = array('unique'=>1,'columns'=>array());
|
||||
|
||||
$pkCallBack = function ($value, $key) use (&$pkIndexData) {
|
||||
// As we iterate the elements check for pk index
|
||||
if ($value[5] > 0) {
|
||||
$pkIndexData['columns'][$value[5]] = strtolower($value[1]);
|
||||
}
|
||||
};
|
||||
array_walk($pragmaData, $pkCallBack);
|
||||
|
||||
// If we found no columns, there is no primary index
|
||||
if (count($pkIndexData['columns']) > 0) {
|
||||
$indexes['PRIMARY'] = $pkIndexData;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($savem)) {
|
||||
@@ -503,40 +486,6 @@ class ADODB_sqlite3 extends ADOConnection {
|
||||
$ADODB_FETCH_MODE = $save;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we want primary, add it here
|
||||
*/
|
||||
if ($primary){
|
||||
|
||||
/*
|
||||
* Check the previously retrieved pragma to search
|
||||
* with a closure
|
||||
*/
|
||||
|
||||
$pkIndexData = array('unique'=>1,'columns'=>array());
|
||||
|
||||
$pkCallBack = function ($value, $key) use (&$pkIndexData) {
|
||||
|
||||
/*
|
||||
* As we iterate the elements check for pk index and sort
|
||||
*/
|
||||
if ($value[5] > 0)
|
||||
{
|
||||
$pkIndexData['columns'][$value[5]] = strtolower($value[1]);
|
||||
ksort($pkIndexData['columns']);
|
||||
}
|
||||
};
|
||||
|
||||
array_walk($pragmaData,$pkCallBack);
|
||||
|
||||
/*
|
||||
* If we found no columns, there is no
|
||||
* primary index
|
||||
*/
|
||||
if (count($pkIndexData['columns']) > 0)
|
||||
$indexes['PRIMARY'] = $pkIndexData;
|
||||
}
|
||||
|
||||
return $indexes;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,8 +188,8 @@ class ADODB_sybase extends ADOConnection {
|
||||
return $rs;
|
||||
}
|
||||
|
||||
$nrows = (integer) $nrows;
|
||||
$offset = (integer) $offset;
|
||||
$nrows = (int) $nrows;
|
||||
$offset = (int) $offset;
|
||||
|
||||
$cnt = ($nrows >= 0) ? $nrows : 999999999;
|
||||
if ($offset > 0 && $cnt) $cnt += $offset;
|
||||
|
||||
@@ -257,7 +257,7 @@ class ADODB_text extends ADOConnection {
|
||||
preg_match("/$eregword/",$orderby,$arr);
|
||||
if (sizeof($arr) < 2) return $this; // actually invalid sql
|
||||
$col = $arr[1];
|
||||
$at = (integer) $col;
|
||||
$at = (int) $col;
|
||||
if ($at == 0) {
|
||||
$i = 0;
|
||||
reset($projnames);
|
||||
|
||||
@@ -18,5 +18,4 @@ Removed:
|
||||
* session/
|
||||
|
||||
Added:
|
||||
* index.html - prevent directory browsing on misconfigured servers
|
||||
* readme_moodle.txt - this file ;-)
|
||||
|
||||
@@ -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.9</version>
|
||||
<version>5.22.11</version>
|
||||
<license>BSD/LGPL</license>
|
||||
<licenseversion>3-Clause/2.1+</licenseversion>
|
||||
<repository>https://github.com/ADOdb/ADOdb</repository>
|
||||
|
||||
Reference in New Issue
Block a user