Commit 9cdc298b authored by Robert Lyon's avatar Robert Lyon Committed by Cecilia Vela Gurovic
Browse files

Bug 1811034: Upgrade ADODB to 5.20.14



behatnotneeded

Change-Id: I17a2c50f0d6be15a4d00a1917895c3908a60b02c
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit 20f76ffc)
parent b186a4fe
......@@ -15,8 +15,8 @@ For more information about ADOdb, visit http://adodb.org/
BSD 3-Clause License
--------------------
(c) 2000-2013 John Lim (jlim@natsoft.com)
(c) 2014 Damien Regad, Mark Newnham and the ADOdb community
(c) 2000-2013 John Lim (jlim@natsoft.com)
(c) 2014 Damien Regad, Mark Newnham and the ADOdb community
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
......
......@@ -2,7 +2,7 @@ adodb
-----
Website: http://adodb.org/
Version: 5.20.12
Version: 5.20.14
Modifications:
......
......@@ -9,10 +9,10 @@ ADOdb Library for PHP5
[ADOdb community](https://github.com/ADOdb/ADOdb/graphs/contributors)
The ADOdb Library is dual-licensed, released under both the
[BSD 3-Clause](https://github.com/ADOdb/ADOdb/blob/master/LICENSE.md#bsd-3-clause-license)
[BSD 3-Clause](https://github.com/ADOdb/ADOdb/blob/master/LICENSE.md#bsd-3-clause-license)
and the
[GNU Lesser General Public Licence (LGPL) v2.1](https://github.com/ADOdb/ADOdb/blob/master/LICENSE.md#gnu-lesser-general-public-license)
or, at your option, any later version.
or, at your option, any later version.
This means you can use it in proprietary products;
see [License](https://github.com/ADOdb/ADOdb/blob/master/LICENSE.md) for details.
......
<?php
/*
@version v5.20.12 30-Mar-2018
@version v5.20.14 06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Latest version is available at http://adodb.sourceforge.net
Latest version is available at http://adodb.org/
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
......
<?php
/*
@version v5.20.12 30-Mar-2018
@version v5.20.14 06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Latest version is available at http://adodb.sourceforge.net
Latest version is available at http://adodb.org/
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
......
......@@ -8,7 +8,7 @@ $ADODB_INCLUDED_CSV = 1;
/*
@version v5.20.12 30-Mar-2018
@version v5.20.14 06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
......@@ -16,14 +16,10 @@ $ADODB_INCLUDED_CSV = 1;
the BSD license will take precedence. See License.txt.
Set tabs to 4 for best viewing.
Latest version is available at http://adodb.sourceforge.net
Latest version is available at http://adodb.org/
Library for CSV serialization. This is used by the csv/proxy driver and is the
CacheExecute() serialization format.
==== NOTE ====
Format documented at http://php.weblogs.com/ADODB_CSV
==============
*/
/**
......
<?php
/**
@version v5.20.12 30-Mar-2018
@version v5.20.14 06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
......
<?php
/**
* @version v5.20.12 30-Mar-2018
* @version v5.20.14 06-Jan-2019
* @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
* @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
* Released under both BSD license and Lesser GPL library license.
......
<?php
/**
* @version v5.20.12 30-Mar-2018
* @version v5.20.14 06-Jan-2019
* @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
* @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
* Released under both BSD license and Lesser GPL library license.
......@@ -9,7 +9,7 @@
*
* Set tabs to 4 for best viewing.
*
* Latest version is available at http://php.weblogs.com
* Latest version is available at http://adodb.org/
*
*/
......
<?php
/**
* @version v5.20.12 30-Mar-2018
* @version v5.20.14 06-Jan-2019
* @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
* @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
* Released under both BSD license and Lesser GPL library license.
......@@ -9,7 +9,7 @@
*
* Set tabs to 4 for best viewing.
*
* Latest version is available at http://php.weblogs.com
* Latest version is available at http://adodb.org/
*
*/
include_once('PEAR.php');
......
<?php
/**
* @version v5.20.12 30-Mar-2018
* @version v5.20.14 06-Jan-2019
* @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
* @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
* Released under both BSD license and Lesser GPL library license.
......@@ -10,7 +10,7 @@
*
* Set tabs to 4 for best viewing.
*
* Latest version is available at http://php.weblogs.com
* Latest version is available at http://adodb.org/
*
* Exception-handling code using PHP5 exceptions (try-catch-throw).
*/
......
<?php
/*
@version v5.20.12 30-Mar-2018
@version v5.20.14 06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
......
......@@ -6,7 +6,7 @@ global $ADODB_INCLUDED_LIB;
$ADODB_INCLUDED_LIB = 1;
/*
@version v5.20.12 30-Mar-2018
@version v5.20.14 06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
......@@ -218,6 +218,13 @@ function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=f
{
$hasvalue = false;
if (is_array($name))
{
/*
* Reserved for future use
*/
}
if ($multiple or is_array($defstr)) {
if ($size==0) $size=5;
$attr = ' multiple size="'.$size.'"';
......@@ -227,12 +234,15 @@ function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=f
$s = '<select name="'.$name.'"'.$attr.' '.$selectAttr.'>';
if ($blank1stItem)
{
if (is_string($blank1stItem)) {
$barr = explode(':',$blank1stItem);
if (sizeof($barr) == 1) $barr[] = '';
$s .= "\n<option value=\"".$barr[0]."\">".$barr[1]."</option>";
} else $s .= "\n<option></option>";
}
else
$s .= "\n<option></option>";
}
if ($zthis->FieldCount() > 1) $hasvalue=true;
else $compareFields0 = true;
......@@ -248,34 +258,21 @@ function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=f
continue;
}
if ($fieldsize > 1) {
if (isset($zthis->fields[1]))
$zval2 = rtrim($zthis->fields[1]);
$myFields = array_map('trim',array_values($zthis->fields));
if ($fieldsize > 1) {
if (isset($myFields[1]))
$zval2 = $myFields[1];
else
$zval2 = rtrim(next($zthis->fields));
$zval2 = next($myFields);
}
$selected = ($compareFields0) ? $zval : $zval2;
$group = '';
if ($fieldsize > 2) {
$group = rtrim($zthis->fields[2]);
}
/*
if ($optgroup != $group) {
$optgroup = $group;
if ($firstgroup) {
$firstgroup = false;
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
} else {
$s .="\n</optgroup>";
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
}
}
*/
if ($hasvalue)
$value = " value='".htmlspecialchars($zval2)."'";
if (is_array($defstr)) {
if (is_array($defstr))
{
if (in_array($selected,$defstr))
$s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
......@@ -291,10 +288,6 @@ function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=f
$zthis->MoveNext();
} // while
// closing last optgroup
if($optgroup != null) {
$s .= "\n</optgroup>";
}
return $s ."\n</select>\n";
}
......@@ -304,6 +297,13 @@ function _adodb_getmenu_gp(&$zthis, $name,$defstr='',$blank1stItem=true,$multipl
{
$hasvalue = false;
if (is_array($name))
{
/*
* Reserved for future use
*/
}
if ($multiple or is_array($defstr)) {
if ($size==0) $size=5;
$attr = ' multiple size="'.$size.'"';
......@@ -323,9 +323,9 @@ function _adodb_getmenu_gp(&$zthis, $name,$defstr='',$blank1stItem=true,$multipl
else $compareFields0 = true;
$value = '';
$optgroup = null;
$firstgroup = true;
$fieldsize = sizeof($zthis->fields);
$optgroup = null;
$firstgroup = true;
$fieldsize = sizeof($zthis->fields);
while(!$zthis->EOF) {
$zval = rtrim(reset($zthis->fields));
......@@ -334,28 +334,32 @@ function _adodb_getmenu_gp(&$zthis, $name,$defstr='',$blank1stItem=true,$multipl
continue;
}
if ($fieldsize > 1) {
if (isset($zthis->fields[1]))
$zval2 = rtrim($zthis->fields[1]);
$myFields = array_map('trim',array_values($zthis->fields));
if ($fieldsize > 1) {
if (isset($myFields[1]))
$zval2 = $myFields[1];
else
$zval2 = rtrim(next($zthis->fields));
$zval2 = next($myFields);
}
$selected = ($compareFields0) ? $zval : $zval2;
$group = '';
if (isset($zthis->fields[2])) {
$group = rtrim($zthis->fields[2]);
}
$group = '';
if (isset($myFields[2])) {
$group = $myFields[2];
}
if ($optgroup != $group) {
$optgroup = $group;
if ($firstgroup) {
$firstgroup = false;
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
} else {
$s .="\n</optgroup>";
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
}
if ($optgroup != $group) {
$optgroup = $group;
if ($firstgroup) {
$firstgroup = false;
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
} else {
$s .="\n</optgroup>";
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
}
}
if ($hasvalue)
......@@ -377,14 +381,13 @@ function _adodb_getmenu_gp(&$zthis, $name,$defstr='',$blank1stItem=true,$multipl
$zthis->MoveNext();
} // while
// closing last optgroup
if($optgroup != null) {
$s .= "\n</optgroup>";
// closing last optgroup
if($optgroup != null) {
$s .= "\n</optgroup>";
}
return $s ."\n</select>\n";
}
/*
Count the number of records this sql statement will return by using
query rewriting heuristics...
......@@ -418,8 +421,10 @@ function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
} else if (strncmp($zthis->databaseType,'postgres',8) == 0
|| strncmp($zthis->databaseType,'mysql',5) == 0
|| strncmp($zthis->databaseType,'mssql',5) == 0
) {
|| strncmp($zthis->databaseType,'mssql',5) == 0
|| strncmp($zthis->dsnType,'sqlsrv',5) == 0
|| strncmp($zthis->dsnType,'mssql',5) == 0
){
$rewritesql = "SELECT COUNT(*) FROM ($rewritesql) _ADODB_ALIAS_";
} else {
$rewritesql = "SELECT COUNT(*) FROM ($rewritesql)";
......@@ -769,7 +774,7 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
if (preg_match('/\s(ORDER\s.*)/is', $whereClause[1], $discard));
else if (preg_match('/\s(LIMIT\s.*)/is', $whereClause[1], $discard));
else if (preg_match('/\s(FOR UPDATE.*)/is', $whereClause[1], $discard));
else preg_match('/\s.*(\) WHERE .*)/is', $whereClause[1], $discard); # see http://sourceforge.net/tracker/index.php?func=detail&aid=1379638&group_id=42718&atid=433976
else preg_match('/\s.*(\) WHERE .*)/is', $whereClause[1], $discard); # see https://sourceforge.net/p/adodb/bugs/37/
} else
$whereClause = array(false,false);
......
......@@ -11,7 +11,7 @@ if (empty($ADODB_INCLUDED_CSV)) include_once(ADODB_DIR.'/adodb-csvlib.inc.php');
/*
@version v5.20.12 30-Mar-2018
@version v5.20.14 06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
......@@ -19,7 +19,7 @@ if (empty($ADODB_INCLUDED_CSV)) include_once(ADODB_DIR.'/adodb-csvlib.inc.php');
the BSD license will take precedence. See License.txt.
Set tabs to 4 for best viewing.
Latest version is available at http://adodb.sourceforge.net
Latest version is available at http://adodb.org/
Usage:
......
<?php
/*
@version v5.20.12 30-Mar-2018
@version v5.20.14 06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
......
<?php
/**
* @version v5.20.12 30-Mar-2018
* @version v5.20.14 06-Jan-2019
* @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
* @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
* Released under both BSD license and Lesser GPL library license.
......
<?php
/*
@version v5.20.12 30-Mar-2018
@version v5.20.14 06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
......
<?php
/*
ADOdb Date Library, part of the ADOdb abstraction library
Download: http://adodb.sourceforge.net/#download
@version v5.20.12 30-Mar-2018
Latest version is available at http://adodb.org/
@version v5.20.14 06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
......@@ -420,6 +421,9 @@ $ADODB_DATETIME_CLASS = (PHP_VERSION >= 5.2);
if (!defined('ADODB_ALLOW_NEGATIVE_TS')) define('ADODB_NO_NEGATIVE_TS',1);
if (!DEFINED('ADODB_FUTURE_DATE_CUTOFF_YEARS'))
DEFINE('ADODB_FUTURE_DATE_CUTOFF_YEARS',200);
function adodb_date_test_date($y1,$m,$d=13)
{
$h = round(rand()% 24);
......@@ -829,13 +833,23 @@ global $_month_table_normal,$_month_table_leaf;
function _adodb_getdate($origd=false,$fast=false,$is_gmt=false)
{
static $YRS;
global $_month_table_normal,$_month_table_leaf;
global $_month_table_normal,$_month_table_leaf, $_adodb_last_date_call_failed;
$_adodb_last_date_call_failed = false;
$d = $origd - ($is_gmt ? 0 : adodb_get_gmt_diff_ts($origd));
$_day_power = 86400;
$_hour_power = 3600;
$_min_power = 60;
$cutoffDate = time() + (60 * 60 * 24 * 365 * ADODB_FUTURE_DATE_CUTOFF_YEARS);
if ($d > $cutoffDate)
{
$d = $cutoffDate;
$_adodb_last_date_call_failed = true;
}
if ($d < -12219321600) $d -= 86400*10; // if 15 Oct 1582 or earlier, gregorian correction
$_month_table_normal = array("",31,28,31,30,31,30,31,31,30,31,30,31);
......@@ -1460,3 +1474,16 @@ global $ADODB_DATE_LOCALE;
$ret = adodb_date($fmtdate, $ts, $is_gmt);
return $ret;
}
/**
* Returns the status of the last date calculation and whether it exceeds
* the limit of ADODB_FUTURE_DATE_CUTOFF_YEARS
*
* @return boolean
*/
function adodb_last_date_status()
{
global $_adodb_last_date_call_failed;
return $_adodb_last_date_call_failed;
}
......@@ -2,7 +2,7 @@
/*
* Set tabs to 4 for best viewing.
*
* Latest version is available at http://adodb.sourceforge.net
* Latest version is available at http://adodb.org/
*
* This is the main include file for ADOdb.
* Database specific drivers are stored in the adodb/drivers/adodb-*.inc.php
......@@ -14,7 +14,7 @@
/**
\mainpage
@version v5.20.12 30-Mar-2018
@version v5.20.14 06-Jan-2019
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
......@@ -29,9 +29,6 @@
Informix, PostgreSQL, FrontBase, Interbase (Firebird and Borland variants), Foxpro, Access,
ADO, SAP DB, SQLite and ODBC. We have had successful reports of connecting to Progress and
other databases via ODBC.
Latest Download at http://adodb.sourceforge.net/
*/
if (!defined('_ADODB_LAYER')) {
......@@ -117,9 +114,9 @@ if (!defined('_ADODB_LAYER')) {
* NOTE: This functionality is not implemented everywhere, it currently
* works only with: mssql, odbc, oci8 and ibase derived drivers
*/
define('ADODB_ASSOC_CASE_LOWER', 0);
define('ADODB_ASSOC_CASE_UPPER', 1);
define('ADODB_ASSOC_CASE_NATIVE', 2);
define('ADODB_ASSOC_CASE_LOWER', 0);
define('ADODB_ASSOC_CASE_UPPER', 1);
define('ADODB_ASSOC_CASE_NATIVE', 2);
if (!$ADODB_EXTENSION || ADODB_EXTENSION < 4.0) {
......@@ -231,7 +228,7 @@ if (!defined('_ADODB_LAYER')) {
/**
* ADODB version as a string.
*/
$ADODB_vers = 'v5.20.12 30-Mar-2018';
$ADODB_vers = 'v5.20.14 06-Jan-2019';
/**
* Determines whether recordset->RecordCount() is used.
......@@ -430,8 +427,9 @@ if (!defined('_ADODB_LAYER')) {
var $databaseType = ''; /// RDBMS currently in use, eg. odbc, mysql, mssql
var $database = ''; /// Name of database to be used.
var $host = ''; /// The hostname of the database server
var $port = ''; /// The port of the database server
var $user = ''; /// The username which is used to connect to the database server.
private $password = ''; /// Password for the username. This is required for __wakeup
private $password = ''; /// Password for the username. This is required for __wakeup
var $debug = false; /// if set to true will output sql statements
var $maxblobsize = 262144; /// maximum size of blobs or large text fields (262144 = 256K)-- some db's die otherwise like foxpro
var $concat_operator = '+'; /// default concat operator -- change to || for Oracle/Interbase
......@@ -631,6 +629,26 @@ if (!defined('_ADODB_LAYER')) {
return false;
}
/**
* Parses the hostname to extract the port.
* Overwrites $this->host and $this->port, only if a port is specified.
* The Hostname can be fully or partially qualified,
* ie: "db.mydomain.com:5432" or "ldaps://ldap.mydomain.com:636"
* Any specified scheme such as ldap:// or ldaps:// is maintained.
*/
protected function parseHostNameAndPort() {
$parsed_url = parse_url($this->host);
if (is_array($parsed_url) && isset($parsed_url['host']) && isset($parsed_url['port'])) {
if ( isset($parsed_url['scheme']) ) {
// If scheme is specified (ie: ldap:// or ldaps://, make sure we retain that.
$this->host = $parsed_url['scheme'] . "://" . $parsed_url['host'];
} else {
$this->host = $parsed_url['host'];
}
$this->port = $parsed_url['port'];
}
}
/**
* Connect to database
*
......@@ -646,9 +664,9 @@ if (!defined('_ADODB_LAYER')) {
if ($argHostname != "") {
$this->host = $argHostname;
}
if ( strpos($this->host, ':') > 0 && isset($this->port) ) {
list($this->host, $this->port) = explode(":", $this->host, 2);
}
// Overwrites $this->host and $this->port if a port is specified.
$this->parseHostNameAndPort();
if ($argUsername != "") {
$this->user = $argUsername;
}
......@@ -729,9 +747,9 @@ if (!defined('_ADODB_LAYER')) {
if ($argHostname != "") {
$this->host = $argHostname;
}
if ( strpos($this->host, ':') > 0 && isset($this->port) ) {
list($this->host, $this->port) = explode(":", $this->host, 2);
}
// Overwrites $this->host and $this->port if a port is specified.
$this->parseHostNameAndPort();
if ($argUsername != "") {
$this->user = $argUsername;
}
......@@ -3092,13 +3110,13 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1
if ($changed === true) {
return $new['message'];
}
return '';
return '';
}
function __wakeup() {
$this->Connect($this->host, $this->user, $this->password, $this->database, true);
}
function __wakeup() {