diff options
Diffstat (limited to 'drivers')
62 files changed, 1738 insertions, 1515 deletions
diff --git a/drivers/adodb-access.inc.php b/drivers/adodb-access.inc.php index 13461a35..51f3247a 100644 --- a/drivers/adodb-access.inc.php +++ b/drivers/adodb-access.inc.php @@ -1,26 +1,17 @@ <?php -/** - * Microsoft Access driver. - * - * Requires ODBC. Works only on Microsoft Windows. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. See License.txt. + Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + Microsoft Access data driver. Requires ODBC. Works only on Microsoft Windows. +*/ if (!defined('_ADODB_ODBC_LAYER')) { if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-ado.inc.php b/drivers/adodb-ado.inc.php index 67a032d7..6b343d89 100644 --- a/drivers/adodb-ado.inc.php +++ b/drivers/adodb-ado.inc.php @@ -1,25 +1,17 @@ <?php -/** - * Microsoft ADO driver. - * - * Requires ADO. Works only on MS Windows. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Microsoft ADO data driver. Requires ADO. Works only on MS Windows. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -504,6 +496,9 @@ 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]; if (!is_numeric($t)) return $t; diff --git a/drivers/adodb-ado5.inc.php b/drivers/adodb-ado5.inc.php index f673d092..c7266a90 100644 --- a/drivers/adodb-ado5.inc.php +++ b/drivers/adodb-ado5.inc.php @@ -1,25 +1,17 @@ <?php -/** - * Microsoft ADO driver (PHP5 compat version). - * - * Requires ADO. Works only on MS Windows. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Microsoft ADO data driver. Requires ADO. Works only on MS Windows. PHP5 compat version. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -545,8 +537,14 @@ 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)) return $t; + if (!is_numeric($t)) + return $t; switch ($t) { case 0: diff --git a/drivers/adodb-ado_access.inc.php b/drivers/adodb-ado_access.inc.php index ad7ab38c..0a7cd272 100644 --- a/drivers/adodb-ado_access.inc.php +++ b/drivers/adodb-ado_access.inc.php @@ -1,25 +1,17 @@ <?php -/** - * Microsoft Access ADO driver. - * - * Requires ADO and ODBC. Works only on MS Windows. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. +Whenever there is any discrepancy between the two licenses, +the BSD license will take precedence. See License.txt. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Microsoft Access ADO data driver. Requires ADO and ODBC. Works only on MS Windows. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-ado_mssql.inc.php b/drivers/adodb-ado_mssql.inc.php index d0e9c196..ba8e1a61 100644 --- a/drivers/adodb-ado_mssql.inc.php +++ b/drivers/adodb-ado_mssql.inc.php @@ -1,25 +1,21 @@ <?php -/** - * Microsoft SQL Server ADO driver. - * - * Requires ADO and MSSQL client. Works only on MS Windows. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Microsoft SQL Server ADO data driver. Requires ADO and MSSQL client. + Works only on MS Windows. + + Warning: Some versions of PHP (esp PHP4) leak memory when ADO/COM is used. + Please check http://bugs.php.net/ for more info. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-ads.inc.php b/drivers/adodb-ads.inc.php index b9d4adb5..c87f5e25 100644 --- a/drivers/adodb-ads.inc.php +++ b/drivers/adodb-ads.inc.php @@ -1,29 +1,20 @@ <?php -/** - * ADOdb driver for ADS. - * - * NOTE: This driver requires the Advantage PHP client libraries, which - * can be downloaded for free via: - * @link http://devzone.advantagedatabase.com/dz/content.aspx?key=20 - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ - /* + (c) 2000-2014 John Lim (jlim#natsoft.com.my). All rights reserved. + Portions Copyright (c) 2007-2009, iAnywhere Solutions, Inc. + All rights reserved. All unpublished rights reserved. + + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + +Set tabs to 4 for best viewing. + + +NOTE: This driver requires the Advantage PHP client libraries, which + can be downloaded for free via: + http://devzone.advantagedatabase.com/dz/content.aspx?key=20 + DELPHI FOR PHP USERS: The following steps can be taken to utilize this driver from the CodeGear Delphi for PHP product: @@ -44,7 +35,6 @@ DELPHI FOR PHP USERS: Database object's DriverName property. */ - // security - hide paths if (!defined('ADODB_DIR')) { die(); diff --git a/drivers/adodb-borland_ibase.inc.php b/drivers/adodb-borland_ibase.inc.php index da2c7618..a6abe839 100644 --- a/drivers/adodb-borland_ibase.inc.php +++ b/drivers/adodb-borland_ibase.inc.php @@ -1,25 +1,18 @@ <?php -/** - * Borland Interbase driver. - * - * Support Borland Interbase 6.5 and later - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Support Borland Interbase 6.5 and later + +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-csv.inc.php b/drivers/adodb-csv.inc.php index 8a59626e..4c0e3d6e 100644 --- a/drivers/adodb-csv.inc.php +++ b/drivers/adodb-csv.inc.php @@ -1,30 +1,21 @@ <?php -/** - * FileDescription - * - * Currently unsupported: MetaDatabases, MetaTables and MetaColumns, - * and also inputarr in Execute. - * Native types have been converted to MetaTypes. - * Transactions not supported yet. - * - * Limitation of url length. For IIS, see MaxClientRequestBuffer registry value. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 4. + + Currently unsupported: MetaDatabases, MetaTables and MetaColumns, and also inputarr in Execute. + Native types have been converted to MetaTypes. + Transactions not supported yet. + + Limitation of url length. For IIS, see MaxClientRequestBuffer registry value. + + http://support.microsoft.com/default.aspx?scid=kb;en-us;260694 +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-db2.inc.php b/drivers/adodb-db2.inc.php index 8f616fa6..4b63ef10 100644 --- a/drivers/adodb-db2.inc.php +++ b/drivers/adodb-db2.inc.php @@ -1,40 +1,36 @@ <?php /** - * IBM DB2 Native Client driver. - * - * Originally DB2 drivers were dependent on an ODBC driver, and some installations - * may still use that. To use an ODBC driver connection, use the odbc_db2 - * ADOdb driver. For Linux, you need the 'ibm_db2' PECL extension for PHP, - * For Windows, you need to locate an appropriate version of the php_ibm_db2.dll, - * as well as the IBM data server client software. - * This is basically a full rewrite of the original driver, for information - * about all the changes, see the update information on the ADOdb website - * for version 5.21.0. - * - * @link http://pecl.php.net/package/ibm_db2 PECL Extension For DB2 - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author Mark Newnham - */ + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +* Driver for use with IBM DB2 Native Client +* +* Originally DB2 drivers were dependent on an ODBC driver, and some installations +* may still use that. To use an ODBC driver connection, use the odbc_db2 +* ADOdb driver. For Linux, you need the 'ibm_db2' PECL extension for PHP, +* For Windows, you need to locate an appropriate version of the php_ibm_db2.dll, +* as well as the IBM data server client software. +* This is basically a full rewrite of the original driver, for information +* about all the changes, see the update information on the ADOdb website +* for version 5.21.0 +* +* @link http://pecl.php.net/package/ibm_db2 Pecl Extension For DB2 +* @author Mark Newnham +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); -define("_ADODB_DB2_LAYER", 2 ); + define("_ADODB_DB2_LAYER", 2 ); + +/*-------------------------------------------------------------------- +----------------------------------------------------------------------*/ class ADODB_db2 extends ADOConnection { diff --git a/drivers/adodb-db2oci.inc.php b/drivers/adodb-db2oci.inc.php index eea63d94..392fdce9 100644 --- a/drivers/adodb-db2oci.inc.php +++ b/drivers/adodb-db2oci.inc.php @@ -1,27 +1,17 @@ <?php -/** - * IBM DB2 / Oracle compatibility driver. - * - * This driver re-maps ibm :0 bind variables to oracle compatible ? variables. - * - * @deprecated - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Microsoft Visual FoxPro data driver. Requires ODBC. Works only on MS Windows. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-db2ora.inc.php b/drivers/adodb-db2ora.inc.php index d343a8ae..bbbafd74 100644 --- a/drivers/adodb-db2ora.inc.php +++ b/drivers/adodb-db2ora.inc.php @@ -1,28 +1,17 @@ <?php -/** - * IBM DB2 / Oracle compatibility driver. - * - * This driver provides undocumented bind variable mapping from ibm to oracle. - * The functionality appears to overlap the db2_oci driver. - * - * @deprecated - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Microsoft Visual FoxPro data driver. Requires ODBC. Works only on MS Windows. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-fbsql.inc.php b/drivers/adodb-fbsql.inc.php index 0fb895a1..a60a0295 100644 --- a/drivers/adodb-fbsql.inc.php +++ b/drivers/adodb-fbsql.inc.php @@ -1,24 +1,14 @@ <?php -/** - * Frontbase driver. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author Frank M. Kromann <frank@frontbase.com> - */ +/* + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Contribution by Frank M. Kromann <frank@frontbase.com>. + Set tabs to 8. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -232,7 +222,19 @@ class ADORecordSet_fbsql 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]; + $len = -1; // fbsql max_length is not accurate + + switch ($t) { + + + + switch (strtoupper($t)) { case 'CHARACTER': case 'CHARACTER VARYING': diff --git a/drivers/adodb-firebird.inc.php b/drivers/adodb-firebird.inc.php index 2fafbe4f..a164c71f 100644 --- a/drivers/adodb-firebird.inc.php +++ b/drivers/adodb-firebird.inc.php @@ -1,25 +1,18 @@ <?php -/** - * Firebird driver. - * - * Requires firebird client. Works on Windows and Unix. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + firebird data driver. Requires firebird client. Works on Windows and Unix. + +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -206,7 +199,7 @@ class ADODB_firebird extends ADOConnection { return $ret; } - function &MetaIndexes ($table, $primary = FALSE, $owner=false) + function metaIndexes ($table, $primary = FALSE, $owner=false) { // save old fetch mode global $ADODB_FETCH_MODE; @@ -233,10 +226,9 @@ class ADODB_firebird extends ADOConnection { $ADODB_FETCH_MODE = $save; return $false; } - $indexes = array(); while ($row = $rs->FetchRow()) { - $index = $row[0]; + $index = trim(preg_replace("/[\n\r]+/",'',$row[0])); if (!isset($indexes[$index])) { if (is_null($row[3])) { $row[3] = 0; @@ -836,10 +828,11 @@ class ADORecordset_firebird extends ADORecordSet global $ADODB_ANSI_PADDING_OFF; //$ADODB_ANSI_PADDING_OFF=1; $rtrim = !empty($ADODB_ANSI_PADDING_OFF); - + for ($i=0, $max = $this->_numOfFields; $i < $max; $i++) { if ($this->_cacheType[$i]=="BLOB") { - if (isset($f[$i])) { + if (isset($f[$i])) + { $f[$i] = $this->connection->_BlobDecode($f[$i]); } else { $f[$i] = null; @@ -892,7 +885,14 @@ class ADORecordset_firebird extends ADORecordSet $t = $fieldobj->type; $len = $fieldobj->max_length; } - switch (strtoupper($t)) { + + $t = strtoupper($t); + + if (array_key_exists($t,$this->connection->customActualTypes)) + return $this->connection->customActualTypes[$t]; + + switch ($t) { + case 'CHAR': return 'C'; diff --git a/drivers/adodb-ibase.inc.php b/drivers/adodb-ibase.inc.php index 69de30dc..a3d08f45 100644 --- a/drivers/adodb-ibase.inc.php +++ b/drivers/adodb-ibase.inc.php @@ -1,25 +1,29 @@ <?php -/** - * Interbase driver. - * - * Requires interbase client. Works on Windows and Unix. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Latest version is available at https://adodb.org/ + + Interbase data driver. Requires interbase client. Works on Windows and Unix. + + 3 Jan 2002 -- suggestions by Hans-Peter Oeri <kampfcaspar75@oeri.ch> + changed transaction handling and added experimental blob stuff + + Docs to interbase at the website + http://www.synectics.co.za/php3/tutorial/IB_PHP3_API.html + + To use gen_id(), see + http://www.volny.cz/iprenosil/interbase/ip_ib_code.htm#_code_creategen + + $rs = $conn->Execute('select gen_id(adodb,1) from rdb$database'); + $id = $rs->fields[0]; + $conn->Execute("insert into table (id, col1,...) values ($id, $val1,...)"); +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -860,7 +864,14 @@ class ADORecordset_ibase extends ADORecordSet $t = $fieldobj->type; $len = $fieldobj->max_length; } - switch (strtoupper($t)) { + + $t = strtoupper($t); + + if (array_key_exists($t,$this->connection->customActualTypes)) + return $this->connection->customActualTypes[$t]; + + switch ($t) { + case 'CHAR': return 'C'; diff --git a/drivers/adodb-informix.inc.php b/drivers/adodb-informix.inc.php index 8e99137c..eb6e73ec 100644 --- a/drivers/adodb-informix.inc.php +++ b/drivers/adodb-informix.inc.php @@ -1,27 +1,19 @@ <?php /** - * Informix 9 driver. - * - * Supports SELECT FIRST. - * - * @deprecated - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +* @version v5.22.0-dev Unreleased +* @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. +* Whenever there is any discrepancy between the two licenses, +* the BSD license will take precedence. +* +* Set tabs to 4 for best viewing. +* +* Latest version is available at https://adodb.org/ +* +* Informix 9 driver that supports SELECT FIRST +* +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-informix72.inc.php b/drivers/adodb-informix72.inc.php index a9c43e23..4be09d37 100644 --- a/drivers/adodb-informix72.inc.php +++ b/drivers/adodb-informix72.inc.php @@ -1,27 +1,20 @@ <?php -/** - * Informix driver. - * - * @deprecated - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author Mitchell T. Young <mitch@youngfamily.org> - * @author Samuel Carriere <samuel_carriere@hotmail.com> - */ +/* +@version v5.22.0-dev Unreleased +@copyright (c) 2000-2013 John Lim. All rights reserved. +@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Informix port by Mitchell T. Young (mitch@youngfamily.org) + + Further mods by "Samuel CARRIERE" <samuel_carriere@hotmail.com> + +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-ldap.inc.php b/drivers/adodb-ldap.inc.php index 323b3585..8374c076 100644 --- a/drivers/adodb-ldap.inc.php +++ b/drivers/adodb-ldap.inc.php @@ -1,26 +1,20 @@ <?php -/** - * LDAP driver. - * - * Provides a subset of ADOdb commands, allowing read-only access to an LDAP database. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author Joshua Eldridge <joshuae74@hotmail.com> - */ +/* + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 8. + + Revision 1: (02/25/2005) Updated codebase to include the _inject_bind_options function. This allows + users to access the options in the ldap_set_option function appropriately. Most importantly + LDAP Version 3 is now supported. See the examples for more information. Also fixed some minor + bugs that surfaced when PHP error levels were set high. + + Joshua Eldridge (joshuae74#hotmail.com) +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-mssql.inc.php b/drivers/adodb-mssql.inc.php index 3de3f8d3..784177b6 100644 --- a/drivers/adodb-mssql.inc.php +++ b/drivers/adodb-mssql.inc.php @@ -1,25 +1,21 @@ <?php -/** - * Native MSSQL driver. - * - * Requires mssql client. Works on Windows. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Native mssql driver. Requires mssql client. Works on Windows. + To configure for Unix, see + http://phpbuilder.com/columns/alberto20000919.php3 + +*/ + // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-mssql_n.inc.php b/drivers/adodb-mssql_n.inc.php index 236c1546..b8c650f1 100644 --- a/drivers/adodb-mssql_n.inc.php +++ b/drivers/adodb-mssql_n.inc.php @@ -1,27 +1,47 @@ <?php + +/// $Id $ + +/////////////////////////////////////////////////////////////////////////// +// // +// NOTICE OF COPYRIGHT // +// // +// ADOdb - Database Abstraction Library for PHP // +// // +// Latest version is available at https://adodb.org // +// // +// Copyright (c) 2000-2014 John Lim (jlim\@natsoft.com.my) // +// All rights reserved. // +// Released under both BSD license and LGPL library license. // +// Whenever there is any discrepancy between the two licenses, // +// the BSD license will take precedence // +// // +// Moodle - Modular Object-Oriented Dynamic Learning Environment // +// http://moodle.com // +// // +// Copyright (C) 2001-3001 Martin Dougiamas http://dougiamas.com // +// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details: // +// // +// http://www.gnu.org/copyleft/gpl.html // +// // +/////////////////////////////////////////////////////////////////////////// + /** - * MSSQL Driver with auto-prepended "N" for correct unicode storage of SQL literal strings. - * - * Intended to be used with MSSQL drivers that are sending UCS-2 data to MSSQL - * (FreeTDS and ODBTP) in order to get true cross-db compatibility from the - * application point of view. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +* MSSQL Driver with auto-prepended "N" for correct unicode storage +* of SQL literal strings. Intended to be used with MSSQL drivers that +* are sending UCS-2 data to MSSQL (FreeTDS and ODBTP) in order to get +* true cross-db compatibility from the application point of view. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -40,7 +60,7 @@ class ADODB_mssql_n extends ADODB_mssql { return ADODB_mssql::_query($sql,$inputarr); } - /** + /** * This function will intercept all the literals used in the SQL, prepending the "N" char to them * in order to allow mssql to store properly data sent in the correct UCS-2 encoding (by freeTDS * and ODBTP) keeping SQL compatibility at ADOdb level (instead of hacking every project to add diff --git a/drivers/adodb-mssqlnative.inc.php b/drivers/adodb-mssqlnative.inc.php index 36dc5433..2943743e 100644 --- a/drivers/adodb-mssqlnative.inc.php +++ b/drivers/adodb-mssqlnative.inc.php @@ -1,26 +1,24 @@ <?php -/** - * Native MSSQL driver. - * - * Requires mssql client. Works on Windows. - * https://docs.microsoft.com/sql/connect/php - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Native mssql driver. Requires mssql client. Works on Windows. + http://www.microsoft.com/sql/technologies/php/default.mspx + To configure for Unix, see + http://phpbuilder.com/columns/alberto20000919.php3 + + $stream = sqlsrv_get_field($stmt, $index, SQLSRV_SQLTYPE_STREAM(SQLSRV_ENC_BINARY)); + stream_filter_append($stream, "convert.iconv.ucs-2/utf-8"); // Voila, UTF-8 can be read directly from $stream + +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -298,25 +296,22 @@ class ADODB_mssqlnative extends ADOConnection { // Format date column in sql string given an input format that understands Y M D function SQLDate($fmt, $col=false) { - if (!$col) { - $col = $this->sysTimeStamp; - } + if (!$col) $col = $this->sysTimeStamp; $s = ''; $ConvertableFmt=array( - "m/d/Y"=>101, "m/d/y"=>101 // US - ,"Y.m.d"=>102, "y.m.d"=>102 // ANSI - ,"d/m/Y"=>103, "d/m/y"=>103 // French /english - ,"d.m.Y"=>104, "d.m.y"=>104 // German - ,"d-m-Y"=>105, "d-m-y"=>105 // Italian - ,"m-d-Y"=>110, "m-d-y"=>110 // US Dash - ,"Y/m/d"=>111, "y/m/d"=>111 // Japan - ,"Ymd"=>112, "ymd"=>112 // ISO - ,"H:i:s"=>108 // Time + "m/d/Y"=>101,"m/d/y"=>101 // US + ,"Y.m.d"=>102,"y/m/d"=>102 // ANSI + ,"d/m/Y"=>103,"d/m/y"=>103 // French /english + ,"d.m.Y"=>104,"d.m.y"=>104 // German + ,"d-m-Y"=>105,"d-m-y"=>105 // Italian + ,"m-d-Y"=>110,"m-d-y"=>110 // US Dash + ,"Y/m/d"=>111,"y/m/d"=>111 // Japan + ,"Ymd"=>112,"ymd"=>112 // ISO + ,"H:i:s"=>108 // Time ); - if (key_exists($fmt,$ConvertableFmt)) { - return "convert (varchar ,$col," . $ConvertableFmt[$fmt] . ")"; - } + if(key_exists($fmt,$ConvertableFmt)) + return "convert (varchar ,$col,".$ConvertableFmt[$fmt].")"; $len = strlen($fmt); for ($i=0; $i < $len; $i++) { @@ -766,7 +761,7 @@ class ADODB_mssqlnative extends ADOConnection { function MetaDatabases() { $this->SelectDB("master"); - $rs = $this->Execute($this->metaDatabasesSQL); + $rs =& $this->Execute($this->metaDatabasesSQL); $rows = $rs->GetRows(); $ret = array(); for($i=0;$i<count($rows);$i++) { @@ -1008,6 +1003,37 @@ class ADODB_mssqlnative extends ADOConnection { return $metaProcedures; } + + /** + * An SQL Statement that adds a specific number of + * days or part to local datetime + * + * @param float $dayFraction + * @param string $date + * + * @return string + */ + public function offsetDate($dayFraction, $date = false) + { + if (!$date) + /* + * Use GETDATE() via systTimestamp; + */ + $date = $this->sysTimeStamp; + + /* + * seconds, number of seconds, date base + */ + $dateFormat = "DATEADD(s, %s, %s)"; + + /* + * Adjust the offset back to seconds + */ + $fraction = $dayFraction * 24 * 3600; + + return sprintf($dateFormat,$fraction,$date); + + } } @@ -1022,8 +1048,13 @@ class ADORecordset_mssqlnative extends ADORecordSet { var $fieldOffset = 0; // _mths works only in non-localised system - /** - * @var bool True if we have retrieved the fields metadata + /* + * Holds a cached version of the metadata + */ + private $fieldObjects = false; + + /* + * Flags if we have retrieved the metadata */ private $fieldObjectsRetrieved = false; @@ -1032,6 +1063,7 @@ class ADORecordset_mssqlnative extends ADORecordSet { */ private $fieldObjectsIndex = array(); + /* * Cross references the dateTime objects for faster decoding */ @@ -1142,56 +1174,48 @@ class ADORecordset_mssqlnative extends ADORecordSet { * the next field that wasn't yet retrieved by fetchField() * is retrieved. * - * @param int $fieldOffset (optional default=-1 for all - * @return mixed an ADOFieldObject, or array of objects + * $param int $fieldOffset (optional default=-1 for all + * @return ADOFieldObject|ADOFieldObject[]|false */ private function _fetchField($fieldOffset = -1) { - if ($this->fieldObjectsRetrieved) { - if ($this->fieldObjectsCache) { - // Already got the information - if ($fieldOffset == -1) { - return $this->fieldObjectsCache; - } else { - return $this->fieldObjectsCache[$fieldOffset]; + if (!$this->fieldObjectsRetrieved) { + // Retrieve all metadata in one go + $fieldMetaData = sqlsrv_field_metadata($this->_queryID); + if ($fieldMetaData) { + $this->_numOfFields = count($fieldMetaData); + foreach ($fieldMetaData as $key => $value) { + $fld = new ADOFieldObject; + // Caution - keys are case-sensitive, must respect casing of values + $fld->name = $value['Name']; + $fld->max_length = $value['Size']; + $fld->column_source = $value['Name']; + $fld->type = $this->_typeConversion[$value['Type']]; + + $this->fieldObjects[$key] = $fld; + $this->fieldObjectsIndex[$fld->name] = $key; } } else { - // No metadata available - return false; + $this->_numOfFields = -1; + $this->fieldObjects = false; + $this->fieldObjectsIndex = array(); } + $this->fieldObjectsRetrieved = true; } - $this->fieldObjectsRetrieved = true; - /* - * Retrieve all metadata in one go. This is always returned as a - * numeric array. - */ - $fieldMetaData = sqlsrv_field_metadata($this->_queryID); - - if (!$fieldMetaData) { - // Not a statement that gives us metaData - return false; - } - - $this->_numOfFields = count($fieldMetaData); - foreach ($fieldMetaData as $key=>$value) { - $fld = new ADOFieldObject; - // Caution - keys are case-sensitive, must respect casing of values - $fld->name = $value['Name']; - $fld->max_length = $value['Size']; - $fld->column_source = $value['Name']; - $fld->type = $this->_typeConversion[$value['Type']]; - - $this->fieldObjectsCache[$key] = $fld; - $this->fieldObjectsIndex[$fld->name] = $key; - } - if ($fieldOffset == -1) { - return $this->fieldObjectsCache; + if ($this->fieldObjects) { + if ($fieldOffset == -1) { + return $this->fieldObjects; + } else { + return $this->fieldObjects[$fieldOffset]; + } } - return $this->fieldObjectsCache[$fieldOffset]; + // No metadata available + return false; } + /* * Fetchfield copies the oracle method, it loads the field information * into the _fieldobjs array once, to save multiple calls to the @@ -1206,7 +1230,7 @@ class ADORecordset_mssqlnative extends ADORecordSet { */ function fetchField($fieldOffset = -1) { - return $this->fieldObjectsCache[$fieldOffset]; + return $this->fieldObjects[$fieldOffset]; } function _seek($row) diff --git a/drivers/adodb-mssqlpo.inc.php b/drivers/adodb-mssqlpo.inc.php index f2d2f6fb..700725f4 100644 --- a/drivers/adodb-mssqlpo.inc.php +++ b/drivers/adodb-mssqlpo.inc.php @@ -1,27 +1,29 @@ <?php /** - * Portable MSSQL Driver that supports || instead of +. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +* @version v5.22.0-dev Unreleased +* @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. +* Whenever there is any discrepancy between the two licenses, +* the BSD license will take precedence. +* +* Set tabs to 4 for best viewing. +* +* Latest version is available at https://adodb.org/ +* +* Portable MSSQL Driver that supports || instead of + +* +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); + +/* + The big difference between mssqlpo and it's parent mssql is that mssqlpo supports + the more standard || string concatenation operator. +*/ + include_once(ADODB_DIR.'/drivers/adodb-mssql.inc.php'); class ADODB_mssqlpo extends ADODB_mssql { diff --git a/drivers/adodb-mysql.inc.php b/drivers/adodb-mysql.inc.php index f07c081b..5232571d 100644 --- a/drivers/adodb-mysql.inc.php +++ b/drivers/adodb-mysql.inc.php @@ -1,30 +1,22 @@ <?php -/** - * MySQL driver - * - * @deprecated - * - * This driver only supports the original non-transactional MySQL driver, - * which was deprecated in PHP version 5.5 and removed in PHP version 7. - * It is deprecated as of ADOdb version 5.20.0, use the mysqli driver - * instead, which supports both transactional and non-transactional updates. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 8. + + This driver only supports the original non-transactional MySQL driver. It + is deprecated in PHP version 5.5 and removed in PHP version 7. It is deprecated + as of ADOdb version 5.20.0. Use the mysqli driver instead, which supports both + transactional and non-transactional updates + + Requires mysql client. Works on Windows and Unix. + + 28 Feb 2001: MetaColumns bug fix - suggested by Freek Dijkstra (phpeverywhere@macfreek.com) +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -869,9 +861,15 @@ class ADORecordSet_mysql 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]; $len = -1; // mysql max_length is not accurate - switch (strtoupper($t)) { + + switch ($t) { case 'STRING': case 'CHAR': case 'VARCHAR': diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php index 352810cc..1539580a 100644 --- a/drivers/adodb-mysqli.inc.php +++ b/drivers/adodb-mysqli.inc.php @@ -1,28 +1,23 @@ <?php -/** - * MySQL improved driver (mysqli) - * - * This is the preferred driver for MySQL connections. It supports both - * transactional and non-transactional table types. You can use this as a - * drop-in replacement for both the mysql and mysqlt drivers. - * As of ADOdb Version 5.20.0, all other native MySQL drivers are deprecated. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 8. + + This is the preferred driver for MySQL connections, and supports both transactional + and non-transactional table types. You can use this as a drop-in replacement for both + the mysql and mysqlt drivers. As of ADOdb Version 5.20.0, all other native MySQL drivers + are deprecated + + Requires mysql client. Works on Windows and Unix. + +21 October 2003: MySQLi extension implementation by Arjen de Rijke (a.de.rijke@xs4all.nl) +Based on adodb 3.40 +*/ // security - hide paths if (!defined('ADODB_DIR')) { @@ -81,11 +76,8 @@ class ADODB_mysqli extends ADOConnection { */ private $usePreparedStatement = false; private $useLastInsertStatement = false; - - /** - * @var bool True if the last executed statement is a SELECT {@see _query()} - */ - private $isSelectStatement = false; + private $usingBoundVariables = false; + private $statementAffectedRows = -1; /** * Sets the isolation level of a transaction. @@ -189,6 +181,8 @@ class ADODB_mysqli extends ADOConnection { // SSL Connections for MySQLI if ($this->ssl_key || $this->ssl_cert || $this->ssl_ca || $this->ssl_capath || $this->ssl_cipher) { mysqli_ssl_set($this->_connectionID, $this->ssl_key, $this->ssl_cert, $this->ssl_ca, $this->ssl_capath, $this->ssl_cipher); + $this->socket = MYSQLI_CLIENT_SSL; + $this->clientFlags = MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT; } #if (!empty($this->port)) $argHostname .= ":".$this->port; @@ -439,12 +433,9 @@ class ADODB_mysqli extends ADOConnection { */ function _affectedrows() { - if ($this->isSelectStatement) { - // Affected rows works fine against selects, returning - // the rowcount, but ADOdb does not do that. - return false; - } - + if ($this->usingBoundVariables) + return $this->statementAffectedRows; + $result = @mysqli_affected_rows($this->_connectionID); if ($result == -1) { if ($this->debug) ADOConnection::outp("mysqli_affected_rows() failed : " . $this->errorMsg()); @@ -1039,6 +1030,7 @@ class ADODB_mysqli extends ADOConnection { /** * Prepares an SQL statement and returns a handle to use. + * This is not used by bound parameters anymore * * @link https://adodb.org/dokuwiki/doku.php?id=v5:reference:connection:prepare * @todo update this function to handle prepared statements correctly @@ -1067,13 +1059,86 @@ class ADODB_mysqli extends ADOConnection { } /** - * Return the query id. + * Execute SQL * - * @param string|array $sql - * @param array $inputarr + * @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 bool|mysqli_result + * @return ADORecordSet|bool */ + public function execute($sql, $inputarr = false) { + + if ($this->fnExecute) { + $fn = $this->fnExecute; + $ret = $fn($this,$sql,$inputarr); + if (isset($ret)) { + return $ret; + } + } + + if ($inputarr === false) { + return $this->_execute($sql,false); + } + + if (!is_array($inputarr)) { + $inputarr = array($inputarr); + } + + if (!is_array($sql)) { + + + + $typeString = ''; + $typeArray = array(''); //placeholder for type list + + foreach ($inputarr as $v) + { + $typeArray[] = $v; + if (is_integer($v) || is_bool($v)) + $typeString .= 'i'; + + else if (is_float($v)) + $typeString .= 'd'; + + else if(is_object($v)) + /* + * Assume a blob + */ + $typeString .= 'b'; + + else + $typeString .= 's'; + + } + + /* + * Place the field type list at the front of the + * parameter array. This is the mysql specific + * format + */ + $typeArray[0] = $typeString; + + $ret = $this->_execute($sql,$typeArray); + if (!$ret) { + return $ret; + } + + } else { + $ret = $this->_execute($sql,$inputarr); + } + return $ret; + } + + /** + * Return the query id. + * + * @param string|array $sql + * @param array $inputarr + * + * @return bool|mysqli_result + */ function _query($sql, $inputarr) { global $ADODB_COUNTRECS; @@ -1108,6 +1173,90 @@ class ADODB_mysqli extends ADOConnection { $ret = mysqli_stmt_execute($stmt); return $ret; } + else if (is_string($sql) && is_array($inputarr)) + { + /* + * This is support for true prepared queries + * with bound parameters + * + * set prepared statement flags + */ + $this->usePreparedStatement = true; + $this->usingBoundVariables = true; + + /* + * Prepare the statement with the placeholders, + * prepare will fail if the statement is invalid + * so we trap and error if necessary. Note that we + * are calling MySQL prepare here, not ADOdb + */ + $stmt = $this->_connectionID->prepare($sql); + if ($stmt === false) + { + $this->outp_throw( + "SQL Statement failed on preparation: " . htmlspecialchars($sql) . "'", + 'Execute' + ); + return false; + } + /* + * Make sure the number of parameters provided in the input + * array matches what the query expects. We must discount + * the first parameter which contains the data types in + * our inbound parameters + */ + $nparams = $stmt->param_count; + + if ($nparams != count($inputarr) - 1) { + $this->outp_throw( + "Input array has " . count($inputarr) . + " params, does not match query: '" . htmlspecialchars($sql) . "'", + 'Execute' + ); + return false; + } + + /* + * Must pass references into call_user_func_array + */ + $paramsByReference = array(); + foreach($inputarr as $key => $value) + $paramsByReference[$key] = &$inputarr[$key]; + + /* + * Bind the params + */ + call_user_func_array(array($stmt, 'bind_param'), $paramsByReference); + + /* + * Execute + */ + $ret = mysqli_stmt_execute($stmt); + + /* + * Did we throw an error? + */ + if ($ret == false) + return false; + + /* + * Is the statement a non-select + */ + if ($stmt->affected_rows > -1) + { + $this->statementAffectedRows = $stmt->affected_rows; + return true; + } + /* + * Turn the statement into a result set + */ + $result = $stmt->get_result(); + /* + * Return the object for the select + */ + return $result; + + } else { /* @@ -1126,7 +1275,7 @@ class ADODB_mysqli extends ADOConnection { return $mysql_res; */ - + if ($this->multiQuery) { $rs = mysqli_multi_query($this->_connectionID, $sql.';'); if ($rs) { @@ -1135,10 +1284,8 @@ class ADODB_mysqli extends ADOConnection { } } else { $rs = mysqli_query($this->_connectionID, $sql, $ADODB_COUNTRECS ? MYSQLI_STORE_RESULT : MYSQLI_USE_RESULT); - if ($rs) { - $this->isSelectStatement = is_object($rs); - return $rs; - } + + if ($rs) return $rs; } if($this->debug) @@ -1511,6 +1658,7 @@ class ADORecordSet_mysqli extends ADORecordSet{ 12 = MYSQLI_TYPE_DATETIME 13 = MYSQLI_TYPE_YEAR 14 = MYSQLI_TYPE_NEWDATE +245 = MYSQLI_TYPE_JSON 247 = MYSQLI_TYPE_ENUM 248 = MYSQLI_TYPE_SET 249 = MYSQLI_TYPE_TINY_BLOB @@ -1531,7 +1679,7 @@ class ADORecordSet_mysqli extends ADORecordSet{ * * @return string The MetaType */ - function MetaType($t, $len = -1, $fieldobj = false) + function metaType($t, $len = -1, $fieldobj = false) { if (is_object($t)) { $fieldobj = $t; @@ -1539,8 +1687,16 @@ class ADORecordSet_mysqli extends ADORecordSet{ $len = $fieldobj->max_length; } + $t = strtoupper($t); + /* + * Add support for custom actual types. We do this + * first, that allows us to override existing types + */ + if (array_key_exists($t,$this->connection->customActualTypes)) + return $this->connection->customActualTypes[$t]; + $len = -1; // mysql max_length is not accurate - switch (strtoupper($t)) { + switch ($t) { case 'STRING': case 'CHAR': case 'VARCHAR': @@ -1618,6 +1774,8 @@ class ADORecordSet_mysqli extends ADORecordSet{ case 'DEC': case 'FIXED': default: + + //if (!is_numeric($t)) echo "<p>--- Error in type matching $t -----</p>"; return 'N'; } @@ -1647,9 +1805,15 @@ class ADORecordSet_array_mysqli extends ADORecordSet_array $t = $fieldobj->type; $len = $fieldobj->max_length; } + + $t = strtoupper($t); + + if (array_key_exists($t,$this->connection->customActualTypes)) + return $this->connection->customActualTypes[$t]; $len = -1; // mysql max_length is not accurate - switch (strtoupper($t)) { + + switch ($t) { case 'STRING': case 'CHAR': case 'VARCHAR': diff --git a/drivers/adodb-mysqlpo.inc.php b/drivers/adodb-mysqlpo.inc.php index 8aa7779a..3908fc50 100644 --- a/drivers/adodb-mysqlpo.inc.php +++ b/drivers/adodb-mysqlpo.inc.php @@ -1,30 +1,24 @@ <?php -/** - * Portable MySQL driver - * - * @deprecated - * - * Extends the deprecated mysql driver, and was originally designed to be a - * portable driver in the same manner as oci8po and mssqlpo. Its functionality - * is exactly duplicated in the mysqlt driver, which is itself deprecated. - * This driver will be removed in ADOdb version 6.0.0. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ + +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 8. + + MySQL code that supports transactions. For MySQL 3.23 or later. + Code from James Poon <jpoon88@yahoo.com> + + This driver extends the deprecated mysql driver, and was originally designed to be a + portable driver in the same manner as oci8po and mssqlpo. Its functionality + is exactly duplicated in the mysqlt driver, which is itself deprecated. + This driver will be removed in ADOdb version 6.0.0. + + Requires mysql client. Works on Windows and Unix. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-mysqlt.inc.php b/drivers/adodb-mysqlt.inc.php index cccd93f8..02a3c99c 100644 --- a/drivers/adodb-mysqlt.inc.php +++ b/drivers/adodb-mysqlt.inc.php @@ -1,30 +1,21 @@ <?php -/** - * MySQL driver in transactional mode - * - * @deprecated - * - * This driver only supports the original MySQL driver in transactional mode. It - * is deprecated in PHP version 5.5 and removed in PHP version 7. It is deprecated - * as of ADOdb version 5.20.0. Use the mysqli driver instead, which supports both - * transactional and non-transactional updates - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ + +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 8. + + This driver only supports the original MySQL driver in transactional mode. It + is deprecated in PHP version 5.5 and removed in PHP version 7. It is deprecated + as of ADOdb version 5.20.0. Use the mysqli driver instead, which supports both + transactional and non-transactional updates + + Requires mysql client. Works on Windows and Unix. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-netezza.inc.php b/drivers/adodb-netezza.inc.php index dc7c58e4..071c2578 100644 --- a/drivers/adodb-netezza.inc.php +++ b/drivers/adodb-netezza.inc.php @@ -1,35 +1,21 @@ <?php -/** - * Netezza Driver - * - * @link https://www.ibm.com/products/netezza - * Based on the previous postgres drivers. Major Additions/Changes: - * - MetaDatabasesSQL, MetaTablesSQL, MetaColumnsSQL - * Note: You have to have admin privileges to access the system tables - * - Removed non-working keys code (Netezza has no concept of keys) - * - Fixed the way data types and lengths are returned in MetaColumns() - * as well as added the default lengths for certain types - * - Updated public variables for Netezza - * TODO: Still need to remove blob functions, as Netezza doesn't support blob - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author Josh Eldridge <joshuae74@hotmail.com> - */ +/* + @version v5.22.0-dev Unreleased + @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved. + @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community + First cut at the Netezza Driver by Josh Eldridge joshuae74#hotmail.com + Based on the previous postgres drivers. + http://www.netezza.com/ + Major Additions/Changes: + MetaDatabasesSQL, MetaTablesSQL, MetaColumnsSQL + Note: You have to have admin privileges to access the system tables + Removed non-working keys code (Netezza has no concept of keys) + Fixed the way data types and lengths are returned in MetaColumns() + as well as added the default lengths for certain types + Updated public variables for Netezza + Still need to remove blob functions, as Netezza doesn't support blob +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-oci8.inc.php b/drivers/adodb-oci8.inc.php index e541b6b6..ade82b38 100644 --- a/drivers/adodb-oci8.inc.php +++ b/drivers/adodb-oci8.inc.php @@ -1,25 +1,20 @@ <?php -/** - * FileDescription - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author John Lim - * @author George Fourlanos <fou@infomap.gr> - */ +/* + + @version v5.22.0-dev Unreleased + @copyright (c) 2000-2013 John Lim. All rights reserved. + @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community + + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Latest version is available at https://adodb.org/ + + Code contributed by George Fourlanos <fou@infomap.gr> + + 13 Nov 2000 jlim - removed all ora_* references. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -1809,8 +1804,13 @@ class ADORecordset_oci8 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]; - switch (strtoupper($t)) { + switch ($t) { case 'VARCHAR': case 'VARCHAR2': case 'CHAR': diff --git a/drivers/adodb-oci805.inc.php b/drivers/adodb-oci805.inc.php index 01958282..c74419d6 100644 --- a/drivers/adodb-oci805.inc.php +++ b/drivers/adodb-oci805.inc.php @@ -1,27 +1,18 @@ <?php /** - * Oracle 8.0.5 (oci8) driver + * @version v5.22.0-dev Unreleased + * @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. + * Whenever there is any discrepancy between the two licenses, + * the BSD license will take precedence. * - * @deprecated + * Set tabs to 4 for best viewing. * - * Optimizes selectLimit() performance with FIRST_ROWS hint. + * Latest version is available at https://adodb.org/ * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ + * Oracle 8.0.5 driver +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-oci8po.inc.php b/drivers/adodb-oci8po.inc.php index 50630cad..a64e5207 100644 --- a/drivers/adodb-oci8po.inc.php +++ b/drivers/adodb-oci8po.inc.php @@ -1,28 +1,23 @@ <?php -/** - * Portable version of Oracle oci8 driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * Portable version of oci8 driver, to make it more similar to other database - * drivers. The main differences are - * 1. that the OCI_ASSOC names are in lowercase instead of uppercase. - * 2. bind variables are mapped using ? instead of :<bindvar> - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@copyright (c) 2000-2013 John Lim. All rights reserved. +@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Latest version is available at https://adodb.org/ + + Portable version of oci8 driver, to make it more similar to other database drivers. + The main differences are + + 1. that the OCI_ASSOC names are in lowercase instead of uppercase. + 2. bind variables are mapped using ? instead of :<bindvar> + + Should some emulation of RecordCount() be implemented? + +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-oci8quercus.inc.php b/drivers/adodb-oci8quercus.inc.php index f9312c9d..8fd7abf6 100644 --- a/drivers/adodb-oci8quercus.inc.php +++ b/drivers/adodb-oci8quercus.inc.php @@ -1,23 +1,23 @@ <?php -/** - * Oracle "quercus" driver. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@copyright (c) 2000-2013 John Lim. All rights reserved. +@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Latest version is available at https://adodb.org/ + + Portable version of oci8 driver, to make it more similar to other database drivers. + The main differences are + + 1. that the OCI_ASSOC names are in lowercase instead of uppercase. + 2. bind variables are mapped using ? instead of :<bindvar> + + Should some emulation of RecordCount() be implemented? + +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-odbc.inc.php b/drivers/adodb-odbc.inc.php index a9705e2d..e8a067d9 100644 --- a/drivers/adodb-odbc.inc.php +++ b/drivers/adodb-odbc.inc.php @@ -1,24 +1,17 @@ <?php -/** - * Base ODBC driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + Latest version is available at https://adodb.org/ + + Requires ODBC. Works on Windows and Unix. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-odbc_db2.inc.php b/drivers/adodb-odbc_db2.inc.php index 8f0e60cb..9468b86f 100644 --- a/drivers/adodb-odbc_db2.inc.php +++ b/drivers/adodb-odbc_db2.inc.php @@ -1,23 +1,92 @@ <?php -/** - * DB2 driver via ODBC - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + DB2 data driver. Requires ODBC. + +From phpdb list: + +Hi Andrew, + +thanks a lot for your help. Today we discovered what +our real problem was: + +After "playing" a little bit with the php-scripts that try +to connect to the IBM DB2, we set the optional parameter +Cursortype when calling odbc_pconnect(....). + +And the exciting thing: When we set the cursor type +to SQL_CUR_USE_ODBC Cursor Type, then +the whole query speed up from 1 till 10 seconds +to 0.2 till 0.3 seconds for 100 records. Amazing!!! + +Therefore, PHP is just almost fast as calling the DB2 +from Servlets using JDBC (don't take too much care +about the speed at whole: the database was on a +completely other location, so the whole connection +was made over a slow network connection). + +I hope this helps when other encounter the same +problem when trying to connect to DB2 from +PHP. + +Kind regards, +Christian Szardenings + +2 Oct 2001 +Mark Newnham has discovered that the SQL_CUR_USE_ODBC is not supported by +IBM's DB2 ODBC driver, so this must be a 3rd party ODBC driver. + +From the IBM CLI Reference: + +SQL_ATTR_ODBC_CURSORS (DB2 CLI v5) +This connection attribute is defined by ODBC, but is not supported by DB2 +CLI. Any attempt to set or get this attribute will result in an SQLSTATE of +HYC00 (Driver not capable). + +A 32-bit option specifying how the Driver Manager uses the ODBC cursor +library. + +So I guess this means the message [above] was related to using a 3rd party +odbc driver. + +Setting SQL_CUR_USE_ODBC +======================== +To set SQL_CUR_USE_ODBC for drivers that require it, do this: + +$db = NewADOConnection('odbc_db2'); +$db->curMode = SQL_CUR_USE_ODBC; +$db->Connect($dsn, $userid, $pwd); + + + +USING CLI INTERFACE +=================== + +I have had reports that the $host and $database params have to be reversed in +Connect() when using the CLI interface. From Halmai Csongor csongor.halmai#nexum.hu: + +> The symptom is that if I change the database engine from postgres or any other to DB2 then the following +> connection command becomes wrong despite being described this version to be correct in the docs. +> +> $connection_object->Connect( $DATABASE_HOST, $DATABASE_AUTH_USER_NAME, $DATABASE_AUTH_PASSWORD, $DATABASE_NAME ) +> +> In case of DB2 I had to swap the first and last arguments in order to connect properly. + + +System Error 5 +============== +IF you get a System Error 5 when trying to Connect/Load, it could be a permission problem. Give the user connecting +to DB2 full rights to the DB2 SQLLIB directory, and place the user in the DBUSERS group. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-odbc_mssql.inc.php b/drivers/adodb-odbc_mssql.inc.php index 37185aac..2c06885c 100644 --- a/drivers/adodb-odbc_mssql.inc.php +++ b/drivers/adodb-odbc_mssql.inc.php @@ -1,23 +1,18 @@ <?php -/** - * MSSQL driver via ODBC - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + MSSQL support via ODBC. Requires ODBC. Works on Windows and Unix. + For Unix configuration, see http://phpbuilder.com/columns/alberto20000919.php3 +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-odbc_mssql2012.inc.php b/drivers/adodb-odbc_mssql2012.inc.php index 79fa3251..558ee2ee 100644 --- a/drivers/adodb-odbc_mssql2012.inc.php +++ b/drivers/adodb-odbc_mssql2012.inc.php @@ -1,23 +1,14 @@ <?php -/** - * Microsoft SQL Server 2012 driver via ODBC - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* + @version v5.22.0-dev Unreleased + @copyright (c) 2015 Damien Regad, Mark Newnham and the ADOdb community + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 4. + + Microsoft SQL Server 2012 via ODBC +*/ if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-odbc_oracle.inc.php b/drivers/adodb-odbc_oracle.inc.php index d8461e1a..a2e389a5 100644 --- a/drivers/adodb-odbc_oracle.inc.php +++ b/drivers/adodb-odbc_oracle.inc.php @@ -1,24 +1,17 @@ <?php -/** - * Oracle driver via ODBC - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + Latest version is available at https://adodb.org/ + + Oracle support via ODBC. Requires ODBC. Works on Windows. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-odbtp.inc.php b/drivers/adodb-odbtp.inc.php index bd167a1c..c829744f 100644 --- a/drivers/adodb-odbtp.inc.php +++ b/drivers/adodb-odbtp.inc.php @@ -1,26 +1,15 @@ <?php -/** - * ODBTP driver - * - * @deprecated will be removed in ADOdb version 6 - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author stefan bogdan <sbogdan@rsb.ro> - */ +/* + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. See License.txt. + Set tabs to 4 for best viewing. + Latest version is available at https://adodb.org/ +*/ +// Code contributed by "stefan bogdan" <sbogdan#rsb.ro> // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-odbtp_unicode.inc.php b/drivers/adodb-odbtp_unicode.inc.php index 190c3ab5..bbe67af7 100644 --- a/drivers/adodb-odbtp_unicode.inc.php +++ b/drivers/adodb-odbtp_unicode.inc.php @@ -1,36 +1,30 @@ <?php -/** - * ODBTP Unicode driver. - * - * @deprecated will be removed in ADOdb version 6 - * - * Because the ODBTP server sends and reads UNICODE text data using UTF-8 - * encoding, the following HTML meta tag must be included within the HTML - * head section of every HTML form and script page: - * <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - * Also, all SQL query strings must be submitted as UTF-8 encoded text. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author Robert Twitty <rtwitty@neutron.ushmm.org> - */ +/* + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. See License.txt. + Set tabs to 4 for best viewing. + Latest version is available at https://adodb.org/ +*/ + +// Code contributed by "Robert Twitty" <rtwitty#neutron.ushmm.org> // security - hide paths if (!defined('ADODB_DIR')) die(); +/* + Because the ODBTP server sends and reads UNICODE text data using UTF-8 + encoding, the following HTML meta tag must be included within the HTML + head section of every HTML form and script page: + + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + + Also, all SQL query strings must be submitted as UTF-8 encoded text. +*/ + if (!defined('_ADODB_ODBTP_LAYER')) { include_once(ADODB_DIR."/drivers/adodb-odbtp.inc.php"); } diff --git a/drivers/adodb-oracle.inc.php b/drivers/adodb-oracle.inc.php index 1a2735b1..256533b8 100644 --- a/drivers/adodb-oracle.inc.php +++ b/drivers/adodb-oracle.inc.php @@ -1,25 +1,18 @@ <?php -/** - * Oracle data driver - * - * @deprecated Use oci8 driver instead - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Latest version is available at https://adodb.org/ + + Oracle data driver. Requires Oracle client. Works on Windows and Unix and Oracle 7. + + If you are using Oracle 8 or later, use the oci8 driver which is much better and more reliable. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-pdo.inc.php b/drivers/adodb-pdo.inc.php index 0933bf14..e59dbd90 100644 --- a/drivers/adodb-pdo.inc.php +++ b/drivers/adodb-pdo.inc.php @@ -1,23 +1,23 @@ <?php /** - * ADOdb base PDO driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Requires ODBC. Works on Windows and Unix. + + Problems: + Where is float/decimal type in pdo_param_type + LOB handling for CLOB/BLOB differs significantly +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -238,6 +238,26 @@ class ADODB_pdo extends ADOConnection { return call_user_func_array('parent::Concat', $args); } + /** + * Triggers a driver-specific request for a bind parameter + * + * @param string $name + * @param string $type + * + * @return string + */ + public function param($name,$type='C') { + + $args = func_get_args(); + if(method_exists($this->_driver, 'param')) { + // Return the driver specific entry, that mimics the native driver + return call_user_func_array(array($this->_driver, 'param'), $args); + } + + // No driver specific method defined, use mysql format '?' + return call_user_func_array('parent::param', $args); + } + // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { @@ -273,10 +293,10 @@ class ADODB_pdo extends ADOConnection { return $this->_driver->MetaColumns($table,$normalize); } - public function metaIndexes($table,$normalize=true) + public function metaIndexes($table,$normalize=true,$owner=false) { if (method_exists($this->_driver,'metaIndexes')) - return $this->_driver->metaIndexes($table,$normalize); + return $this->_driver->metaIndexes($table,$normalize,$owner); } /** @@ -565,6 +585,7 @@ class ADODB_pdo extends ADOConnection { $this->_driver->debug = $this->debug; } if ($inputarr) { + /* * inputarr must be numeric */ diff --git a/drivers/adodb-pdo_dblib.inc.php b/drivers/adodb-pdo_dblib.inc.php index aae561bf..f2ea97e6 100644 --- a/drivers/adodb-pdo_dblib.inc.php +++ b/drivers/adodb-pdo_dblib.inc.php @@ -2,21 +2,13 @@ /** * ADOdb PDO dblib driver. * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. + * Released under both BSD license and Lesser GPL library license. + * Whenever there is any discrepancy between the two licenses, the BSD license + * will take precedence. * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2019 Damien Regad, Mark Newnham and the ADOdb community + * @version v5.22.0-dev Unreleased + * @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved. + * @copyright (c) 2019 Damien Regad, Mark Newnham and the ADOdb community */ class ADODB_pdo_dblib extends ADODB_pdo diff --git a/drivers/adodb-pdo_firebird.inc.php b/drivers/adodb-pdo_firebird.inc.php index 0ee5e02b..6e1f0544 100644 --- a/drivers/adodb-pdo_firebird.inc.php +++ b/drivers/adodb-pdo_firebird.inc.php @@ -1,24 +1,19 @@ <?php /** - * PDO Firebird driver + * ADOdb PDO Firebird driver * - * This version has only been tested on Firebird 3.0 and PHP 7 + * @version v5.22.0-dev Unreleased + * @copyright (c) 2019 Damien Regad, Mark Newnham and the ADOdb community * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. + * Released under both BSD license and Lesser GPL library license. + * Whenever there is any discrepancy between the two licenses, + * the BSD license will take precedence. See License.txt. * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker + * Set tabs to 4 for best viewing. * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later + * Latest version is available at https://adodb.org/ * - * @copyright 2000-2013 John Lim - * @copyright 2019 Damien Regad, Mark Newnham and the ADOdb community + * This version has only been tested on Firebird 3.0 and PHP 7 */ /** diff --git a/drivers/adodb-pdo_mssql.inc.php b/drivers/adodb-pdo_mssql.inc.php index ef63b654..2c02377a 100644 --- a/drivers/adodb-pdo_mssql.inc.php +++ b/drivers/adodb-pdo_mssql.inc.php @@ -1,23 +1,16 @@ <?php -/** - * PDO MSSQL driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ + + +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 8. + +*/ class ADODB_pdo_mssql extends ADODB_pdo { diff --git a/drivers/adodb-pdo_mysql.inc.php b/drivers/adodb-pdo_mysql.inc.php index c8812453..18bb1655 100644 --- a/drivers/adodb-pdo_mysql.inc.php +++ b/drivers/adodb-pdo_mysql.inc.php @@ -1,23 +1,14 @@ <?php -/** - * PDO MySQL driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 8. + +*/ class ADODB_pdo_mysql extends ADODB_pdo { diff --git a/drivers/adodb-pdo_oci.inc.php b/drivers/adodb-pdo_oci.inc.php index 9a05ee6a..28794ed9 100644 --- a/drivers/adodb-pdo_oci.inc.php +++ b/drivers/adodb-pdo_oci.inc.php @@ -1,23 +1,16 @@ <?php -/** - * PDO Oracle (oci) driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ + + +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 8. + +*/ class ADODB_pdo_oci extends ADODB_pdo_base { @@ -75,15 +68,15 @@ class ADODB_pdo_oci extends ADODB_pdo_base { $retarr = array(); while (!$rs->EOF) { //print_r($rs->fields); $fld = new ADOFieldObject(); - $fld->name = $rs->fields[0]; - $fld->type = $rs->fields[1]; - $fld->max_length = $rs->fields[2]; + $fld->name = $rs->fields[0]; + $fld->type = $rs->fields[1]; + $fld->max_length = $rs->fields[2]; $fld->scale = $rs->fields[3]; if ($rs->fields[1] == 'NUMBER' && $rs->fields[3] == 0) { $fld->type ='INT'; - $fld->max_length = $rs->fields[4]; - } - $fld->not_null = (strncmp($rs->fields[5], 'NOT',3) === 0); + $fld->max_length = $rs->fields[4]; + } + $fld->not_null = (strncmp($rs->fields[5], 'NOT',3) === 0); $fld->binary = (strpos($fld->type,'BLOB') !== false); $fld->default_value = $rs->fields[6]; @@ -98,12 +91,25 @@ class ADODB_pdo_oci extends ADODB_pdo_base { return $retarr; } - /** - * @param bool $auto_commit - * @return void - */ - function SetAutoCommit($auto_commit) - { - $this->_connectionID->setAttribute(PDO::ATTR_AUTOCOMMIT, $auto_commit); - } + /** + * @param bool $auto_commit + * @return void + */ + function SetAutoCommit($auto_commit) + { + $this->_connectionID->setAttribute(PDO::ATTR_AUTOCOMMIT, $auto_commit); + } + + /** + * Returns a driver-specific format for a bind parameter + * + * @param string $name + * @param string $type (ignored in driver) + * + * @return string + */ + public function param($name,$type='C') + { + return sprintf(':%s', $name); + } } diff --git a/drivers/adodb-pdo_pgsql.inc.php b/drivers/adodb-pdo_pgsql.inc.php index 0212d4fd..c3b5b84c 100644 --- a/drivers/adodb-pdo_pgsql.inc.php +++ b/drivers/adodb-pdo_pgsql.inc.php @@ -1,31 +1,23 @@ <?php -/** - * PDO PostgreSQL (pgsql) driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ + +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 8. + +*/ class ADODB_pdo_pgsql extends ADODB_pdo { var $metaDatabasesSQL = "select datname from pg_database where datname not in ('template0','template1') order by 1"; - var $metaTablesSQL = "select tablename,'T' from pg_tables where tablename not like 'pg\_%' - and tablename not in ('sql_features', 'sql_implementation_info', 'sql_languages', - 'sql_packages', 'sql_sizing', 'sql_sizing_profiles') - union - select viewname,'V' from pg_views where viewname not like 'pg\_%'"; + var $metaTablesSQL = "select tablename,'T' from pg_tables where tablename not like 'pg\_%' + and tablename not in ('sql_features', 'sql_implementation_info', 'sql_languages', + 'sql_packages', 'sql_sizing', 'sql_sizing_profiles') + union + select viewname,'V' from pg_views where viewname not like 'pg\_%'"; //"select tablename from pg_tables where tablename not like 'pg_%' order by 1"; var $isoDates = true; // accepts dates in ISO format var $sysDate = "CURRENT_DATE"; @@ -34,15 +26,15 @@ class ADODB_pdo_pgsql extends ADODB_pdo { var $metaColumnsSQL = "SELECT a.attname,t.typname,a.attlen,a.atttypmod,a.attnotnull,a.atthasdef,a.attnum FROM pg_class c, pg_attribute a,pg_type t WHERE relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s')) and a.attname not like '....%%' -AND a.attnum > 0 AND a.atttypid = t.oid AND a.attrelid = c.oid ORDER BY a.attnum"; + AND a.attnum > 0 AND a.atttypid = t.oid AND a.attrelid = c.oid ORDER BY a.attnum"; // used when schema defined var $metaColumnsSQL1 = "SELECT a.attname, t.typname, a.attlen, a.atttypmod, a.attnotnull, a.atthasdef, a.attnum -FROM pg_class c, pg_attribute a, pg_type t, pg_namespace n -WHERE relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s')) - and c.relnamespace=n.oid and n.nspname='%s' - and a.attname not like '....%%' AND a.attnum > 0 - AND a.atttypid = t.oid AND a.attrelid = c.oid ORDER BY a.attnum"; + FROM pg_class c, pg_attribute a, pg_type t, pg_namespace n + WHERE relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s')) + and c.relnamespace=n.oid and n.nspname='%s' + and a.attname not like '....%%' AND a.attnum > 0 + AND a.atttypid = t.oid AND a.attrelid = c.oid ORDER BY a.attnum"; // get primary key etc -- from Freek Dijkstra var $metaKeySQL = "SELECT ic.relname AS index_name, a.attname AS column_name,i.indisunique AS unique_key, i.indisprimary AS primary_key @@ -97,23 +89,27 @@ WHERE relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s')) { $info = $this->ServerInfo(); if ($info['version'] >= 7.3) { - $this->metaTablesSQL = "select tablename,'T' from pg_tables where tablename not like 'pg\_%' - and schemaname not in ( 'pg_catalog','information_schema') - union - select viewname,'V' from pg_views where viewname not like 'pg\_%' and schemaname not in ( 'pg_catalog','information_schema') "; + $this->metaTablesSQL = " +select tablename,'T' from pg_tables +where tablename not like 'pg\_%' and schemaname not in ( 'pg_catalog','information_schema') +union +select viewname,'V' from pg_views +where viewname not like 'pg\_%' and schemaname not in ( 'pg_catalog','information_schema')"; } if ($mask) { $save = $this->metaTablesSQL; $mask = $this->qstr(strtolower($mask)); if ($info['version']>=7.3) $this->metaTablesSQL = " -select tablename,'T' from pg_tables where tablename like $mask and schemaname not in ( 'pg_catalog','information_schema') - union -select viewname,'V' from pg_views where viewname like $mask and schemaname not in ( 'pg_catalog','information_schema') "; +select tablename,'T' from pg_tables +where tablename like $mask and schemaname not in ( 'pg_catalog','information_schema') +union +select viewname,'V' from pg_views +where viewname like $mask and schemaname not in ( 'pg_catalog','information_schema')"; else $this->metaTablesSQL = " select tablename,'T' from pg_tables where tablename like $mask - union +union select viewname,'V' from pg_views where viewname like $mask"; } $ret = ADOConnection::MetaTables($ttype,$showSchema); @@ -297,4 +293,23 @@ select viewname,'V' from pg_views where viewname like $mask"; if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode; $this->_connectionID->query("SET TRANSACTION ".$transaction_mode); } + + /** + * Returns a driver-specific format for a bind parameter + * + * Unlike the native driver, we use :name parameters + * instead of offsets + * + * @param string $name + * @param string $type (ignored in driver) + * + * @return string + */ + public function param($name,$type='C') { + if (!$name) { + return ''; + } + + return sprintf(':%s', $name); + } } diff --git a/drivers/adodb-pdo_sqlite.inc.php b/drivers/adodb-pdo_sqlite.inc.php index b62ca35e..99ad9e50 100644 --- a/drivers/adodb-pdo_sqlite.inc.php +++ b/drivers/adodb-pdo_sqlite.inc.php @@ -1,25 +1,19 @@ <?php -/** - * PDO SQLite driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author Diogo Toscano <diogo@scriptcase.net> - * @author Sid Dunayer <sdunayer@interserv.com> - */ + +/* + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. See License.txt. + Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Thanks Diogo Toscano (diogo#scriptcase.net) for the code. + And also Sid Dunayer [sdunayer#interserv.com] for extensive fixes. +*/ class ADODB_pdo_sqlite extends ADODB_pdo { var $metaTablesSQL = "SELECT name FROM sqlite_master WHERE type='table'"; @@ -34,7 +28,7 @@ class ADODB_pdo_sqlite extends ADODB_pdo { var $_genSeq2SQL = 'INSERT INTO %s VALUES(%s)'; var $_dropSeqSQL = 'DROP TABLE %s'; var $concat_operator = '||'; - var $pdoDriver = false; + var $pdoDriver = false; var $random='abs(random())'; function _init($parentDriver) @@ -156,40 +150,48 @@ class ADODB_pdo_sqlite extends ADODB_pdo { // mark newnham function MetaColumns($tab,$normalize=true) { - global $ADODB_FETCH_MODE; + global $ADODB_FETCH_MODE; - $parent = $this->pdoDriver; - $false = false; - $save = $ADODB_FETCH_MODE; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - if ($parent->fetchMode !== false) $savem = $parent->SetFetchMode(false); - $rs = $parent->Execute("PRAGMA table_info('$tab')"); - if (isset($savem)) $parent->SetFetchMode($savem); - if (!$rs) { - $ADODB_FETCH_MODE = $save; - return $false; - } - $arr = array(); - while ($r = $rs->FetchRow()) { - $type = explode('(',$r['type']); - $size = ''; - if (sizeof($type)==2) - $size = trim($type[1],')'); - $fn = strtoupper($r['name']); - $fld = new ADOFieldObject; - $fld->name = $r['name']; - $fld->type = $type[0]; - $fld->max_length = $size; - $fld->not_null = $r['notnull']; - $fld->primary_key = $r['pk']; - $fld->default_value = $r['dflt_value']; - $fld->scale = 0; - if ($save == ADODB_FETCH_NUM) $arr[] = $fld; - else $arr[strtoupper($fld->name)] = $fld; - } - $rs->Close(); - $ADODB_FETCH_MODE = $save; - return $arr; + $parent = $this->pdoDriver; + $false = false; + $save = $ADODB_FETCH_MODE; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + if ($parent->fetchMode !== false) { + $savem = $parent->SetFetchMode(false); + } + $rs = $parent->Execute("PRAGMA table_info('$tab')"); + if (isset($savem)) { + $parent->SetFetchMode($savem); + } + if (!$rs) { + $ADODB_FETCH_MODE = $save; + return $false; + } + $arr = array(); + while ($r = $rs->FetchRow()) { + $type = explode('(', $r['type']); + $size = ''; + if (sizeof($type) == 2) { + $size = trim($type[1], ')'); + } + $fn = strtoupper($r['name']); + $fld = new ADOFieldObject; + $fld->name = $r['name']; + $fld->type = $type[0]; + $fld->max_length = $size; + $fld->not_null = $r['notnull']; + $fld->primary_key = $r['pk']; + $fld->default_value = $r['dflt_value']; + $fld->scale = 0; + if ($save == ADODB_FETCH_NUM) { + $arr[] = $fld; + } else { + $arr[strtoupper($fld->name)] = $fld; + } + } + $rs->Close(); + $ADODB_FETCH_MODE = $save; + return $arr; } function MetaTables($ttype=false,$showSchema=false,$mask=false) @@ -208,5 +210,18 @@ class ADODB_pdo_sqlite extends ADODB_pdo { $this->metaTablesSQL = $save; } return $ret; - } + } + + /** + * Returns a driver-specific format for a bind parameter + * + * @param string $name + * @param string $type (ignored in driver) + * + * @return string + */ + public function param($name,$type='C') + { + return sprintf(':%s', $name); + } } diff --git a/drivers/adodb-pdo_sqlsrv.inc.php b/drivers/adodb-pdo_sqlsrv.inc.php index ed73f3a2..ba5180ec 100644 --- a/drivers/adodb-pdo_sqlsrv.inc.php +++ b/drivers/adodb-pdo_sqlsrv.inc.php @@ -1,25 +1,8 @@ <?php + /** - * PDO sqlsrv driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author Ned Andre + * Provided by Ned Andre to support sqlsrv library */ - class ADODB_pdo_sqlsrv extends ADODB_pdo { var $hasTop = 'top'; diff --git a/drivers/adodb-postgres.inc.php b/drivers/adodb-postgres.inc.php index 070ac1c7..6ba96566 100644 --- a/drivers/adodb-postgres.inc.php +++ b/drivers/adodb-postgres.inc.php @@ -1,25 +1,15 @@ <?php -/** - * ADOdb PostgreSQL driver - * - * NOTE: Since ADOdb 3.31, this file is no longer used, and the "postgres" - * driver is remapped to the latest available postgres version. Maintaining - * multiple postgres drivers is no easy job, so hopefully this will ensure - * greater consistency and fewer bugs. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 4. + + NOTE: Since 3.31, this file is no longer used, and the "postgres" driver is + remapped to lastest available postgres version. Maintaining multiple + postgres drivers is no easy job, so hopefully this will ensure greater + consistency and fewer bugs. +*/ diff --git a/drivers/adodb-postgres64.inc.php b/drivers/adodb-postgres64.inc.php index 5c1f08fc..24952581 100644 --- a/drivers/adodb-postgres64.inc.php +++ b/drivers/adodb-postgres64.inc.php @@ -1,23 +1,48 @@ <?php -/** - * ADOdb PostgreSQL 6.4 driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 8. + + Original version derived from Alberto Cerezal (acerezalp@dbnet.es) - DBNet Informatica & Comunicaciones. + 08 Nov 2000 jlim - Minor corrections, removing mysql stuff + 09 Nov 2000 jlim - added insertid support suggested by "Christopher Kings-Lynne" <chriskl@familyhealth.com.au> + jlim - changed concat operator to || and data types to MetaType to match documented pgsql types + see http://www.postgresql.org/devel-corner/docs/postgres/datatype.htm + 22 Nov 2000 jlim - added changes to FetchField() and MetaTables() contributed by "raser" <raser@mail.zen.com.tw> + 27 Nov 2000 jlim - added changes to _connect/_pconnect from ideas by "Lennie" <leen@wirehub.nl> + 15 Dec 2000 jlim - added changes suggested by Additional code changes by "Eric G. Werk" egw@netguide.dk. + 31 Jan 2002 jlim - finally installed postgresql. testing + 01 Mar 2001 jlim - Freek Dijkstra changes, also support for text type + + See http://www.varlena.com/varlena/GeneralBits/47.php + + -- What indexes are on my table? + select * from pg_indexes where tablename = 'tablename'; + + -- What triggers are on my table? + select c.relname as "Table", t.tgname as "Trigger Name", + t.tgconstrname as "Constraint Name", t.tgenabled as "Enabled", + t.tgisconstraint as "Is Constraint", cc.relname as "Referenced Table", + p.proname as "Function Name" + from pg_trigger t, pg_class c, pg_class cc, pg_proc p + where t.tgfoid = p.oid and t.tgrelid = c.oid + and t.tgconstrrelid = cc.oid + and c.relname = 'tablename'; + + -- What constraints are on my table? + select r.relname as "Table", c.conname as "Constraint Name", + contype as "Constraint Type", conkey as "Key Columns", + confkey as "Foreign Columns", consrc as "Source" + from pg_class r, pg_constraint c + where r.oid = c.conrelid + and relname = 'tablename'; + +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -951,9 +976,10 @@ class ADORecordSet_postgres64 extends ADORecordSet{ return $row; } - function _initRS() + + function _initrs() { - global $ADODB_COUNTRECS; + global $ADODB_COUNTRECS; $qid = $this->_queryID; $this->_numOfRows = ($ADODB_COUNTRECS)? @pg_num_rows($qid):-1; $this->_numOfFields = @pg_num_fields($qid); @@ -968,11 +994,10 @@ class ADORecordSet_postgres64 extends ADORecordSet{ } } - function fields($colname) + /* Use associative array to get fields array */ + function Fields($colname) { - if ($this->fetchMode != PGSQL_NUM) { - return @$this->fields[$colname]; - } + if ($this->fetchMode != PGSQL_NUM) return @$this->fields[$colname]; if (!$this->bind) { $this->bind = array(); @@ -984,7 +1009,7 @@ class ADORecordSet_postgres64 extends ADORecordSet{ return $this->fields[$this->bind[strtoupper($colname)]]; } - function fetchField($fieldOffset) + function FetchField($off = 0) { // offsets begin at 0 @@ -1069,7 +1094,14 @@ class ADORecordSet_postgres64 extends ADORecordSet{ $t = $fieldobj->type; $len = $fieldobj->max_length; } - switch (strtoupper($t)) { + + $t = strtoupper($t); + + if (array_key_exists($t,$this->connection->customActualTypes)) + return $this->connection->customActualTypes[$t]; + + switch ($t) { + case 'MONEY': // stupid, postgres expects money to be a string case 'INTERVAL': case 'CHAR': diff --git a/drivers/adodb-postgres7.inc.php b/drivers/adodb-postgres7.inc.php index 59174f67..f793d000 100644 --- a/drivers/adodb-postgres7.inc.php +++ b/drivers/adodb-postgres7.inc.php @@ -1,23 +1,17 @@ <?php -/** - * ADOdb PostgreSQL 7 driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 4. + + Postgres7 support. + 28 Feb 2001: Currently indicate that we support LIMIT + 01 Dec 2001: dannym added support for default values +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-postgres8.inc.php b/drivers/adodb-postgres8.inc.php index 37c2aae1..fded8aa6 100644 --- a/drivers/adodb-postgres8.inc.php +++ b/drivers/adodb-postgres8.inc.php @@ -1,23 +1,15 @@ <?php -/** - * ADOdb PostgreSQL 8 driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 4. + + Postgres8 support. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-postgres9.inc.php b/drivers/adodb-postgres9.inc.php index fb9c6785..1dbf1465 100644 --- a/drivers/adodb-postgres9.inc.php +++ b/drivers/adodb-postgres9.inc.php @@ -1,23 +1,15 @@ <?php -/** - * ADOdb PostgreSQL 9+ driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 4. + + Postgres9 support. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-proxy.inc.php b/drivers/adodb-proxy.inc.php index 3be13179..4aee6e9b 100644 --- a/drivers/adodb-proxy.inc.php +++ b/drivers/adodb-proxy.inc.php @@ -1,25 +1,15 @@ <?php -/** - * ADOdb Proxy Server driver - * - * @deprecated - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 4. + + Synonym for csv driver. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-sapdb.inc.php b/drivers/adodb-sapdb.inc.php index 34eb4a55..453a2ed5 100644 --- a/drivers/adodb-sapdb.inc.php +++ b/drivers/adodb-sapdb.inc.php @@ -1,23 +1,18 @@ <?php -/** - * SAPDB data driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + SAPDB data driver. Requires ODBC. + +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-sqlanywhere.inc.php b/drivers/adodb-sqlanywhere.inc.php index 88897af9..c4f550a2 100644 --- a/drivers/adodb-sqlanywhere.inc.php +++ b/drivers/adodb-sqlanywhere.inc.php @@ -1,23 +1,47 @@ <?php -/** - * SAP SQL Anywhere driver (previously Sybase SQL Anywhere) - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights +@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community +reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + 21.02.2002 - Wade Johnson wade@wadejohnson.de + Extended ODBC class for Sybase SQLAnywhere. + 1) Added support to retrieve the last row insert ID on tables with + primary key column using autoincrement function. + + 2) Added blob support. Usage: + a) create blob variable on db server: + + $dbconn->create_blobvar($blobVarName); + + b) load blob var from file. $filename must be complete path + + $dbcon->load_blobvar_from_file($blobVarName, $filename); + + c) Use the $blobVarName in SQL insert or update statement in the values + clause: + + $recordSet = $dbconn->Execute('INSERT INTO tabname (idcol, blobcol) ' + . + 'VALUES (\'test\', ' . $blobVarName . ')'); + + instead of loading blob from a file, you can also load from + an unformatted (raw) blob variable: + $dbcon->load_blobvar_from_var($blobVarName, $varName); + + d) drop blob variable on db server to free up resources: + $dbconn->drop_blobvar($blobVarName); + + Sybase_SQLAnywhere data driver. Requires ODBC. + +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-sqlite.inc.php b/drivers/adodb-sqlite.inc.php index 0711f1dd..07fd8b51 100644 --- a/drivers/adodb-sqlite.inc.php +++ b/drivers/adodb-sqlite.inc.php @@ -1,27 +1,21 @@ <?php -/** - * SQLite driver - * - * @link https://www.sqlite.org/ - * - * @deprecated Use SQLite3 driver instead - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Latest version is available at https://adodb.org/ + + SQLite info: http://www.hwaci.com/sw/sqlite/ + + Install Instructions: + ==================== + 1. Place this in adodb/drivers + 2. Rename the file, remove the .txt prefix. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-sqlite3.inc.php b/drivers/adodb-sqlite3.inc.php index 548727d8..85634fdc 100644 --- a/drivers/adodb-sqlite3.inc.php +++ b/drivers/adodb-sqlite3.inc.php @@ -1,29 +1,28 @@ <?php -/** - * SQLite3 driver - * - * @link https://www.sqlite.org/ - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Latest version is available at https://adodb.org/ + + SQLite info: http://www.hwaci.com/sw/sqlite/ + + Install Instructions: + ==================== + 1. Place this in adodb/drivers + 2. Rename the file, remove the .txt prefix. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); +/** + * Class ADODB_sqlite3 + */ class ADODB_sqlite3 extends ADOConnection { var $databaseType = "sqlite3"; var $dataProvider = "sqlite"; @@ -34,10 +33,13 @@ class ADODB_sqlite3 extends ADOConnection { var $hasInsertID = true; /// supports autoincrement ID? var $hasAffectedRows = true; /// supports affected rows for update/delete? var $metaTablesSQL = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"; - var $sysDate = "adodb_date('Y-m-d')"; - var $sysTimeStamp = "adodb_date('Y-m-d H:i:s')"; + var $sysDate = "DATE('now','localtime')"; + var $sysTimeStamp = "DATETIME('now','localtime')"; var $fmtTimeStamp = "'Y-m-d H:i:s'"; + /** @var SQLite3 */ + var $_connectionID; + function ServerInfo() { $version = SQLite3::version(); @@ -51,7 +53,7 @@ class ADODB_sqlite3 extends ADOConnection { if ($this->transOff) { return true; } - $ret = $this->Execute("BEGIN TRANSACTION"); + $this->Execute("BEGIN TRANSACTION"); $this->transCnt += 1; return true; } @@ -95,6 +97,9 @@ class ADODB_sqlite3 extends ADOConnection { $t = strtoupper($t); + if (array_key_exists($t,$this->customActualTypes)) + return $this->customActualTypes[$t]; + /* * We are using the Sqlite affinity method here * @link https://www.sqlite.org/datatype3.html @@ -214,7 +219,7 @@ class ADODB_sqlite3 extends ADOConnection { ) WHERE type != 'meta' AND sql NOTNULL - AND LOWER(name) ='" . strtolower($table) . "'"; + AND LOWER(name) ='" . strtolower($table) . "'"; $tableSql = $this->getOne($sql); @@ -304,8 +309,7 @@ class ADODB_sqlite3 extends ADOConnection { $this->_connectionID->createFunction('adodb_date2', 'adodb_date2', 2); } - - // returns true or false + /** @noinspection PhpUnusedParameterInspection */ function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { if (empty($argHostname) && $argDatabasename) { @@ -317,7 +321,6 @@ class ADODB_sqlite3 extends ADOConnection { return true; } - // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { // There's no permanent connect in SQLite3 @@ -394,7 +397,7 @@ class ADODB_sqlite3 extends ADOConnection { return false; } - function CreateSequence($seqname='adodbseq',$start=1) + function createSequence($seqname='adodbseq', $startID=1) { if (empty($this->_genSeqSQL)) { return false; @@ -403,8 +406,8 @@ class ADODB_sqlite3 extends ADOConnection { if (!$ok) { return false; } - $start -= 1; - return $this->Execute("insert into $seqname values($start)"); + $startID -= 1; + return $this->Execute("insert into $seqname values($startID)"); } var $_dropSeqSQL = 'drop table %s'; @@ -559,14 +562,13 @@ class ADODB_sqlite3 extends ADOConnection { * * This uses the more efficient strftime native function to process * - * @param str $fld The name of the field to process + * @param string $fld The name of the field to process * - * @return str The SQL Statement + * @return string The SQL Statement */ function month($fld) { - $x = "strftime('%m',$fld)"; - return $x; + return "strftime('%m',$fld)"; } /** @@ -574,13 +576,12 @@ class ADODB_sqlite3 extends ADOConnection { * * This uses the more efficient strftime native function to process * - * @param str $fld The name of the field to process + * @param string $fld The name of the field to process * - * @return str The SQL Statement + * @return string The SQL Statement */ function day($fld) { - $x = "strftime('%d',$fld)"; - return $x; + return "strftime('%d',$fld)"; } /** @@ -588,14 +589,116 @@ class ADODB_sqlite3 extends ADOConnection { * * This uses the more efficient strftime native function to process * - * @param str $fld The name of the field to process + * @param string $fld The name of the field to process * - * @return str The SQL Statement + * @return string The SQL Statement */ function year($fld) { - $x = "strftime('%Y',$fld)"; - return $x; + return "strftime('%Y',$fld)"; + } + + /** + * SQLite update for blob + * + * SQLite must be a fully prepared statement (all variables must be bound), + * so $where can either be an array (array params) or a string that we will + * do our best to unpack and turn into a prepared statement. + * + * @param string $table + * @param string $column + * @param string $val Blob value to set + * @param mixed $where An array of parameters (key => value pairs), + * or a string (where clause). + * @param string $blobtype ignored + * + * @return bool success + */ + function updateBlob($table, $column, $val, $where, $blobtype = 'BLOB') + { + if (is_array($where)) { + // We were passed a set of key=>value pairs + $params = $where; + } else { + // Given a where clause string, we have to disassemble the + // statements into keys and values + $params = array(); + $temp = preg_split('/(where|and)/i', $where); + $where = array_filter($temp); + + foreach ($where as $wValue) { + $wTemp = preg_split('/[= \']+/', $wValue); + $wTemp = array_filter($wTemp); + $wTemp = array_values($wTemp); + $params[$wTemp[0]] = $wTemp[1]; + } + } + + $paramWhere = array(); + foreach ($params as $bindKey => $bindValue) { + $paramWhere[] = $bindKey . '=?'; + } + + $sql = "UPDATE $table SET $column=? WHERE " + . implode(' AND ', $paramWhere); + + // Prepare the statement + $stmt = $this->_connectionID->prepare($sql); + + // Set the first bind value equal to value we want to update + if (!$stmt->bindValue(1, $val, SQLITE3_BLOB)) { + return false; + } + + // Build as many keys as available + $bindIndex = 2; + foreach ($params as $bindValue) { + if (is_integer($bindValue) || is_bool($bindValue) || is_float($bindValue)) { + $type = SQLITE3_NUM; + } elseif (is_object($bindValue)) { + // Assume a blob, this should never appear in + // the binding for a where statement anyway + $type = SQLITE3_BLOB; + } else { + $type = SQLITE3_TEXT; + } + + if (!$stmt->bindValue($bindIndex, $bindValue, $type)) { + return false; + } + + $bindIndex++; + } + + // Now execute the update. NB this is SQLite execute, not ADOdb + $ok = $stmt->execute(); + return is_object($ok); + } + + /** + * SQLite update for blob from a file + * + * @param string $table + * @param string $column + * @param string $path Filename containing blob data + * @param mixed $where {@see updateBlob()} + * @param string $blobtype ignored + * + * @return bool success + */ + function updateBlobFile($table, $column, $path, $where, $blobtype = 'BLOB') + { + if (!file_exists($path)) { + return false; + } + + // Read file information + $fileContents = file_get_contents($path); + if ($fileContents === false) + // Distinguish between an empty file and failure + return false; + + return $this->updateBlob($table, $column, $fileContents, $where, $blobtype); } } @@ -609,9 +712,12 @@ class ADORecordset_sqlite3 extends ADORecordSet { var $databaseType = "sqlite3"; var $bind = false; + /** @var SQLite3Result */ + var $_queryID; + + /** @noinspection PhpMissingParentConstructorInspection */ function __construct($queryID,$mode=false) { - if ($mode === false) { global $ADODB_FETCH_MODE; $mode = $ADODB_FETCH_MODE; @@ -697,4 +803,4 @@ class ADORecordset_sqlite3 extends ADORecordSet { { } -} +}
\ No newline at end of file diff --git a/drivers/adodb-sqlitepo.inc.php b/drivers/adodb-sqlitepo.inc.php index cb69ff9e..b804ac4a 100644 --- a/drivers/adodb-sqlitepo.inc.php +++ b/drivers/adodb-sqlitepo.inc.php @@ -1,31 +1,23 @@ <?php -/** - * SQLite Portable driver. - * - * Make it more similar to other database drivers. The main differences are - * - When selecting (joining) multiple tables, in assoc mode the table - * names are included in the assoc keys in the "sqlite" driver. - * In "sqlitepo" driver, the table names are stripped from the returned - * column names. When this results in a conflict, the first field gets - * preference. - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author Herman Kuiper <herman@ozuzo.net> - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Portable version of sqlite driver, to make it more similar to other database drivers. + The main differences are + + 1. When selecting (joining) multiple tables, in assoc mode the table + names are included in the assoc keys in the "sqlite" driver. + + In "sqlitepo" driver, the table names are stripped from the returned column names. + When this results in a conflict, the first field get preference. + + Contributed by Herman Kuiper herman#ozuzo.net +*/ if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-sybase.inc.php b/drivers/adodb-sybase.inc.php index b8db0747..c34c8a8e 100644 --- a/drivers/adodb-sybase.inc.php +++ b/drivers/adodb-sybase.inc.php @@ -1,24 +1,21 @@ <?php -/** - * Sybase driver - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author Toni Tunkkari <toni.tunkkari@finebyte.com> - */ +/* +@version v5.22.0-dev Unreleased +@copyright (c) 2000-2013 John Lim. All rights reserved. +@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Sybase driver contributed by Toni (toni.tunkkari@finebyte.com) + + - MSSQL date patch applied. + + Date patch by Toni 15 Feb 2002 +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-sybase_ase.inc.php b/drivers/adodb-sybase_ase.inc.php index d301ba99..90ca74e8 100644 --- a/drivers/adodb-sybase_ase.inc.php +++ b/drivers/adodb-sybase_ase.inc.php @@ -1,24 +1,17 @@ <?php -/** - * SAP Adaptive Server Enterprise driver (formerly Sybase ASE) - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - * @author Cristian Marin, Interakt Online <cristic@interaktonline.com> - */ +/* + @version v5.22.0-dev Unreleased + @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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4. + + Contributed by Interakt Online. Thx Cristian MARIN cristic#interaktonline.com +*/ + require_once ADODB_DIR."/drivers/adodb-sybase.inc.php"; diff --git a/drivers/adodb-text.inc.php b/drivers/adodb-text.inc.php index 77ad06a0..4c99f31b 100644 --- a/drivers/adodb-text.inc.php +++ b/drivers/adodb-text.inc.php @@ -1,25 +1,63 @@ <?php -/** - * ADOdb Plain Text driver - * - * @deprecated - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved. +@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community + Set tabs to 4. +*/ + +/* +Setup: + + $db = NewADOConnection('text'); + $db->Connect($array,[$types],[$colnames]); + + Parameter $array is the 2 dimensional array of data. The first row can contain the + column names. If column names is not defined in first row, you MUST define $colnames, + the 3rd parameter. + + Parameter $types is optional. If defined, it should contain an array matching + the number of columns in $array, with each element matching the correct type defined + by MetaType: (B,C,I,L,N). If undefined, we will probe for $this->_proberows rows + to guess the type. Only C,I and N are recognised. + + Parameter $colnames is optional. If defined, it is an array that contains the + column names of $array. If undefined, we assume the first row of $array holds the + column names. + + The Execute() function will return a recordset. The recordset works like a normal recordset. + We have partial support for SQL parsing. We process the SQL using the following rules: + + 1. SQL order by's always work for the first column ordered. Subsequent cols are ignored + + 2. All operations take place on the same table. No joins possible. In fact the FROM clause + is ignored! You can use any name for the table. + + 3. To simplify code, all columns are returned, except when selecting 1 column + + $rs = $db->Execute('select col1,col2 from table'); // sql ignored, will generate all cols + + We special case handling of 1 column because it is used in filter popups + + $rs = $db->Execute('select col1 from table'); + // sql accepted and processed -- any table name is accepted + + $rs = $db->Execute('select distinct col1 from table'); + // sql accepted and processed + +4. Where clauses are ignored, but searching with the 3rd parameter of Execute is permitted. + This has to use PHP syntax and we will eval() it. You can even use PHP functions. + + $rs = $db->Execute('select * from table',false,"\$COL1='abc' and $\COL2=3") + // the 3rd param is searched -- make sure that $COL1 is a legal column name + // and all column names must be in upper case. + +4. Group by, having, other clauses are ignored + +5. Expression columns, min(), max() are ignored + +6. All data is readonly. Only SELECTs permitted. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); diff --git a/drivers/adodb-vfp.inc.php b/drivers/adodb-vfp.inc.php index bb435168..5890aeac 100644 --- a/drivers/adodb-vfp.inc.php +++ b/drivers/adodb-vfp.inc.php @@ -1,25 +1,17 @@ <?php -/** - * Microsoft Visual FoxPro driver - * - * @deprecated - * - * This file is part of ADOdb, a Database Abstraction Layer library for PHP. - * - * @package ADOdb - * @link https://adodb.org Project's web site and documentation - * @link https://github.com/ADOdb/ADOdb Source code and issue tracker - * - * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause - * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, - * any later version. This means you can use it in proprietary products. - * See the LICENSE.md file distributed with this source code for details. - * @license BSD-3-Clause - * @license LGPL-2.1-or-later - * - * @copyright 2000-2013 John Lim - * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community - */ +/* +@version v5.22.0-dev Unreleased +@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. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. +Set tabs to 4 for best viewing. + + Latest version is available at https://adodb.org/ + + Microsoft Visual FoxPro data driver. Requires ODBC. Works only on MS Windows. +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); |
