[!!!][TASK] Doctrine: Remove ext:adodb 30/49730/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Thu, 1 Sep 2016 18:14:15 +0000 (20:14 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 1 Sep 2016 21:44:26 +0000 (23:44 +0200)
Extension adodb has been moved to TER and can be
loaded with an upgrade wizard provided by the
ext:dbal removal patch.

Change-Id: I4b6cef864ef368059b49097abefd21e2175b99c2
Resolves: #77761
Releases: master
Reviewed-on: https://review.typo3.org/49730
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
168 files changed:
Build/.php_cs
composer.json
composer.lock
typo3/sysext/adodb/Documentation/Index.rst [deleted file]
typo3/sysext/adodb/adodb/.mailmap [deleted file]
typo3/sysext/adodb/adodb/LICENSE.md [deleted file]
typo3/sysext/adodb/adodb/README.md [deleted file]
typo3/sysext/adodb/adodb/adodb-active-record.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-active-recordx.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-csvlib.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-datadict.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-error.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-errorhandler.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-errorpear.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-exceptions.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-iterator.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-lib.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-memcache.lib.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-pager.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-pear.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-perf.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-php4.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-time.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-xmlschema.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb-xmlschema03.inc.php [deleted file]
typo3/sysext/adodb/adodb/adodb.inc.php [deleted file]
typo3/sysext/adodb/adodb/composer.json [deleted file]
typo3/sysext/adodb/adodb/contrib/toxmlrpc.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-access.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-db2.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-firebird.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-generic.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-ibase.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-informix.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-mssql.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-mssqlnative.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-mysql.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-oci8.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-postgres.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-sapdb.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-sqlite.inc.php [deleted file]
typo3/sysext/adodb/adodb/datadict/datadict-sybase.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-access.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-ado.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-ado5.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-ado_access.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-ado_mssql.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-ads.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-borland_ibase.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-csv.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-db2.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-db2oci.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-db2ora.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-fbsql.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-firebird.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-ibase.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-informix.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-informix72.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-ldap.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-mssql.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-mssql_n.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-mssqlnative.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-mssqlpo.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-mysql.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-mysqli.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-mysqlpo.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-mysqlt.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-netezza.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-oci8.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-oci805.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-oci8po.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-oci8quercus.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-odbc.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-odbc_db2.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-odbc_mssql.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-odbc_oracle.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-odbtp.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-odbtp_unicode.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-oracle.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-pdo.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-pdo_mssql.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-pdo_mysql.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-pdo_oci.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-pdo_pgsql.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-pdo_sqlite.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-pdo_sqlsrv.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-postgres.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-postgres64.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-postgres7.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-postgres8.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-postgres9.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-proxy.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-sapdb.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-sqlanywhere.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-sqlite.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-sqlite3.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-sqlitepo.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-sybase.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-sybase_ase.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-text.inc.php [deleted file]
typo3/sysext/adodb/adodb/drivers/adodb-vfp.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-ar.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-bg.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-ca.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-cn.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-cz.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-da.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-de.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-en.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-eo.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-es.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-fa.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-fr.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-hu.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-it.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-nl.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-pl.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-pt-br.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-ro.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-ru.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-sv.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-th.inc.php [deleted file]
typo3/sysext/adodb/adodb/lang/adodb-uk.inc.php [deleted file]
typo3/sysext/adodb/adodb/pear/Auth/Container/ADOdb.php [deleted file]
typo3/sysext/adodb/adodb/pear/auth_adodb_example.php [deleted file]
typo3/sysext/adodb/adodb/pear/readme.Auth.txt [deleted file]
typo3/sysext/adodb/adodb/perf/perf-db2.inc.php [deleted file]
typo3/sysext/adodb/adodb/perf/perf-informix.inc.php [deleted file]
typo3/sysext/adodb/adodb/perf/perf-mssql.inc.php [deleted file]
typo3/sysext/adodb/adodb/perf/perf-mssqlnative.inc.php [deleted file]
typo3/sysext/adodb/adodb/perf/perf-mysql.inc.php [deleted file]
typo3/sysext/adodb/adodb/perf/perf-oci8.inc.php [deleted file]
typo3/sysext/adodb/adodb/perf/perf-postgres.inc.php [deleted file]
typo3/sysext/adodb/adodb/pivottable.inc.php [deleted file]
typo3/sysext/adodb/adodb/rsfilter.inc.php [deleted file]
typo3/sysext/adodb/adodb/server.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-compress-bzip2.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-compress-gzip.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-cryptsession.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-cryptsession2.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-encrypt-mcrypt.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-encrypt-md5.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-encrypt-secret.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-encrypt-sha1.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-sess.txt [deleted file]
typo3/sysext/adodb/adodb/session/adodb-session-clob.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-session-clob2.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-session.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-session2.php [deleted file]
typo3/sysext/adodb/adodb/session/adodb-sessions.mysql.sql [deleted file]
typo3/sysext/adodb/adodb/session/adodb-sessions.oracle.clob.sql [deleted file]
typo3/sysext/adodb/adodb/session/adodb-sessions.oracle.sql [deleted file]
typo3/sysext/adodb/adodb/session/crypt.inc.php [deleted file]
typo3/sysext/adodb/adodb/session/session_schema.xml [deleted file]
typo3/sysext/adodb/adodb/session/session_schema2.xml [deleted file]
typo3/sysext/adodb/adodb/toexport.inc.php [deleted file]
typo3/sysext/adodb/adodb/tohtml.inc.php [deleted file]
typo3/sysext/adodb/adodb/xmlschema.dtd [deleted file]
typo3/sysext/adodb/adodb/xmlschema03.dtd [deleted file]
typo3/sysext/adodb/adodb/xsl/convert-0.1-0.2.xsl [deleted file]
typo3/sysext/adodb/adodb/xsl/convert-0.1-0.3.xsl [deleted file]
typo3/sysext/adodb/adodb/xsl/convert-0.2-0.1.xsl [deleted file]
typo3/sysext/adodb/adodb/xsl/convert-0.2-0.3.xsl [deleted file]
typo3/sysext/adodb/adodb/xsl/remove-0.2.xsl [deleted file]
typo3/sysext/adodb/adodb/xsl/remove-0.3.xsl [deleted file]
typo3/sysext/adodb/composer.json [deleted file]
typo3/sysext/adodb/ext_emconf.php [deleted file]
typo3/sysext/adodb/ext_icon.png [deleted file]

index 9e65f73..3727da0 100644 (file)
@@ -39,7 +39,6 @@ $finder = Symfony\CS\Finder\DefaultFinder::create()
     ->exclude('vendor')
     ->exclude('typo3conf')
     ->exclude('typo3temp')
-    ->exclude('adodb')
     ->in(__DIR__ . '/../');
 
 // Return a Code Sniffing configuration using
index ffa58dc..c9a1c59 100644 (file)
@@ -82,7 +82,6 @@
        },
        "replace": {
                "typo3/cms-about": "self.version",
-               "typo3/cms-adodb": "self.version",
                "typo3/cms-backend": "self.version",
                "typo3/cms-belog": "self.version",
                "typo3/cms-beuser": "self.version",
index 663ed72..edce742 100644 (file)
@@ -4,8 +4,8 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "eee83d589f64ac1a4a248ca86847381b",
-    "content-hash": "b8a638b8c136516c6ca50bf2636bd151",
+    "hash": "4483853e6b688a421f48269921f96aa8",
+    "content-hash": "7b098907dd66091a10a131670c980bc0",
     "packages": [
         {
             "name": "cogpowered/finediff",
diff --git a/typo3/sysext/adodb/Documentation/Index.rst b/typo3/sysext/adodb/Documentation/Index.rst
deleted file mode 100644 (file)
index a3bae0d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-=============================================
-Changes made in EXT:adodb missing in upstream
-=============================================
-
-Now in use
-==========
-The currently used ADOdb version is 5.19 [1]_.
-
-.. [1] https://github.com/ADOdb/ADOdb/releases/tag/v5.19
-
-
-Our changes
-===========
-
-This is a list of changes we made in ADOdb that must re-applied if EXT:adodb is
-updated to upstream.
-
-- ADOdb: Invalid override method signature (48034_) (Solved in 5.20-dev [2]_)
-- ADOdb: Set charset properly (61738_)
-- EXT:adodb: Table names in ALTER TABLE broken (63659_)
-- MSSQL native driver for ADOdb returns erroneous message (66674_)
-- ADOdb: mssqlnative driver fails to create sequences (66678_)
-- ADOdb: mssqlnative driver is not properly initialized (66830_)
-- ADOdb: mssqlnative driver does not properly define the port (63070_)
-- ADOdb: Allow setting NOT NULL/DEFAULT on blob and text columns (67442_) (Upstream pull request: [3]_)
-- ADOdb: Table names in sequences broken (64990_)
-- ADOdb: PHP7 redefinition of parameter (71244_)
-- Security: XML entity expansion (61269_)
-
-.. [2] https://github.com/ADOdb/ADOdb/commit/85f05a98974ea85ecae943faf230a27afdbaa746
-.. [3] https://github.com/ADOdb/ADOdb/pull/118
-.. _48034: https://forge.typo3.org/issues/48034
-.. _61738: https://forge.typo3.org/issues/61738
-.. _63659: https://forge.typo3.org/issues/63659
-.. _66674: https://forge.typo3.org/issues/66674
-.. _66678: https://forge.typo3.org/issues/66678
-.. _66830: https://forge.typo3.org/issues/66830
-.. _63070: https://forge.typo3.org/issues/63070
-.. _67442: https://forge.typo3.org/issues/67442
-.. _64990: https://forge.typo3.org/issues/64990
-.. _71244: https://forge.typo3.org/issues/71244
-.. _61269: https://forge.typo3.org/issues/61269
-
-
-Diff
-====
-
-You'll find a diff file in EXT:adodb/Documentation/typo3-adodb.diff.
-
diff --git a/typo3/sysext/adodb/adodb/.mailmap b/typo3/sysext/adodb/adodb/.mailmap
deleted file mode 100644 (file)
index 1f2f7e7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-Andreas Fernandez <a.fernandez@scripting-base.de> <andreas.fernandez@aspedia.de>
-Mike Benoit <mikeb@timetrex.com> MikeB <ipso@snappymail.ca>
-Mike Benoit <mikeb@timetrex.com> mike.benoit
-
diff --git a/typo3/sysext/adodb/adodb/LICENSE.md b/typo3/sysext/adodb/adodb/LICENSE.md
deleted file mode 100644 (file)
index b819158..0000000
+++ /dev/null
@@ -1,496 +0,0 @@
-ADOdb License
-=============
-
-ADOdb is dual licensed under BSD and LGPL.
-
-In plain English, you do not need to distribute your application in source code form,
-nor do you need to distribute ADOdb source code, provided you follow the rest of
-terms of the BSD license.
-
-For more info about ADOdb, visit http://adodb.sourceforge.net/
-
-BSD 3-Clause License
---------------------
-
-(c) 2000-2013 John Lim (jlim@natsoft.com)
-(c) 2014      Damien Regad, Mark Newnham and the ADOdb community
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
-   list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
-   this list of conditions and the following disclaimer in the documentation
-   and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holder nor the names of its contributors
-   may be used to endorse or promote products derived from this software without
-   specific prior written permission.
-
-### DISCLAIMER
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-GNU LESSER GENERAL PUBLIC LICENSE
----------------------------------
-
-_Version 2.1, February 1999_
-_Copyright © 1991, 1999 Free Software Foundation, Inc._
-_51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA_
-
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-_This is the first released version of the Lesser GPL.  It also counts
-as the successor of the GNU Library Public License, version 2, hence
-the version number 2.1._
-
-### Preamble
-
-The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-We protect your rights with a two-step method: **(1)** we copyright the
-library, and **(2)** we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
-Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-We call this license the “Lesser” General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-“work based on the library” and a “work that uses the library”.  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
-### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-**0.** This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called “this License”).
-Each licensee is addressed as “you”.
-
-A “library” means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-The “Library”, below, refers to any such software library or work
-which has been distributed under these terms.  A “work based on the
-Library” means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term “modification”.)
-
-“Source code” for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
-**1.** You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-**2.** You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-* **a)** The modified work must itself be a software library.
-* **b)** You must cause the files modified to carry prominent notices
-stating that you changed the files and the date of any change.
-* **c)** You must cause the whole of the work to be licensed at no
-charge to all third parties under the terms of this License.
-* **d)** If a facility in the modified Library refers to a function or a
-table of data to be supplied by an application program that uses
-the facility, other than as an argument passed when the facility
-is invoked, then you must make a good faith effort to ensure that,
-in the event an application does not supply such function or
-table, the facility still operates, and performs whatever part of
-its purpose remains meaningful.
-(For example, a function in a library to compute square roots has
-a purpose that is entirely well-defined independent of the
-application.  Therefore, Subsection 2d requires that any
-application-supplied function or table used by this function must
-be optional: if the application does not supply it, the square
-root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-**3.** You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-**4.** You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-**5.** A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a “work that uses the Library”.  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-However, linking a “work that uses the Library” with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a “work that uses the
-library”.  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-When a “work that uses the Library” uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-**6.** As an exception to the Sections above, you may also combine or
-link a “work that uses the Library” with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-* **a)** Accompany the work with the complete corresponding
-machine-readable source code for the Library including whatever
-changes were used in the work (which must be distributed under
-Sections 1 and 2 above); and, if the work is an executable linked
-with the Library, with the complete machine-readable “work that
-uses the Library”, as object code and/or source code, so that the
-user can modify the Library and then relink to produce a modified
-executable containing the modified Library.  (It is understood
-that the user who changes the contents of definitions files in the
-Library will not necessarily be able to recompile the application
-to use the modified definitions.)
-* **b)** Use a suitable shared library mechanism for linking with the
-Library.  A suitable mechanism is one that (1) uses at run time a
-copy of the library already present on the user's computer system,
-rather than copying library functions into the executable, and (2)
-will operate properly with a modified version of the library, if
-the user installs one, as long as the modified version is
-interface-compatible with the version that the work was made with.
-* **c)** Accompany the work with a written offer, valid for at
-least three years, to give the same user the materials
-specified in Subsection 6a, above, for a charge no more
-than the cost of performing this distribution.
-* **d)** If distribution of the work is made by offering access to copy
-from a designated place, offer equivalent access to copy the above
-specified materials from the same place.
-* **e)** Verify that the user has already received a copy of these
-materials or that you have already sent this user a copy.
-
-For an executable, the required form of the “work that uses the
-Library” must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-**7.** You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-* **a)** Accompany the combined library with a copy of the same work
-based on the Library, uncombined with any other library
-facilities.  This must be distributed under the terms of the
-Sections above.
-* **b)** Give prominent notice with the combined library of the fact
-that part of it is a work based on the Library, and explaining
-where to find the accompanying uncombined form of the same work.
-
-**8.** You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-**9.** You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-**10.** Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
-**11.** If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-**12.** If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-**13.** The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-“any later version”, you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-**14.** If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-### NO WARRANTY
-
-**15.** BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY “AS IS” WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-**16.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-_END OF TERMS AND CONDITIONS_
diff --git a/typo3/sysext/adodb/adodb/README.md b/typo3/sysext/adodb/adodb/README.md
deleted file mode 100644 (file)
index 32deebe..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-ADOdb Library for PHP5
-======================
-
-[![Join chat on Gitter](https://img.shields.io/gitter/room/form-data/form-data.svg)](https://gitter.im/adodb/adodb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
-(c) 2000-2013 John Lim (jlim@natsoft.com)  
-(c) 2014      Damien Regad, Mark Newnham and the ADOdb community
-
-Released under both [BSD 3-Clause](https://github.com/ADOdb/ADOdb/blob/master/LICENSE.md#bsd-3-clause-license) 
-and [GNU Lesser GPL library 2.1](https://github.com/ADOdb/ADOdb/blob/master/LICENSE.md#gnu-lesser-general-public-license) 
-licenses.  
-This means you can use it in proprietary products; 
-see [License](https://github.com/ADOdb/ADOdb/blob/master/LICENSE.md) for details.
-
-Home page: http://adodb.sourceforge.net/
-
-> **WARNING: known issue with Associative Fetch Mode in ADOdb v5.19
--- PLEASE UPGRADE TO v5.20 !**  
-> When fetching data in Associative mode (i.e. when `$ADODB_FETCH_MODE` is
-> set to *ADODB_FETCH_ASSOC*), recordsets do not return any data (empty strings)
-> when using some database drivers. The problem has been reported on MSSQL,
-> Interbase and Foxpro, but possibly affects other drivers as well; all drivers
-> derived from the above are also impacted.
-> For further details, please refer to [Issue #20](https://github.com/ADOdb/ADOdb/issues/20).
-
-
-Introduction
-============
-
-PHP's database access functions are not standardized. This creates a
-need for a database class library to hide the differences between the
-different databases (encapsulate the differences) so we can easily
-switch databases.
-
-The library currently supports MySQL, Interbase, Sybase, PostgreSQL, Oracle,
-Microsoft SQL server,  Foxpro ODBC, Access ODBC, Informix, DB2,
-Sybase SQL Anywhere, generic ODBC and Microsoft's ADO.
-
-We hope more people will contribute drivers to support other databases.
-
-
-Installation
-============
-
-Unpack all the files into a directory accessible by your web server.
-
-To test, try modifying some of the tutorial examples.
-Make sure you customize the connection settings correctly.
-
-You can debug using:
-
-``` php
-<?php
-include('adodb/adodb.inc.php');
-
-$db = ADONewConnection($driver); # eg. 'mysql' or 'oci8'
-$db->debug = true;
-$db->Connect($server, $user, $password, $database);
-$rs = $db->Execute('select * from some_small_table');
-print "<pre>";
-print_r($rs->GetRows());
-print "</pre>";
-```
-
-
-Documentation and Examples
-==========================
-
-Refer to the `docs` directory for library documentation and examples.
-
-- Main documentation: `docs-adodb.htm`.
-  Query, update and insert records using a portable API.
-- Data dictionary docs: `docs-datadict.htm`.
-  Describes how to create database tables and indexes in a portable manner.
-- Database performance monitoring docs: `docs-perf.htm`.
-  Allows you to perform health checks, tune and monitor your database.
-- Database-backed session docs: `docs-session.htm`.
-
-There is also a tutorial `tute.htm` that contrasts ADOdb code with
-mysql code.
-
-
-Files
-=====
-
-- `adodb.inc.php` is the library's main file. You only need to include this file.
-- `adodb-*.inc.php` are the database specific driver code.
-- `adodb-session.php` is the PHP4 session handling code.
-- `test.php` contains a list of test commands to exercise the class library.
-- `testdatabases.inc.php` contains the list of databases to apply the tests on.
-- `Benchmark.php` is a simple benchmark to test the throughput of a SELECT
-statement for databases described in testdatabases.inc.php. The benchmark
-tables are created in test.php.
-
-
-Support
-=======
-
-To discuss with the ADOdb development team and users, connect to our
-[Gitter chatroom](https://gitter.im/adodb/adodb) using your Github credentials.
-
-Please report bugs, issues and feature requests on Github:
-
-https://github.com/ADOdb/ADOdb/issues
-
-You may also find legacy issues in
-
-- the old [ADOdb forums](http://phplens.com/lens/lensforum/topics.php?id=4) on phplens.com
-- the [SourceForge tickets section](http://sourceforge.net/p/adodb/_list/tickets)
-
-However, please note that they are not actively monitored and should
-only be used as reference.
diff --git a/typo3/sysext/adodb/adodb/adodb-active-record.inc.php b/typo3/sysext/adodb/adodb/adodb-active-record.inc.php
deleted file mode 100644 (file)
index 2c4b878..0000000
+++ /dev/null
@@ -1,1142 +0,0 @@
-<?php
-/*
-
-@version   v5.20.3  01-Jan-2016
-@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
-@copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
-  Latest version is available at http://adodb.sourceforge.net
-
-  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.
-
-  Active Record implementation. Superset of Zend Framework's.
-
-  Version 0.92
-
-  See http://www-128.ibm.com/developerworks/java/library/j-cb03076/?ca=dgr-lnxw01ActiveRecord
-       for info on Ruby on Rails Active Record implementation
-*/
-
-
-global $_ADODB_ACTIVE_DBS;
-global $ADODB_ACTIVE_CACHESECS; // set to true to enable caching of metadata such as field info
-global $ACTIVE_RECORD_SAFETY; // set to false to disable safety checks
-global $ADODB_ACTIVE_DEFVALS; // use default values of table definition when creating new active record.
-
-// array of ADODB_Active_DB's, indexed by ADODB_Active_Record->_dbat
-$_ADODB_ACTIVE_DBS = array();
-$ACTIVE_RECORD_SAFETY = true;
-$ADODB_ACTIVE_DEFVALS = false;
-$ADODB_ACTIVE_CACHESECS = 0;
-
-class ADODB_Active_DB {
-       var $db; // ADOConnection
-       var $tables; // assoc array of ADODB_Active_Table objects, indexed by tablename
-}
-
-class ADODB_Active_Table {
-       var $name; // table name
-       var $flds; // assoc array of adofieldobjs, indexed by fieldname
-       var $keys; // assoc array of primary keys, indexed by fieldname
-       var $_created; // only used when stored as a cached file
-       var $_belongsTo = array();
-       var $_hasMany = array();
-}
-
-// $db = database connection
-// $index = name of index - can be associative, for an example see
-//    http://phplens.com/lens/lensforum/msgs.php?id=17790
-// returns index into $_ADODB_ACTIVE_DBS
-function ADODB_SetDatabaseAdapter(&$db, $index=false)
-{
-       global $_ADODB_ACTIVE_DBS;
-
-               foreach($_ADODB_ACTIVE_DBS as $k => $d) {
-                       if (PHP_VERSION >= 5) {
-                               if ($d->db === $db) {
-                                       return $k;
-                               }
-                       } else {
-                               if ($d->db->_connectionID === $db->_connectionID && $db->database == $d->db->database) {
-                                       return $k;
-                               }
-                       }
-               }
-
-               $obj = new ADODB_Active_DB();
-               $obj->db = $db;
-               $obj->tables = array();
-
-               if ($index == false) {
-                       $index = sizeof($_ADODB_ACTIVE_DBS);
-               }
-
-               $_ADODB_ACTIVE_DBS[$index] = $obj;
-
-               return sizeof($_ADODB_ACTIVE_DBS)-1;
-}
-
-
-class ADODB_Active_Record {
-       static $_changeNames = true; // dynamically pluralize table names
-       static $_quoteNames = false;
-
-       static $_foreignSuffix = '_id'; //
-       var $_dbat; // associative index pointing to ADODB_Active_DB eg. $ADODB_Active_DBS[_dbat]
-       var $_table; // tablename, if set in class definition then use it as table name
-       var $_tableat; // associative index pointing to ADODB_Active_Table, eg $ADODB_Active_DBS[_dbat]->tables[$this->_tableat]
-       var $_where; // where clause set in Load()
-       var $_saved = false; // indicates whether data is already inserted.
-       var $_lasterr = false; // last error message
-       var $_original = false; // the original values loaded or inserted, refreshed on update
-
-       var $foreignName; // CFR: class name when in a relationship
-
-       var $lockMode = ' for update '; // you might want to change to
-
-       static function UseDefaultValues($bool=null)
-       {
-       global $ADODB_ACTIVE_DEFVALS;
-               if (isset($bool)) {
-                       $ADODB_ACTIVE_DEFVALS = $bool;
-               }
-               return $ADODB_ACTIVE_DEFVALS;
-       }
-
-       // should be static
-       static function SetDatabaseAdapter(&$db, $index=false)
-       {
-               return ADODB_SetDatabaseAdapter($db, $index);
-       }
-
-
-       public function __set($name, $value)
-       {
-               $name = str_replace(' ', '_', $name);
-               $this->$name = $value;
-       }
-
-       // php5 constructor
-       function __construct($table = false, $pkeyarr=false, $db=false)
-       {
-       global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS;
-
-               if ($db == false && is_object($pkeyarr)) {
-                       $db = $pkeyarr;
-                       $pkeyarr = false;
-               }
-
-               if (!$table) {
-                       if (!empty($this->_table)) {
-                               $table = $this->_table;
-                       }
-                       else $table = $this->_pluralize(get_class($this));
-               }
-               $this->foreignName = strtolower(get_class($this)); // CFR: default foreign name
-               if ($db) {
-                       $this->_dbat = ADODB_Active_Record::SetDatabaseAdapter($db);
-               } else if (!isset($this->_dbat)) {
-                       if (sizeof($_ADODB_ACTIVE_DBS) == 0) {
-                               $this->Error(
-                                       "No database connection set; use ADOdb_Active_Record::SetDatabaseAdapter(\$db)",
-                                       'ADODB_Active_Record::__constructor'
-                               );
-                       }
-                       end($_ADODB_ACTIVE_DBS);
-                       $this->_dbat = key($_ADODB_ACTIVE_DBS);
-               }
-
-               $this->_table = $table;
-               $this->_tableat = $table; # reserved for setting the assoc value to a non-table name, eg. the sql string in future
-
-               $this->UpdateActiveTable($pkeyarr);
-       }
-
-       function __wakeup()
-       {
-               $class = get_class($this);
-               new $class;
-       }
-
-       function _pluralize($table)
-       {
-               if (!ADODB_Active_Record::$_changeNames) {
-                       return $table;
-               }
-
-               $ut = strtoupper($table);
-               $len = strlen($table);
-               $lastc = $ut[$len-1];
-               $lastc2 = substr($ut,$len-2);
-               switch ($lastc) {
-               case 'S':
-                       return $table.'es';
-               case 'Y':
-                       return substr($table,0,$len-1).'ies';
-               case 'X':
-                       return $table.'es';
-               case 'H':
-                       if ($lastc2 == 'CH' || $lastc2 == 'SH') {
-                               return $table.'es';
-                       }
-               default:
-                       return $table.'s';
-               }
-       }
-
-       // CFR Lamest singular inflector ever - @todo Make it real!
-       // Note: There is an assumption here...and it is that the argument's length >= 4
-       function _singularize($tables)
-       {
-
-               if (!ADODB_Active_Record::$_changeNames) {
-                       return $table;
-               }
-
-               $ut = strtoupper($tables);
-               $len = strlen($tables);
-               if($ut[$len-1] != 'S') {
-                       return $tables; // I know...forget oxen
-               }
-               if($ut[$len-2] != 'E') {
-                       return substr($tables, 0, $len-1);
-               }
-               switch($ut[$len-3]) {
-                       case 'S':
-                       case 'X':
-                               return substr($tables, 0, $len-2);
-                       case 'I':
-                               return substr($tables, 0, $len-3) . 'y';
-                       case 'H';
-                               if($ut[$len-4] == 'C' || $ut[$len-4] == 'S') {
-                                       return substr($tables, 0, $len-2);
-                               }
-                       default:
-                               return substr($tables, 0, $len-1); // ?
-               }
-       }
-
-       function hasMany($foreignRef, $foreignKey = false, $foreignClass = 'ADODB_Active_Record')
-       {
-               $ar = new $foreignClass($foreignRef);
-               $ar->foreignName = $foreignRef;
-               $ar->UpdateActiveTable();
-               $ar->foreignKey = ($foreignKey) ? $foreignKey : $foreignRef.ADODB_Active_Record::$_foreignSuffix;
-               $table =& $this->TableInfo();
-               $table->_hasMany[$foreignRef] = $ar;
-       #       $this->$foreignRef = $this->_hasMany[$foreignRef]; // WATCHME Removed assignment by ref. to please __get()
-       }
-
-       // use when you don't want ADOdb to auto-pluralize tablename
-       static function TableHasMany($table, $foreignRef, $foreignKey = false, $foreignClass = 'ADODB_Active_Record')
-       {
-               $ar = new ADODB_Active_Record($table);
-               $ar->hasMany($foreignRef, $foreignKey, $foreignClass);
-       }
-
-       // use when you don't want ADOdb to auto-pluralize tablename
-       static function TableKeyHasMany($table, $tablePKey, $foreignRef, $foreignKey = false, $foreignClass = 'ADODB_Active_Record')
-       {
-               if (!is_array($tablePKey)) {
-                       $tablePKey = array($tablePKey);
-               }
-               $ar = new ADODB_Active_Record($table,$tablePKey);
-               $ar->hasMany($foreignRef, $foreignKey, $foreignClass);
-       }
-
-
-       // use when you want ADOdb to auto-pluralize tablename for you. Note that the class must already be defined.
-       // e.g. class Person will generate relationship for table Persons
-       static function ClassHasMany($parentclass, $foreignRef, $foreignKey = false, $foreignClass = 'ADODB_Active_Record')
-       {
-               $ar = new $parentclass();
-               $ar->hasMany($foreignRef, $foreignKey, $foreignClass);
-       }
-
-
-       function belongsTo($foreignRef,$foreignKey=false, $parentKey='', $parentClass = 'ADODB_Active_Record')
-       {
-               global $inflector;
-
-               $ar = new $parentClass($this->_pluralize($foreignRef));
-               $ar->foreignName = $foreignRef;
-               $ar->parentKey = $parentKey;
-               $ar->UpdateActiveTable();
-               $ar->foreignKey = ($foreignKey) ? $foreignKey : $foreignRef.ADODB_Active_Record::$_foreignSuffix;
-
-               $table =& $this->TableInfo();
-               $table->_belongsTo[$foreignRef] = $ar;
-       #       $this->$foreignRef = $this->_belongsTo[$foreignRef];
-       }
-
-       static function ClassBelongsTo($class, $foreignRef, $foreignKey=false, $parentKey='', $parentClass = 'ADODB_Active_Record')
-       {
-               $ar = new $class();
-               $ar->belongsTo($foreignRef, $foreignKey, $parentKey, $parentClass);
-       }
-
-       static function TableBelongsTo($table, $foreignRef, $foreignKey=false, $parentKey='', $parentClass = 'ADODB_Active_Record')
-       {
-               $ar = new ADOdb_Active_Record($table);
-               $ar->belongsTo($foreignRef, $foreignKey, $parentKey, $parentClass);
-       }
-
-       static function TableKeyBelongsTo($table, $tablePKey, $foreignRef, $foreignKey=false, $parentKey='', $parentClass = 'ADODB_Active_Record')
-       {
-               if (!is_array($tablePKey)) {
-                       $tablePKey = array($tablePKey);
-               }
-               $ar = new ADOdb_Active_Record($table, $tablePKey);
-               $ar->belongsTo($foreignRef, $foreignKey, $parentKey, $parentClass);
-       }
-
-
-       /**
-        * __get Access properties - used for lazy loading
-        *
-        * @param mixed $name
-        * @access protected
-        * @return mixed
-        */
-        function __get($name)
-       {
-               return $this->LoadRelations($name, '', -1, -1);
-       }
-
-       /**
-        * @param string $name
-        * @param string $whereOrderBy : eg. ' AND field1 = value ORDER BY field2'
-        * @param offset
-        * @param limit
-        * @return mixed
-        */
-       function LoadRelations($name, $whereOrderBy='', $offset=-1,$limit=-1)
-       {
-               $extras = array();
-               $table = $this->TableInfo();
-               if ($limit >= 0) {
-                       $extras['limit'] = $limit;
-               }
-               if ($offset >= 0) {
-                       $extras['offset'] = $offset;
-               }
-
-               if (strlen($whereOrderBy)) {
-                       if (!preg_match('/^[ \n\r]*AND/i', $whereOrderBy)) {
-                               if (!preg_match('/^[ \n\r]*ORDER[ \n\r]/i', $whereOrderBy)) {
-                                       $whereOrderBy = 'AND ' . $whereOrderBy;
-                               }
-                       }
-               }
-
-               if(!empty($table->_belongsTo[$name])) {
-                       $obj = $table->_belongsTo[$name];
-                       $columnName = $obj->foreignKey;
-                       if(empty($this->$columnName)) {
-                               $this->$name = null;
-                       }
-                       else {
-                               if ($obj->parentKey) {
-                                       $key = $obj->parentKey;
-                               }
-                               else {
-                                       $key = reset($table->keys);
-                               }
-
-                               $arrayOfOne = $obj->Find($key.'='.$this->$columnName.' '.$whereOrderBy,false,false,$extras);
-                               if ($arrayOfOne) {
-                                       $this->$name = $arrayOfOne[0];
-                                       return $arrayOfOne[0];
-                               }
-                       }
-               }
-               if(!empty($table->_hasMany[$name])) {
-                       $obj = $table->_hasMany[$name];
-                       $key = reset($table->keys);
-                       $id = @$this->$key;
-                       if (!is_numeric($id)) {
-                               $db = $this->DB();
-                               $id = $db->qstr($id);
-                       }
-                       $objs = $obj->Find($obj->foreignKey.'='.$id. ' '.$whereOrderBy,false,false,$extras);
-                       if (!$objs) {
-                               $objs = array();
-                       }
-                       $this->$name = $objs;
-                       return $objs;
-               }
-
-               return array();
-       }
-       //////////////////////////////////
-
-       // update metadata
-       function UpdateActiveTable($pkeys=false,$forceUpdate=false)
-       {
-       global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS , $ADODB_CACHE_DIR, $ADODB_ACTIVE_CACHESECS;
-       global $ADODB_ACTIVE_DEFVALS,$ADODB_FETCH_MODE;
-
-               $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
-
-               $table = $this->_table;
-               $tables = $activedb->tables;
-               $tableat = $this->_tableat;
-               if (!$forceUpdate && !empty($tables[$tableat])) {
-
-                       $acttab = $tables[$tableat];
-                       foreach($acttab->flds as $name => $fld) {
-                               if ($ADODB_ACTIVE_DEFVALS && isset($fld->default_value)) {
-                                       $this->$name = $fld->default_value;
-                               }
-                               else {
-                                       $this->$name = null;
-                               }
-                       }
-                       return;
-               }
-               $db = $activedb->db;
-               $fname = $ADODB_CACHE_DIR . '/adodb_' . $db->databaseType . '_active_'. $table . '.cache';
-               if (!$forceUpdate && $ADODB_ACTIVE_CACHESECS && $ADODB_CACHE_DIR && file_exists($fname)) {
-                       $fp = fopen($fname,'r');
-                       @flock($fp, LOCK_SH);
-                       $acttab = unserialize(fread($fp,100000));
-                       fclose($fp);
-                       if ($acttab->_created + $ADODB_ACTIVE_CACHESECS - (abs(rand()) % 16) > time()) {
-                               // abs(rand()) randomizes deletion, reducing contention to delete/refresh file
-                               // ideally, you should cache at least 32 secs
-
-                               foreach($acttab->flds as $name => $fld) {
-                                       if ($ADODB_ACTIVE_DEFVALS && isset($fld->default_value)) {
-                                               $this->$name = $fld->default_value;
-                                       }
-                                       else {
-                                               $this->$name = null;
-                                       }
-                               }
-
-                               $activedb->tables[$table] = $acttab;
-
-                               //if ($db->debug) ADOConnection::outp("Reading cached active record file: $fname");
-                               return;
-                       } else if ($db->debug) {
-                               ADOConnection::outp("Refreshing cached active record file: $fname");
-                       }
-               }
-               $activetab = new ADODB_Active_Table();
-               $activetab->name = $table;
-
-               $save = $ADODB_FETCH_MODE;
-               $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
-               if ($db->fetchMode !== false) {
-                       $savem = $db->SetFetchMode(false);
-               }
-
-               $cols = $db->MetaColumns($table);
-
-               if (isset($savem)) {
-                       $db->SetFetchMode($savem);
-               }
-               $ADODB_FETCH_MODE = $save;
-
-               if (!$cols) {
-                       $this->Error("Invalid table name: $table",'UpdateActiveTable');
-                       return false;
-               }
-               $fld = reset($cols);
-               if (!$pkeys) {
-                       if (isset($fld->primary_key)) {
-                               $pkeys = array();
-                               foreach($cols as $name => $fld) {
-                                       if (!empty($fld->primary_key)) {
-                                               $pkeys[] = $name;
-                                       }
-                               }
-                       } else
-                               $pkeys = $this->GetPrimaryKeys($db, $table);
-               }
-               if (empty($pkeys)) {
-                       $this->Error("No primary key found for table $table",'UpdateActiveTable');
-                       return false;
-               }
-
-               $attr = array();
-               $keys = array();
-
-               switch($ADODB_ASSOC_CASE) {
-               case 0:
-                       foreach($cols as $name => $fldobj) {
-                               $name = strtolower($name);
-                               if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) {
-                                       $this->$name = $fldobj->default_value;
-                               }
-                               else {
-                                       $this->$name = null;
-                               }
-                               $attr[$name] = $fldobj;
-                       }
-                       foreach($pkeys as $k => $name) {
-                               $keys[strtolower($name)] = strtolower($name);
-                       }
-                       break;
-
-               case 1:
-                       foreach($cols as $name => $fldobj) {
-                               $name = strtoupper($name);
-
-                               if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) {
-                                       $this->$name = $fldobj->default_value;
-                               }
-                               else {
-                                       $this->$name = null;
-                               }
-                               $attr[$name] = $fldobj;
-                       }
-
-                       foreach($pkeys as $k => $name) {
-                               $keys[strtoupper($name)] = strtoupper($name);
-                       }
-                       break;
-               default:
-                       foreach($cols as $name => $fldobj) {
-                               $name = ($fldobj->name);
-
-                               if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) {
-                                       $this->$name = $fldobj->default_value;
-                               }
-                               else {
-                                       $this->$name = null;
-                               }
-                               $attr[$name] = $fldobj;
-                       }
-                       foreach($pkeys as $k => $name) {
-                               $keys[$name] = $cols[$name]->name;
-                       }
-                       break;
-               }
-
-               $activetab->keys = $keys;
-               $activetab->flds = $attr;
-
-               if ($ADODB_ACTIVE_CACHESECS && $ADODB_CACHE_DIR) {
-                       $activetab->_created = time();
-                       $s = serialize($activetab);
-                       if (!function_exists('adodb_write_file')) {
-                               include(ADODB_DIR.'/adodb-csvlib.inc.php');
-                       }
-                       adodb_write_file($fname,$s);
-               }
-               if (isset($activedb->tables[$table])) {
-                       $oldtab = $activedb->tables[$table];
-
-                       if ($oldtab) {
-                               $activetab->_belongsTo = $oldtab->_belongsTo;
-                               $activetab->_hasMany = $oldtab->_hasMany;
-                       }
-               }
-               $activedb->tables[$table] = $activetab;
-       }
-
-       function GetPrimaryKeys(&$db, $table)
-       {
-               return $db->MetaPrimaryKeys($table);
-       }
-
-       // error handler for both PHP4+5.
-       function Error($err,$fn)
-       {
-       global $_ADODB_ACTIVE_DBS;
-
-               $fn = get_class($this).'::'.$fn;
-               $this->_lasterr = $fn.': '.$err;
-
-               if ($this->_dbat < 0) {
-                       $db = false;
-               }
-               else {
-                       $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
-                       $db = $activedb->db;
-               }
-
-               if (function_exists('adodb_throw')) {
-                       if (!$db) {
-                               adodb_throw('ADOdb_Active_Record', $fn, -1, $err, 0, 0, false);
-                       }
-                       else {
-                               adodb_throw($db->databaseType, $fn, -1, $err, 0, 0, $db);
-                       }
-               } else {
-                       if (!$db || $db->debug) {
-                               ADOConnection::outp($this->_lasterr);
-                       }
-               }
-
-       }
-
-       // return last error message
-       function ErrorMsg()
-       {
-               if (!function_exists('adodb_throw')) {
-                       if ($this->_dbat < 0) {
-                               $db = false;
-                       }
-                       else {
-                               $db = $this->DB();
-                       }
-
-                       // last error could be database error too
-                       if ($db && $db->ErrorMsg()) {
-                               return $db->ErrorMsg();
-                       }
-               }
-               return $this->_lasterr;
-       }
-
-       function ErrorNo()
-       {
-               if ($this->_dbat < 0) {
-                       return -9999; // no database connection...
-               }
-               $db = $this->DB();
-
-               return (int) $db->ErrorNo();
-       }
-
-
-       // retrieve ADOConnection from _ADODB_Active_DBs
-       function DB()
-       {
-       global $_ADODB_ACTIVE_DBS;
-
-               if ($this->_dbat < 0) {
-                       $false = false;
-                       $this->Error("No database connection set: use ADOdb_Active_Record::SetDatabaseAdaptor(\$db)", "DB");
-                       return $false;
-               }
-               $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
-               $db = $activedb->db;
-               return $db;
-       }
-
-       // retrieve ADODB_Active_Table
-       function &TableInfo()
-       {
-       global $_ADODB_ACTIVE_DBS;
-               $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
-               $table = $activedb->tables[$this->_tableat];
-               return $table;
-       }
-
-
-       // I have an ON INSERT trigger on a table that sets other columns in the table.
-       // So, I find that for myTable, I want to reload an active record after saving it. -- Malcolm Cook
-       function Reload()
-       {
-               $db = $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $table = $this->TableInfo();
-               $where = $this->GenWhere($db, $table);
-               return($this->Load($where));
-       }
-
-
-       // set a numeric array (using natural table field ordering) as object properties
-       function Set(&$row)
-       {
-       global $ACTIVE_RECORD_SAFETY;
-
-               $db = $this->DB();
-
-               if (!$row) {
-                       $this->_saved = false;
-                       return false;
-               }
-
-               $this->_saved = true;
-
-               $table = $this->TableInfo();
-               if ($ACTIVE_RECORD_SAFETY && sizeof($table->flds) != sizeof($row)) {
-                       # <AP>
-                       $bad_size = TRUE;
-                       if (sizeof($row) == 2 * sizeof($table->flds)) {
-                               // Only keep string keys
-                               $keys = array_filter(array_keys($row), 'is_string');
-                               if (sizeof($keys) == sizeof($table->flds)) {
-                                       $bad_size = FALSE;
-                               }
-                       }
-                       if ($bad_size) {
-                       $this->Error("Table structure of $this->_table has changed","Load");
-                       return false;
-               }
-                       # </AP>
-               }
-               else
-                       $keys = array_keys($row);
-
-               # <AP>
-               reset($keys);
-               $this->_original = array();
-               foreach($table->flds as $name=>$fld) {
-                       $value = $row[current($keys)];
-                       $this->$name = $value;
-                       $this->_original[] = $value;
-                       next($keys);
-               }
-
-               # </AP>
-               return true;
-       }
-
-       // get last inserted id for INSERT
-       function LastInsertID(&$db,$fieldname)
-       {
-               if ($db->hasInsertID) {
-                       $val = $db->Insert_ID($this->_table,$fieldname);
-               }
-               else {
-                       $val = false;
-               }
-
-               if (is_null($val) || $val === false) {
-                       // this might not work reliably in multi-user environment
-                       return $db->GetOne("select max(".$fieldname.") from ".$this->_table);
-               }
-               return $val;
-       }
-
-       // quote data in where clause
-       function doquote(&$db, $val,$t)
-       {
-               switch($t) {
-               case 'L':
-                       if (strpos($db->databaseType,'postgres') !== false) {
-                               return $db->qstr($val);
-                       }
-               case 'D':
-               case 'T':
-                       if (empty($val)) {
-                               return 'null';
-                       }
-               case 'B':
-               case 'N':
-               case 'C':
-               case 'X':
-                       if (is_null($val)) {
-                               return 'null';
-                       }
-
-                       if (strlen($val)>0 &&
-                               (strncmp($val,"'",1) != 0 || substr($val,strlen($val)-1,1) != "'")
-                       ) {
-                               return $db->qstr($val);
-                               break;
-                       }
-               default:
-                       return $val;
-                       break;
-               }
-       }
-
-       // generate where clause for an UPDATE/SELECT
-       function GenWhere(&$db, &$table)
-       {
-               $keys = $table->keys;
-               $parr = array();
-
-               foreach($keys as $k) {
-                       $f = $table->flds[$k];
-                       if ($f) {
-                               $parr[] = $k.' = '.$this->doquote($db,$this->$k,$db->MetaType($f->type));
-                       }
-               }
-               return implode(' and ', $parr);
-       }
-
-
-       function _QName($n,$db=false)
-       {
-               if (!ADODB_Active_Record::$_quoteNames) {
-                       return $n;
-               }
-               if (!$db) {
-                       $db = $this->DB();
-                       if (!$db) {
-                               return false;
-                       }
-               }
-               return $db->nameQuote.$n.$db->nameQuote;
-       }
-
-       //------------------------------------------------------------ Public functions below
-
-       function Load($where=null,$bindarr=false, $lock = false)
-       {
-       global $ADODB_FETCH_MODE;
-
-               $db = $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $this->_where = $where;
-
-               $save = $ADODB_FETCH_MODE;
-               $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
-               if ($db->fetchMode !== false) {
-                       $savem = $db->SetFetchMode(false);
-               }
-
-               $qry = "select * from ".$this->_table;
-
-               if($where) {
-                       $qry .= ' WHERE '.$where;
-               }
-               if ($lock) {
-                       $qry .= $this->lockMode;
-               }
-
-               $row = $db->GetRow($qry,$bindarr);
-
-               if (isset($savem)) {
-                       $db->SetFetchMode($savem);
-               }
-               $ADODB_FETCH_MODE = $save;
-
-               return $this->Set($row);
-       }
-
-       function LoadLocked($where=null, $bindarr=false)
-       {
-               $this->Load($where,$bindarr,true);
-       }
-
-       # useful for multiple record inserts
-       # see http://phplens.com/lens/lensforum/msgs.php?id=17795
-       function Reset()
-       {
-               $this->_where=null;
-               $this->_saved = false;
-               $this->_lasterr = false;
-               $this->_original = false;
-               $vars=get_object_vars($this);
-               foreach($vars as $k=>$v){
-                       if(substr($k,0,1)!=='_'){
-                               $this->{$k}=null;
-                       }
-               }
-               $this->foreignName=strtolower(get_class($this));
-               return true;
-       }
-
-       // false on error
-       function Save()
-       {
-               if ($this->_saved) {
-                       $ok = $this->Update();
-               }
-               else {
-                       $ok = $this->Insert();
-               }
-
-               return $ok;
-       }
-
-
-       // false on error
-       function Insert()
-       {
-               $db = $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $cnt = 0;
-               $table = $this->TableInfo();
-
-               $valarr = array();
-               $names = array();
-               $valstr = array();
-
-               foreach($table->flds as $name=>$fld) {
-                       $val = $this->$name;
-                       if(!is_array($val) || !is_null($val) || !array_key_exists($name, $table->keys)) {
-                               $valarr[] = $val;
-                               $names[] = $this->_QName($name,$db);
-                               $valstr[] = $db->Param($cnt);
-                               $cnt += 1;
-                       }
-               }
-
-               if (empty($names)){
-                       foreach($table->flds as $name=>$fld) {
-                               $valarr[] = null;
-                               $names[] = $name;
-                               $valstr[] = $db->Param($cnt);
-                               $cnt += 1;
-                       }
-               }
-               $sql = 'INSERT INTO '.$this->_table."(".implode(',',$names).') VALUES ('.implode(',',$valstr).')';
-               $ok = $db->Execute($sql,$valarr);
-
-               if ($ok) {
-                       $this->_saved = true;
-                       $autoinc = false;
-                       foreach($table->keys as $k) {
-                               if (is_null($this->$k)) {
-                                       $autoinc = true;
-                                       break;
-                               }
-                       }
-                       if ($autoinc && sizeof($table->keys) == 1) {
-                               $k = reset($table->keys);
-                               $this->$k = $this->LastInsertID($db,$k);
-                       }
-               }
-
-               $this->_original = $valarr;
-               return !empty($ok);
-       }
-
-       function Delete()
-       {
-               $db = $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $table = $this->TableInfo();
-
-               $where = $this->GenWhere($db,$table);
-               $sql = 'DELETE FROM '.$this->_table.' WHERE '.$where;
-               $ok = $db->Execute($sql);
-
-               return $ok ? true : false;
-       }
-
-       // returns an array of active record objects
-       function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array())
-       {
-               $db = $this->DB();
-               if (!$db || empty($this->_table)) {
-                       return false;
-               }
-               $arr = $db->GetActiveRecordsClass(get_class($this),$this->_table, $whereOrderBy,$bindarr,$pkeysArr,$extra);
-               return $arr;
-       }
-
-       // returns 0 on error, 1 on update, 2 on insert
-       function Replace()
-       {
-       global $ADODB_ASSOC_CASE;
-
-               $db = $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $table = $this->TableInfo();
-
-               $pkey = $table->keys;
-
-               foreach($table->flds as $name=>$fld) {
-                       $val = $this->$name;
-                       /*
-                       if (is_null($val)) {
-                               if (isset($fld->not_null) && $fld->not_null) {
-                                       if (isset($fld->default_value) && strlen($fld->default_value)) {
-                                               continue;
-                                       }
-                                       else {
-                                               $this->Error("Cannot update null into $name","Replace");
-                                               return false;
-                                       }
-                               }
-                       }*/
-                       if (is_null($val) && !empty($fld->auto_increment)) {
-                               continue;
-                       }
-
-                       if (is_array($val)) {
-                               continue;
-                       }
-
-                       $t = $db->MetaType($fld->type);
-                       $arr[$name] = $this->doquote($db,$val,$t);
-                       $valarr[] = $val;
-               }
-
-               if (!is_array($pkey)) {
-                       $pkey = array($pkey);
-               }
-
-               if ($ADODB_ASSOC_CASE == 0) {
-                       foreach($pkey as $k => $v)
-                               $pkey[$k] = strtolower($v);
-               }
-               elseif ($ADODB_ASSOC_CASE == 1) {
-                       foreach($pkey as $k => $v) {
-                               $pkey[$k] = strtoupper($v);
-                       }
-               }
-
-               $ok = $db->Replace($this->_table,$arr,$pkey);
-               if ($ok) {
-                       $this->_saved = true; // 1= update 2=insert
-                       if ($ok == 2) {
-                               $autoinc = false;
-                               foreach($table->keys as $k) {
-                                       if (is_null($this->$k)) {
-                                               $autoinc = true;
-                                               break;
-                                       }
-                               }
-                               if ($autoinc && sizeof($table->keys) == 1) {
-                                       $k = reset($table->keys);
-                                       $this->$k = $this->LastInsertID($db,$k);
-                               }
-                       }
-
-                       $this->_original = $valarr;
-               }
-               return $ok;
-       }
-
-       // returns 0 on error, 1 on update, -1 if no change in data (no update)
-       function Update()
-       {
-               $db = $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $table = $this->TableInfo();
-
-               $where = $this->GenWhere($db, $table);
-
-               if (!$where) {
-                       $this->error("Where missing for table $table", "Update");
-                       return false;
-               }
-               $valarr = array();
-               $neworig = array();
-               $pairs = array();
-               $i = -1;
-               $cnt = 0;
-               foreach($table->flds as $name=>$fld) {
-                       $i += 1;
-                       $val = $this->$name;
-                       $neworig[] = $val;
-
-                       if (isset($table->keys[$name]) || is_array($val)) {
-                               continue;
-                       }
-
-                       if (is_null($val)) {
-                               if (isset($fld->not_null) && $fld->not_null) {
-                                       if (isset($fld->default_value) && strlen($fld->default_value)) {
-                                               continue;
-                                       }
-                                       else {
-                                               $this->Error("Cannot set field $name to NULL","Update");
-                                               return false;
-                                       }
-                               }
-                       }
-
-                       if (isset($this->_original[$i]) && strcmp($val,$this->_original[$i]) == 0) {
-                               continue;
-                       }
-
-                       if (is_null($this->_original[$i]) && is_null($val)) {
-                               continue;
-                       }
-
-                       $valarr[] = $val;
-                       $pairs[] = $this->_QName($name,$db).'='.$db->Param($cnt);
-                       $cnt += 1;
-               }
-
-
-               if (!$cnt) {
-                       return -1;
-               }
-
-               $sql = 'UPDATE '.$this->_table." SET ".implode(",",$pairs)." WHERE ".$where;
-               $ok = $db->Execute($sql,$valarr);
-               if ($ok) {
-                       $this->_original = $neworig;
-                       return 1;
-               }
-               return 0;
-       }
-
-       function GetAttributeNames()
-       {
-               $table = $this->TableInfo();
-               if (!$table) {
-                       return false;
-               }
-               return array_keys($table->flds);
-       }
-
-};
-
-function adodb_GetActiveRecordsClass(&$db, $class, $table,$whereOrderBy,$bindarr, $primkeyArr,
-                       $extra)
-{
-global $_ADODB_ACTIVE_DBS;
-
-
-       $save = $db->SetFetchMode(ADODB_FETCH_NUM);
-       $qry = "select * from ".$table;
-
-       if (!empty($whereOrderBy)) {
-               $qry .= ' WHERE '.$whereOrderBy;
-       }
-       if(isset($extra['limit'])) {
-               $rows = false;
-               if(isset($extra['offset'])) {
-                       $rs = $db->SelectLimit($qry, $extra['limit'], $extra['offset'],$bindarr);
-               } else {
-                       $rs = $db->SelectLimit($qry, $extra['limit'],-1,$bindarr);
-               }
-               if ($rs) {
-                       while (!$rs->EOF) {
-                               $rows[] = $rs->fields;
-                               $rs->MoveNext();
-                       }
-               }
-       } else
-               $rows = $db->GetAll($qry,$bindarr);
-
-       $db->SetFetchMode($save);
-
-       $false = false;
-
-       if ($rows === false) {
-               return $false;
-       }
-
-
-       if (!class_exists($class)) {
-               $db->outp_throw("Unknown class $class in GetActiveRecordsClass()",'GetActiveRecordsClass');
-               return $false;
-       }
-       $arr = array();
-       // arrRef will be the structure that knows about our objects.
-       // It is an associative array.
-       // We will, however, return arr, preserving regular 0.. order so that
-       // obj[0] can be used by app developpers.
-       $arrRef = array();
-       $bTos = array(); // Will store belongTo's indices if any
-       foreach($rows as $row) {
-
-               $obj = new $class($table,$primkeyArr,$db);
-               if ($obj->ErrorNo()){
-                       $db->_errorMsg = $obj->ErrorMsg();
-                       return $false;
-               }
-               $obj->Set($row);
-               $arr[] = $obj;
-       } // foreach($rows as $row)
-
-       return $arr;
-}
diff --git a/typo3/sysext/adodb/adodb/adodb-active-recordx.inc.php b/typo3/sysext/adodb/adodb/adodb-active-recordx.inc.php
deleted file mode 100644 (file)
index 9e4f7c9..0000000
+++ /dev/null
@@ -1,1497 +0,0 @@
-<?php
-/*
-
-@version   v5.20.3  01-Jan-2016
-@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
-@copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
-  Latest version is available at http://adodb.sourceforge.net
-
-  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.
-
-  Active Record implementation. Superset of Zend Framework's.
-
-  This is "Active Record eXtended" to support JOIN, WORK and LAZY mode by Chris Ravenscroft  chris#voilaweb.com
-
-  Version 0.9
-
-  See http://www-128.ibm.com/developerworks/java/library/j-cb03076/?ca=dgr-lnxw01ActiveRecord
-       for info on Ruby on Rails Active Record implementation
-*/
-
-
-       // CFR: Active Records Definitions
-define('ADODB_JOIN_AR', 0x01);
-define('ADODB_WORK_AR', 0x02);
-define('ADODB_LAZY_AR', 0x03);
-
-
-global $_ADODB_ACTIVE_DBS;
-global $ADODB_ACTIVE_CACHESECS; // set to true to enable caching of metadata such as field info
-global $ACTIVE_RECORD_SAFETY; // set to false to disable safety checks
-global $ADODB_ACTIVE_DEFVALS; // use default values of table definition when creating new active record.
-
-// array of ADODB_Active_DB's, indexed by ADODB_Active_Record->_dbat
-$_ADODB_ACTIVE_DBS = array();
-$ACTIVE_RECORD_SAFETY = true; // CFR: disabled while playing with relations
-$ADODB_ACTIVE_DEFVALS = false;
-
-class ADODB_Active_DB {
-       var $db; // ADOConnection
-       var $tables; // assoc array of ADODB_Active_Table objects, indexed by tablename
-}
-
-class ADODB_Active_Table {
-       var $name; // table name
-       var $flds; // assoc array of adofieldobjs, indexed by fieldname
-       var $keys; // assoc array of primary keys, indexed by fieldname
-       var $_created; // only used when stored as a cached file
-       var $_belongsTo = array();
-       var $_hasMany = array();
-       var $_colsCount; // total columns count, including relations
-
-       function updateColsCount()
-       {
-               $this->_colsCount = sizeof($this->flds);
-               foreach($this->_belongsTo as $foreignTable)
-                       $this->_colsCount += sizeof($foreignTable->TableInfo()->flds);
-               foreach($this->_hasMany as $foreignTable)
-                       $this->_colsCount += sizeof($foreignTable->TableInfo()->flds);
-       }
-}
-
-// returns index into $_ADODB_ACTIVE_DBS
-function ADODB_SetDatabaseAdapter(&$db)
-{
-       global $_ADODB_ACTIVE_DBS;
-
-               foreach($_ADODB_ACTIVE_DBS as $k => $d) {
-                       if (PHP_VERSION >= 5) {
-                               if ($d->db === $db) {
-                                       return $k;
-                               }
-                       } else {
-                               if ($d->db->_connectionID === $db->_connectionID && $db->database == $d->db->database) {
-                                       return $k;
-                               }
-                       }
-               }
-
-               $obj = new ADODB_Active_DB();
-               $obj->db = $db;
-               $obj->tables = array();
-
-               $_ADODB_ACTIVE_DBS[] = $obj;
-
-               return sizeof($_ADODB_ACTIVE_DBS)-1;
-}
-
-
-class ADODB_Active_Record {
-       static $_changeNames = true; // dynamically pluralize table names
-       static $_foreignSuffix = '_id'; //
-       var $_dbat; // associative index pointing to ADODB_Active_DB eg. $ADODB_Active_DBS[_dbat]
-       var $_table; // tablename, if set in class definition then use it as table name
-       var $_sTable; // singularized table name
-       var $_pTable; // pluralized table name
-       var $_tableat; // associative index pointing to ADODB_Active_Table, eg $ADODB_Active_DBS[_dbat]->tables[$this->_tableat]
-       var $_where; // where clause set in Load()
-       var $_saved = false; // indicates whether data is already inserted.
-       var $_lasterr = false; // last error message
-       var $_original = false; // the original values loaded or inserted, refreshed on update
-
-       var $foreignName; // CFR: class name when in a relationship
-
-       static function UseDefaultValues($bool=null)
-       {
-       global $ADODB_ACTIVE_DEFVALS;
-               if (isset($bool)) {
-                       $ADODB_ACTIVE_DEFVALS = $bool;
-               }
-               return $ADODB_ACTIVE_DEFVALS;
-       }
-
-       // should be static
-       static function SetDatabaseAdapter(&$db)
-       {
-               return ADODB_SetDatabaseAdapter($db);
-       }
-
-
-       public function __set($name, $value)
-       {
-               $name = str_replace(' ', '_', $name);
-               $this->$name = $value;
-       }
-
-       // php5 constructor
-       // Note: if $table is defined, then we will use it as our table name
-       // Otherwise we will use our classname...
-       // In our database, table names are pluralized (because there can be
-       // more than one row!)
-       // Similarly, if $table is defined here, it has to be plural form.
-       //
-       // $options is an array that allows us to tweak the constructor's behaviour
-       // if $options['refresh'] is true, we re-scan our metadata information
-       // if $options['new'] is true, we forget all relations
-       function __construct($table = false, $pkeyarr=false, $db=false, $options=array())
-       {
-       global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS;
-
-               if ($db == false && is_object($pkeyarr)) {
-                       $db = $pkeyarr;
-                       $pkeyarr = false;
-               }
-
-               if($table) {
-                       // table argument exists. It is expected to be
-                       // already plural form.
-                       $this->_pTable = $table;
-                       $this->_sTable = $this->_singularize($this->_pTable);
-               }
-               else {
-                       // We will use current classname as table name.
-                       // We need to pluralize it for the real table name.
-                       $this->_sTable = strtolower(get_class($this));
-                       $this->_pTable = $this->_pluralize($this->_sTable);
-               }
-               $this->_table = &$this->_pTable;
-
-               $this->foreignName = $this->_sTable; // CFR: default foreign name (singular)
-
-               if ($db) {
-                       $this->_dbat = ADODB_Active_Record::SetDatabaseAdapter($db);
-               } else
-                       $this->_dbat = sizeof($_ADODB_ACTIVE_DBS)-1;
-
-
-               if ($this->_dbat < 0) {
-                       $this->Error(
-                               "No database connection set; use ADOdb_Active_Record::SetDatabaseAdapter(\$db)",
-                               'ADODB_Active_Record::__constructor'
-                       );
-               }
-
-               $this->_tableat = $this->_table; # reserved for setting the assoc value to a non-table name, eg. the sql string in future
-
-               // CFR: Just added this option because UpdateActiveTable() can refresh its information
-               // but there was no way to ask it to do that.
-               $forceUpdate = (isset($options['refresh']) && true === $options['refresh']);
-               $this->UpdateActiveTable($pkeyarr, $forceUpdate);
-               if(isset($options['new']) && true === $options['new']) {
-                       $table =& $this->TableInfo();
-                       unset($table->_hasMany);
-                       unset($table->_belongsTo);
-                       $table->_hasMany = array();
-                       $table->_belongsTo = array();
-               }
-       }
-
-       function __wakeup()
-       {
-               $class = get_class($this);
-               new $class;
-       }
-
-       // CFR: Constants found in Rails
-       static $IrregularP = array(
-               'PERSON'    => 'people',
-               'MAN'       => 'men',
-               'WOMAN'     => 'women',
-               'CHILD'     => 'children',
-               'COW'       => 'kine',
-       );
-
-       static $IrregularS = array(
-               'PEOPLE'    => 'PERSON',
-               'MEN'       => 'man',
-               'WOMEN'     => 'woman',
-               'CHILDREN'  => 'child',
-               'KINE'      => 'cow',
-       );
-
-       static $WeIsI = array(
-               'EQUIPMENT' => true,
-               'INFORMATION'   => true,
-               'RICE'      => true,
-               'MONEY'     => true,
-               'SPECIES'   => true,
-               'SERIES'    => true,
-               'FISH'      => true,
-               'SHEEP'     => true,
-       );
-
-       function _pluralize($table)
-       {
-               if (!ADODB_Active_Record::$_changeNames) {
-                       return $table;
-               }
-               $ut = strtoupper($table);
-               if(isset(self::$WeIsI[$ut])) {
-                       return $table;
-               }
-               if(isset(self::$IrregularP[$ut])) {
-                       return self::$IrregularP[$ut];
-               }
-               $len = strlen($table);
-               $lastc = $ut[$len-1];
-               $lastc2 = substr($ut,$len-2);
-               switch ($lastc) {
-                       case 'S':
-                               return $table.'es';
-                       case 'Y':
-                               return substr($table,0,$len-1).'ies';
-                       case 'X':
-                               return $table.'es';
-                       case 'H':
-                               if ($lastc2 == 'CH' || $lastc2 == 'SH') {
-                                       return $table.'es';
-                               }
-                       default:
-                               return $table.'s';
-               }
-       }
-
-       // CFR Lamest singular inflector ever - @todo Make it real!
-       // Note: There is an assumption here...and it is that the argument's length >= 4
-       function _singularize($table)
-       {
-
-               if (!ADODB_Active_Record::$_changeNames) {
-               return $table;
-       }
-               $ut = strtoupper($table);
-               if(isset(self::$WeIsI[$ut])) {
-                       return $table;
-               }
-               if(isset(self::$IrregularS[$ut])) {
-                       return self::$IrregularS[$ut];
-               }
-               $len = strlen($table);
-               if($ut[$len-1] != 'S') {
-                       return $table; // I know...forget oxen
-               }
-               if($ut[$len-2] != 'E') {
-                       return substr($table, 0, $len-1);
-               }
-               switch($ut[$len-3]) {
-                       case 'S':
-                       case 'X':
-                               return substr($table, 0, $len-2);
-                       case 'I':
-                               return substr($table, 0, $len-3) . 'y';
-                       case 'H';
-                               if($ut[$len-4] == 'C' || $ut[$len-4] == 'S') {
-                                       return substr($table, 0, $len-2);
-                               }
-                       default:
-                               return substr($table, 0, $len-1); // ?
-               }
-       }
-
-       /*
-        * ar->foreignName will contain the name of the tables associated with this table because
-        * these other tables' rows may also be referenced by this table using theirname_id or the provided
-        * foreign keys (this index name is stored in ar->foreignKey)
-        *
-        * this-table.id = other-table-#1.this-table_id
-        *               = other-table-#2.this-table_id
-        */
-       function hasMany($foreignRef,$foreignKey=false)
-       {
-               $ar = new ADODB_Active_Record($foreignRef);
-               $ar->foreignName = $foreignRef;
-               $ar->UpdateActiveTable();
-               $ar->foreignKey = ($foreignKey) ? $foreignKey : strtolower(get_class($this)) . self::$_foreignSuffix;
-
-               $table =& $this->TableInfo();
-               if(!isset($table->_hasMany[$foreignRef])) {
-                       $table->_hasMany[$foreignRef] = $ar;
-                       $table->updateColsCount();
-               }
-# @todo Can I make this guy be lazy?
-               $this->$foreignRef = $table->_hasMany[$foreignRef]; // WATCHME Removed assignment by ref. to please __get()
-       }
-
-       /**
-        * ar->foreignName will contain the name of the tables associated with this table because
-        * this table's rows may also be referenced by those tables using thistable_id or the provided
-        * foreign keys (this index name is stored in ar->foreignKey)
-        *
-        * this-table.other-table_id = other-table.id
-        */
-       function belongsTo($foreignRef,$foreignKey=false)
-       {
-               global $inflector;
-
-               $ar = new ADODB_Active_Record($this->_pluralize($foreignRef));
-               $ar->foreignName = $foreignRef;
-               $ar->UpdateActiveTable();
-               $ar->foreignKey = ($foreignKey) ? $foreignKey : $ar->foreignName . self::$_foreignSuffix;
-
-               $table =& $this->TableInfo();
-               if(!isset($table->_belongsTo[$foreignRef])) {
-                       $table->_belongsTo[$foreignRef] = $ar;
-                       $table->updateColsCount();
-               }
-               $this->$foreignRef = $table->_belongsTo[$foreignRef];
-       }
-
-       /**
-        * __get Access properties - used for lazy loading
-        *
-        * @param mixed $name
-        * @access protected
-        * @return void
-        */
-       function __get($name)
-       {
-               return $this->LoadRelations($name, '', -1. -1);
-       }
-
-       function LoadRelations($name, $whereOrderBy, $offset=-1, $limit=-1)
-       {
-               $extras = array();
-               if($offset >= 0) {
-                       $extras['offset'] = $offset;
-               }
-               if($limit >= 0) {
-                       $extras['limit'] = $limit;
-               }
-               $table =& $this->TableInfo();
-
-               if (strlen($whereOrderBy)) {
-                       if (!preg_match('/^[ \n\r]*AND/i',$whereOrderBy)) {
-                               if (!preg_match('/^[ \n\r]*ORDER[ \n\r]/i',$whereOrderBy)) {
-                                       $whereOrderBy = 'AND '.$whereOrderBy;
-                               }
-                       }
-               }
-
-               if(!empty($table->_belongsTo[$name])) {
-                       $obj = $table->_belongsTo[$name];
-                       $columnName = $obj->foreignKey;
-                       if(empty($this->$columnName)) {
-                               $this->$name = null;
-                       }
-                       else {
-                               if(($k = reset($obj->TableInfo()->keys))) {
-                                       $belongsToId = $k;
-                               }
-                               else {
-                                       $belongsToId = 'id';
-                               }
-
-                               $arrayOfOne =
-                                       $obj->Find(
-                                               $belongsToId.'='.$this->$columnName.' '.$whereOrderBy, false, false, $extras);
-                               $this->$name = $arrayOfOne[0];
-                       }
-                       return $this->$name;
-               }
-               if(!empty($table->_hasMany[$name])) {
-                       $obj = $table->_hasMany[$name];
-                       if(($k = reset($table->keys))) {
-                               $hasManyId   = $k;
-                       }
-                       else {
-                               $hasManyId   = 'id';
-                       }
-
-                       $this->$name =
-                               $obj->Find(
-                                       $obj->foreignKey.'='.$this->$hasManyId.' '.$whereOrderBy, false, false, $extras);
-                       return $this->$name;
-               }
-       }
-       //////////////////////////////////
-
-       // update metadata
-       function UpdateActiveTable($pkeys=false,$forceUpdate=false)
-       {
-       global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS , $ADODB_CACHE_DIR, $ADODB_ACTIVE_CACHESECS;
-       global $ADODB_ACTIVE_DEFVALS, $ADODB_FETCH_MODE;
-
-               $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
-
-               $table = $this->_table;
-               $tables = $activedb->tables;
-               $tableat = $this->_tableat;
-               if (!$forceUpdate && !empty($tables[$tableat])) {
-
-                       $tobj = $tables[$tableat];
-                       foreach($tobj->flds as $name => $fld) {
-                               if ($ADODB_ACTIVE_DEFVALS && isset($fld->default_value)) {
-                                       $this->$name = $fld->default_value;
-                               }
-                               else {
-                                       $this->$name = null;
-                               }
-                       }
-                       return;
-               }
-
-               $db = $activedb->db;
-               $fname = $ADODB_CACHE_DIR . '/adodb_' . $db->databaseType . '_active_'. $table . '.cache';
-               if (!$forceUpdate && $ADODB_ACTIVE_CACHESECS && $ADODB_CACHE_DIR && file_exists($fname)) {
-                       $fp = fopen($fname,'r');
-                       @flock($fp, LOCK_SH);
-                       $acttab = unserialize(fread($fp,100000));
-                       fclose($fp);
-                       if ($acttab->_created + $ADODB_ACTIVE_CACHESECS - (abs(rand()) % 16) > time()) {
-                               // abs(rand()) randomizes deletion, reducing contention to delete/refresh file
-                               // ideally, you should cache at least 32 secs
-                               $activedb->tables[$table] = $acttab;
-
-                               //if ($db->debug) ADOConnection::outp("Reading cached active record file: $fname");
-                                       return;
-                       } else if ($db->debug) {
-                               ADOConnection::outp("Refreshing cached active record file: $fname");
-                       }
-               }
-               $activetab = new ADODB_Active_Table();
-               $activetab->name = $table;
-
-               $save = $ADODB_FETCH_MODE;
-               $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
-               if ($db->fetchMode !== false) {
-                       $savem = $db->SetFetchMode(false);
-               }
-
-               $cols = $db->MetaColumns($table);
-
-               if (isset($savem)) {
-                       $db->SetFetchMode($savem);
-               }
-               $ADODB_FETCH_MODE = $save;
-
-               if (!$cols) {
-                       $this->Error("Invalid table name: $table",'UpdateActiveTable');
-                       return false;
-               }
-               $fld = reset($cols);
-               if (!$pkeys) {
-                       if (isset($fld->primary_key)) {
-                               $pkeys = array();
-                               foreach($cols as $name => $fld) {
-                                       if (!empty($fld->primary_key)) {
-                                               $pkeys[] = $name;
-                                       }
-                               }
-                       } else {
-                               $pkeys = $this->GetPrimaryKeys($db, $table);
-                       }
-               }
-               if (empty($pkeys)) {
-                       $this->Error("No primary key found for table $table",'UpdateActiveTable');
-                       return false;
-               }
-
-               $attr = array();
-               $keys = array();
-
-               switch($ADODB_ASSOC_CASE) {
-               case 0:
-                       foreach($cols as $name => $fldobj) {
-                               $name = strtolower($name);
-                               if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) {
-                                       $this->$name = $fldobj->default_value;
-                               }
-                               else {
-                                       $this->$name = null;
-                               }
-                               $attr[$name] = $fldobj;
-                       }
-                       foreach($pkeys as $k => $name) {
-                               $keys[strtolower($name)] = strtolower($name);
-                       }
-                       break;
-
-               case 1:
-                       foreach($cols as $name => $fldobj) {
-                               $name = strtoupper($name);
-
-                               if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) {
-                                       $this->$name = $fldobj->default_value;
-                               }
-                               else {
-                                       $this->$name = null;
-                               }
-                               $attr[$name] = $fldobj;
-                       }
-
-                       foreach($pkeys as $k => $name) {
-                               $keys[strtoupper($name)] = strtoupper($name);
-                       }
-                       break;
-               default:
-                       foreach($cols as $name => $fldobj) {
-                               $name = ($fldobj->name);
-
-                               if ($ADODB_ACTIVE_DEFVALS && isset($fldobj->default_value)) {
-                                       $this->$name = $fldobj->default_value;
-                               }
-                               else {
-                                       $this->$name = null;
-                               }
-                               $attr[$name] = $fldobj;
-                       }
-                       foreach($pkeys as $k => $name) {
-                               $keys[$name] = $cols[$name]->name;
-                       }
-                       break;
-               }
-
-               $activetab->keys = $keys;
-               $activetab->flds = $attr;
-               $activetab->updateColsCount();
-
-               if ($ADODB_ACTIVE_CACHESECS && $ADODB_CACHE_DIR) {
-                       $activetab->_created = time();
-                       $s = serialize($activetab);
-                       if (!function_exists('adodb_write_file')) {
-                               include(ADODB_DIR.'/adodb-csvlib.inc.php');
-                       }
-                       adodb_write_file($fname,$s);
-               }
-               if (isset($activedb->tables[$table])) {
-                       $oldtab = $activedb->tables[$table];
-
-                       if ($oldtab) {
-                               $activetab->_belongsTo = $oldtab->_belongsTo;
-                               $activetab->_hasMany = $oldtab->_hasMany;
-                       }
-               }
-               $activedb->tables[$table] = $activetab;
-       }
-
-       function GetPrimaryKeys(&$db, $table)
-       {
-               return $db->MetaPrimaryKeys($table);
-       }
-
-       // error handler for both PHP4+5.
-       function Error($err,$fn)
-       {
-       global $_ADODB_ACTIVE_DBS;
-
-               $fn = get_class($this).'::'.$fn;
-               $this->_lasterr = $fn.': '.$err;
-
-               if ($this->_dbat < 0) {
-                       $db = false;
-               }
-               else {
-                       $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
-                       $db = $activedb->db;
-               }
-
-               if (function_exists('adodb_throw')) {
-                       if (!$db) {
-                               adodb_throw('ADOdb_Active_Record', $fn, -1, $err, 0, 0, false);
-                       }
-                       else {
-                               adodb_throw($db->databaseType, $fn, -1, $err, 0, 0, $db);
-                       }
-               } else {
-                       if (!$db || $db->debug) {
-                               ADOConnection::outp($this->_lasterr);
-                       }
-               }
-
-       }
-
-       // return last error message
-       function ErrorMsg()
-       {
-               if (!function_exists('adodb_throw')) {
-                       if ($this->_dbat < 0) {
-                               $db = false;
-                       }
-                       else {
-                               $db = $this->DB();
-                       }
-
-                       // last error could be database error too
-                       if ($db && $db->ErrorMsg()) {
-                               return $db->ErrorMsg();
-                       }
-               }
-               return $this->_lasterr;
-       }
-
-       function ErrorNo()
-       {
-               if ($this->_dbat < 0) {
-                       return -9999; // no database connection...
-               }
-               $db = $this->DB();
-
-               return (int) $db->ErrorNo();
-       }
-
-
-       // retrieve ADOConnection from _ADODB_Active_DBs
-       function DB()
-       {
-       global $_ADODB_ACTIVE_DBS;
-
-               if ($this->_dbat < 0) {
-                       $false = false;
-                       $this->Error("No database connection set: use ADOdb_Active_Record::SetDatabaseAdaptor(\$db)", "DB");
-                       return $false;
-               }
-               $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
-               $db = $activedb->db;
-               return $db;
-       }
-
-       // retrieve ADODB_Active_Table
-       function &TableInfo()
-       {
-       global $_ADODB_ACTIVE_DBS;
-
-               $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
-               $table = $activedb->tables[$this->_tableat];
-               return $table;
-       }
-
-
-       // I have an ON INSERT trigger on a table that sets other columns in the table.
-       // So, I find that for myTable, I want to reload an active record after saving it. -- Malcolm Cook
-       function Reload()
-       {
-               $db =& $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $table =& $this->TableInfo();
-               $where = $this->GenWhere($db, $table);
-               return($this->Load($where));
-       }
-
-
-       // set a numeric array (using natural table field ordering) as object properties
-       function Set(&$row)
-       {
-       global $ACTIVE_RECORD_SAFETY;
-
-               $db = $this->DB();
-
-               if (!$row) {
-                       $this->_saved = false;
-                       return false;
-               }
-
-               $this->_saved = true;
-
-               $table = $this->TableInfo();
-               $sizeofFlds = sizeof($table->flds);
-               $sizeofRow  = sizeof($row);
-               if ($ACTIVE_RECORD_SAFETY && $table->_colsCount != $sizeofRow && $sizeofFlds != $sizeofRow) {
-                       # <AP>
-                       $bad_size = TRUE;
-                       if($sizeofRow == 2 * $table->_colsCount || $sizeofRow == 2 * $sizeofFlds) {
-                               // Only keep string keys
-                               $keys = array_filter(array_keys($row), 'is_string');
-                               if (sizeof($keys) == sizeof($table->flds)) {
-                                       $bad_size = FALSE;
-                               }
-                       }
-                       if ($bad_size) {
-                               $this->Error("Table structure of $this->_table has changed","Load");
-                               return false;
-                       }
-                       # </AP>
-               }
-               else {
-                       $keys = array_keys($row);
-               }
-
-               # <AP>
-               reset($keys);
-               $this->_original = array();
-               foreach($table->flds as $name=>$fld) {
-                       $value = $row[current($keys)];
-                       $this->$name = $value;
-                       $this->_original[] = $value;
-                       if(!next($keys)) {
-                               break;
-                       }
-               }
-               $table =& $this->TableInfo();
-               foreach($table->_belongsTo as $foreignTable) {
-                       $ft = $foreignTable->TableInfo();
-                       $propertyName = $ft->name;
-                       foreach($ft->flds as $name=>$fld) {
-                               $value = $row[current($keys)];
-                               $foreignTable->$name = $value;
-                               $foreignTable->_original[] = $value;
-                               if(!next($keys)) {
-                                       break;
-                               }
-                       }
-               }
-               foreach($table->_hasMany as $foreignTable) {
-                       $ft = $foreignTable->TableInfo();
-                       foreach($ft->flds as $name=>$fld) {
-                               $value = $row[current($keys)];
-                               $foreignTable->$name = $value;
-                               $foreignTable->_original[] = $value;
-                               if(!next($keys)) {
-                                       break;
-                               }
-                       }
-               }
-               # </AP>
-
-               return true;
-       }
-
-       // get last inserted id for INSERT
-       function LastInsertID(&$db,$fieldname)
-       {
-               if ($db->hasInsertID) {
-                       $val = $db->Insert_ID($this->_table,$fieldname);
-               }
-               else {
-                       $val = false;
-               }
-
-               if (is_null($val) || $val === false) {
-                       // this might not work reliably in multi-user environment
-                       return $db->GetOne("select max(".$fieldname.") from ".$this->_table);
-               }
-               return $val;
-       }
-
-       // quote data in where clause
-       function doquote(&$db, $val,$t)
-       {
-               switch($t) {
-               case 'D':
-               case 'T':
-                       if (empty($val)) {
-                               return 'null';
-                       }
-               case 'C':
-               case 'X':
-                       if (is_null($val)) {
-                               return 'null';
-                       }
-                       if (strlen($val)>0 &&
-                               (strncmp($val,"'",1) != 0 || substr($val,strlen($val)-1,1) != "'")
-                       ) {
-                               return $db->qstr($val);
-                               break;
-                       }
-               default:
-                       return $val;
-                       break;
-               }
-       }
-
-       // generate where clause for an UPDATE/SELECT
-       function GenWhere(&$db, &$table)
-       {
-               $keys = $table->keys;
-               $parr = array();
-
-               foreach($keys as $k) {
-                       $f = $table->flds[$k];
-                       if ($f) {
-                               $parr[] = $k.' = '.$this->doquote($db,$this->$k,$db->MetaType($f->type));
-                       }
-               }
-               return implode(' and ', $parr);
-       }
-
-
-       //------------------------------------------------------------ Public functions below
-
-       function Load($where=null,$bindarr=false)
-       {
-               $db = $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $this->_where = $where;
-
-               $save = $db->SetFetchMode(ADODB_FETCH_NUM);
-               $qry = "select * from ".$this->_table;
-               $table =& $this->TableInfo();
-
-               if(($k = reset($table->keys))) {
-                       $hasManyId   = $k;
-               }
-               else {
-                       $hasManyId   = 'id';
-               }
-
-               foreach($table->_belongsTo as $foreignTable) {
-                       if(($k = reset($foreignTable->TableInfo()->keys))) {
-                               $belongsToId = $k;
-                       }
-                       else {
-                               $belongsToId = 'id';
-                       }
-                       $qry .= ' LEFT JOIN '.$foreignTable->_table.' ON '.
-                               $this->_table.'.'.$foreignTable->foreignKey.'='.
-                               $foreignTable->_table.'.'.$belongsToId;
-               }
-               foreach($table->_hasMany as $foreignTable)
-               {
-                       $qry .= ' LEFT JOIN '.$foreignTable->_table.' ON '.
-                               $this->_table.'.'.$hasManyId.'='.
-                               $foreignTable->_table.'.'.$foreignTable->foreignKey;
-               }
-               if($where) {
-                       $qry .= ' WHERE '.$where;
-               }
-
-               // Simple case: no relations. Load row and return.
-               if((count($table->_hasMany) + count($table->_belongsTo)) < 1) {
-                       $row = $db->GetRow($qry,$bindarr);
-                       if(!$row) {
-                               return false;
-                       }
-                       $db->SetFetchMode($save);
-                       return $this->Set($row);
-               }
-
-               // More complex case when relations have to be collated
-               $rows = $db->GetAll($qry,$bindarr);
-               if(!$rows) {
-                       return false;
-               }
-               $db->SetFetchMode($save);
-               if(count($rows) < 1) {
-                       return false;
-               }
-               $class = get_class($this);
-               $isFirstRow = true;
-
-               if(($k = reset($this->TableInfo()->keys))) {
-                       $myId   = $k;
-               }
-               else {
-                       $myId   = 'id';
-               }
-               $index = 0; $found = false;
-               /** @todo Improve by storing once and for all in table metadata */
-               /** @todo Also re-use info for hasManyId */
-               foreach($this->TableInfo()->flds as $fld) {
-                       if($fld->name == $myId) {
-                               $found = true;
-                               break;
-                       }
-                       $index++;
-               }
-               if(!$found) {
-                       $this->outp_throw("Unable to locate key $myId for $class in Load()",'Load');
-               }
-
-               foreach($rows as $row) {
-                       $rowId = intval($row[$index]);
-                       if($rowId > 0) {
-                               if($isFirstRow) {
-                                       $isFirstRow = false;
-                                       if(!$this->Set($row)) {
-                                               return false;
-                                       }
-                               }
-                               $obj = new $class($table,false,$db);
-                               $obj->Set($row);
-                               // TODO Copy/paste code below: bad!
-                               if(count($table->_hasMany) > 0) {
-                                       foreach($table->_hasMany as $foreignTable) {
-                                               $foreignName = $foreignTable->foreignName;
-                                               if(!empty($obj->$foreignName)) {
-                                                       if(!is_array($this->$foreignName)) {
-                                                               $foreignObj = $this->$foreignName;
-                                                               $this->$foreignName = array(clone($foreignObj));
-                                                       }
-                                                       else {
-                                                               $foreignObj = $obj->$foreignName;
-                                                               array_push($this->$foreignName, clone($foreignObj));
-                                                       }
-                                               }
-                                       }
-                               }
-                               if(count($table->_belongsTo) > 0) {
-                                       foreach($table->_belongsTo as $foreignTable) {
-                                               $foreignName = $foreignTable->foreignName;
-                                               if(!empty($obj->$foreignName)) {
-                                                       if(!is_array($this->$foreignName)) {
-                                                               $foreignObj = $this->$foreignName;
-                                                               $this->$foreignName = array(clone($foreignObj));
-                                                       }
-                                                       else {
-                                                               $foreignObj = $obj->$foreignName;
-                                                               array_push($this->$foreignName, clone($foreignObj));
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-               return true;
-       }
-
-       // false on error
-       function Save()
-       {
-               if ($this->_saved) {
-                       $ok = $this->Update();
-               }
-               else {
-                       $ok = $this->Insert();
-               }
-
-               return $ok;
-       }
-
-       // CFR: Sometimes we may wish to consider that an object is not to be replaced but inserted.
-       // Sample use case: an 'undo' command object (after a delete())
-       function Dirty()
-       {
-               $this->_saved = false;
-       }
-
-       // false on error
-       function Insert()
-       {
-               $db = $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $cnt = 0;
-               $table = $this->TableInfo();
-
-               $valarr = array();
-               $names = array();
-               $valstr = array();
-
-               foreach($table->flds as $name=>$fld) {
-                       $val = $this->$name;
-                       if(!is_null($val) || !array_key_exists($name, $table->keys)) {
-                               $valarr[] = $val;
-                               $names[] = $name;
-                               $valstr[] = $db->Param($cnt);
-                               $cnt += 1;
-                       }
-               }
-
-               if (empty($names)){
-                       foreach($table->flds as $name=>$fld) {
-                               $valarr[] = null;
-                               $names[] = $name;
-                               $valstr[] = $db->Param($cnt);
-                               $cnt += 1;
-                       }
-               }
-               $sql = 'INSERT INTO '.$this->_table."(".implode(',',$names).') VALUES ('.implode(',',$valstr).')';
-               $ok = $db->Execute($sql,$valarr);
-
-               if ($ok) {
-                       $this->_saved = true;
-                       $autoinc = false;
-                       foreach($table->keys as $k) {
-                               if (is_null($this->$k)) {
-                                       $autoinc = true;
-                                       break;
-                               }
-                       }
-                       if ($autoinc && sizeof($table->keys) == 1) {
-                               $k = reset($table->keys);
-                               $this->$k = $this->LastInsertID($db,$k);
-                       }
-               }
-
-               $this->_original = $valarr;
-               return !empty($ok);
-       }
-
-       function Delete()
-       {
-               $db = $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $table = $this->TableInfo();
-
-               $where = $this->GenWhere($db,$table);
-               $sql = 'DELETE FROM '.$this->_table.' WHERE '.$where;
-               $ok = $db->Execute($sql);
-
-               return $ok ? true : false;
-       }
-
-       // returns an array of active record objects
-       function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array())
-       {
-               $db = $this->DB();
-               if (!$db || empty($this->_table)) {
-                       return false;
-               }
-               $table =& $this->TableInfo();
-               $arr = $db->GetActiveRecordsClass(get_class($this),$this, $whereOrderBy,$bindarr,$pkeysArr,$extra,
-                       array('foreignName'=>$this->foreignName, 'belongsTo'=>$table->_belongsTo, 'hasMany'=>$table->_hasMany));
-               return $arr;
-       }
-
-       // CFR: In introduced this method to ensure that inner workings are not disturbed by
-       // subclasses...for instance when GetActiveRecordsClass invokes Find()
-       // Why am I not invoking parent::Find?
-       // Shockingly because I want to preserve PHP4 compatibility.
-       function packageFind($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array())
-       {
-               $db = $this->DB();
-               if (!$db || empty($this->_table)) {
-                       return false;
-               }
-               $table =& $this->TableInfo();
-               $arr = $db->GetActiveRecordsClass(get_class($this),$this, $whereOrderBy,$bindarr,$pkeysArr,$extra,
-                       array('foreignName'=>$this->foreignName, 'belongsTo'=>$table->_belongsTo, 'hasMany'=>$table->_hasMany));
-               return $arr;
-       }
-
-       // returns 0 on error, 1 on update, 2 on insert
-       function Replace()
-       {
-       global $ADODB_ASSOC_CASE;
-
-               $db = $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $table = $this->TableInfo();
-
-               $pkey = $table->keys;
-
-               foreach($table->flds as $name=>$fld) {
-                       $val = $this->$name;
-                       /*
-                       if (is_null($val)) {
-                               if (isset($fld->not_null) && $fld->not_null) {
-                                       if (isset($fld->default_value) && strlen($fld->default_value)) {
-                                               continue;
-                                       }
-                                       else {
-                                               $this->Error("Cannot update null into $name","Replace");
-                                               return false;
-                                       }
-                               }
-                       }*/
-                       if (is_null($val) && !empty($fld->auto_increment)) {
-                               continue;
-                       }
-                       $t = $db->MetaType($fld->type);
-                       $arr[$name] = $this->doquote($db,$val,$t);
-                       $valarr[] = $val;
-               }
-
-               if (!is_array($pkey)) {
-                       $pkey = array($pkey);
-               }
-
-
-               switch ($ADODB_ASSOC_CASE == 0) {
-                       case ADODB_ASSOC_CASE_LOWER:
-                               foreach($pkey as $k => $v) {
-                                       $pkey[$k] = strtolower($v);
-                               }
-                               break;
-                       case ADODB_ASSOC_CASE_UPPER:
-                               foreach($pkey as $k => $v) {
-                                       $pkey[$k] = strtoupper($v);
-                               }
-                               break;
-               }
-
-               $ok = $db->Replace($this->_table,$arr,$pkey);
-               if ($ok) {
-                       $this->_saved = true; // 1= update 2=insert
-                       if ($ok == 2) {
-                               $autoinc = false;
-                               foreach($table->keys as $k) {
-                                       if (is_null($this->$k)) {
-                                               $autoinc = true;
-                                               break;
-                                       }
-                               }
-                               if ($autoinc && sizeof($table->keys) == 1) {
-                                       $k = reset($table->keys);
-                                       $this->$k = $this->LastInsertID($db,$k);
-                               }
-                       }
-
-                       $this->_original = $valarr;
-               }
-               return $ok;
-       }
-
-       // returns 0 on error, 1 on update, -1 if no change in data (no update)
-       function Update()
-       {
-               $db = $this->DB();
-               if (!$db) {
-                       return false;
-               }
-               $table = $this->TableInfo();
-
-               $where = $this->GenWhere($db, $table);
-
-               if (!$where) {
-                       $this->error("Where missing for table $table", "Update");
-                       return false;
-               }
-               $valarr = array();
-               $neworig = array();
-               $pairs = array();
-               $i = -1;
-               $cnt = 0;
-               foreach($table->flds as $name=>$fld) {
-                       $i += 1;
-                       $val = $this->$name;
-                       $neworig[] = $val;
-
-                       if (isset($table->keys[$name])) {
-                               continue;
-                       }
-
-                       if (is_null($val)) {
-                               if (isset($fld->not_null) && $fld->not_null) {
-                                       if (isset($fld->default_value) && strlen($fld->default_value)) {
-                                               continue;
-                                       }
-                                       else {
-                                               $this->Error("Cannot set field $name to NULL","Update");
-                                               return false;
-                                       }
-                               }
-                       }
-
-                       if (isset($this->_original[$i]) && $val === $this->_original[$i]) {
-                               continue;
-                       }
-                       $valarr[] = $val;
-                       $pairs[] = $name.'='.$db->Param($cnt);
-                       $cnt += 1;
-               }
-
-
-               if (!$cnt) {
-                       return -1;
-               }
-               $sql = 'UPDATE '.$this->_table." SET ".implode(",",$pairs)." WHERE ".$where;
-               $ok = $db->Execute($sql,$valarr);
-               if ($ok) {
-                       $this->_original = $neworig;
-                       return 1;
-               }
-               return 0;
-       }
-
-       function GetAttributeNames()
-       {
-               $table = $this->TableInfo();
-               if (!$table) {
-                       return false;
-               }
-               return array_keys($table->flds);
-       }
-
-};
-
-function adodb_GetActiveRecordsClass(&$db, $class, $tableObj,$whereOrderBy,$bindarr, $primkeyArr,
-                       $extra, $relations)
-{
-       global $_ADODB_ACTIVE_DBS;
-
-               if (empty($extra['loading'])) {
-                       $extra['loading'] = ADODB_LAZY_AR;
-               }
-               $save = $db->SetFetchMode(ADODB_FETCH_NUM);
-               $table = &$tableObj->_table;
-               $tableInfo =& $tableObj->TableInfo();
-               if(($k = reset($tableInfo->keys))) {
-                       $myId = $k;
-               }
-               else {
-                       $myId = 'id';
-               }
-               $index = 0; $found = false;
-               /** @todo Improve by storing once and for all in table metadata */
-               /** @todo Also re-use info for hasManyId */
-               foreach($tableInfo->flds as $fld)
-               {
-                       if($fld->name == $myId) {
-                               $found = true;
-                               break;
-                       }
-                       $index++;
-               }
-               if(!$found) {
-                       $db->outp_throw("Unable to locate key $myId for $class in GetActiveRecordsClass()",'GetActiveRecordsClass');
-               }
-
-               $qry = "select * from ".$table;
-               if(ADODB_JOIN_AR == $extra['loading']) {
-                       if(!empty($relations['belongsTo'])) {
-                               foreach($relations['belongsTo'] as $foreignTable) {
-                                       if(($k = reset($foreignTable->TableInfo()->keys))) {
-                                               $belongsToId = $k;
-                                       }
-                                       else {
-                                               $belongsToId = 'id';
-                                       }
-
-                                       $qry .= ' LEFT JOIN '.$foreignTable->_table.' ON '.
-                                               $table.'.'.$foreignTable->foreignKey.'='.
-                                               $foreignTable->_table.'.'.$belongsToId;
-                               }
-                       }
-                       if(!empty($relations['hasMany'])) {
-                               if(empty($relations['foreignName'])) {
-                                       $db->outp_throw("Missing foreignName is relation specification in GetActiveRecordsClass()",'GetActiveRecordsClass');
-                               }
-                               if(($k = reset($tableInfo->keys))) {
-                                       $hasManyId   = $k;
-                               }
-                               else {
-                                       $hasManyId   = 'id';
-                               }
-
-                               foreach($relations['hasMany'] as $foreignTable) {
-                                       $qry .= ' LEFT JOIN '.$foreignTable->_table.' ON '.
-                                               $table.'.'.$hasManyId.'='.
-                                               $foreignTable->_table.'.'.$foreignTable->foreignKey;
-                               }
-                       }
-               }
-               if (!empty($whereOrderBy)) {
-                       $qry .= ' WHERE '.$whereOrderBy;
-               }
-               if(isset($extra['limit'])) {
-                       $rows = false;
-                       if(isset($extra['offset'])) {
-                               $rs = $db->SelectLimit($qry, $extra['limit'], $extra['offset']);
-                       } else {
-                               $rs = $db->SelectLimit($qry, $extra['limit']);
-                       }
-                       if ($rs) {
-                               while (!$rs->EOF) {
-                                       $rows[] = $rs->fields;
-                                       $rs->MoveNext();
-                               }
-                       }
-               } else
-                       $rows = $db->GetAll($qry,$bindarr);
-
-               $db->SetFetchMode($save);
-
-               $false = false;
-
-               if ($rows === false) {
-                       return $false;
-               }
-
-
-               if (!isset($_ADODB_ACTIVE_DBS)) {
-                       include(ADODB_DIR.'/adodb-active-record.inc.php');
-               }
-               if (!class_exists($class)) {
-                       $db->outp_throw("Unknown class $class in GetActiveRecordsClass()",'GetActiveRecordsClass');
-                       return $false;
-               }
-               $uniqArr = array(); // CFR Keep track of records for relations
-               $arr = array();
-               // arrRef will be the structure that knows about our objects.
-               // It is an associative array.
-               // We will, however, return arr, preserving regular 0.. order so that
-               // obj[0] can be used by app developpers.
-               $arrRef = array();
-               $bTos = array(); // Will store belongTo's indices if any
-               foreach($rows as $row) {
-
-                       $obj = new $class($table,$primkeyArr,$db);
-                       if ($obj->ErrorNo()){
-                               $db->_errorMsg = $obj->ErrorMsg();
-                               return $false;
-                       }
-                       $obj->Set($row);
-                       // CFR: FIXME: Insane assumption here:
-                       // If the first column returned is an integer, then it's a 'id' field
-                       // And to make things a bit worse, I use intval() rather than is_int() because, in fact,
-                       // $row[0] is not an integer.
-                       //
-                       // So, what does this whole block do?
-                       // When relationships are found, we perform JOINs. This is fast. But not accurate:
-                       // instead of returning n objects with their n' associated cousins,
-                       // we get n*n' objects. This code fixes this.
-                       // Note: to-many relationships mess around with the 'limit' parameter
-                       $rowId = intval($row[$index]);
-
-                       if(ADODB_WORK_AR == $extra['loading']) {
-                               $arrRef[$rowId] = $obj;
-                               $arr[] = &$arrRef[$rowId];
-                               if(!isset($indices)) {
-                                       $indices = $rowId;
-                               }
-                               else {
-                                       $indices .= ','.$rowId;
-                               }
-                               if(!empty($relations['belongsTo'])) {
-                                       foreach($relations['belongsTo'] as $foreignTable) {
-                                               $foreignTableRef = $foreignTable->foreignKey;
-                                               // First array: list of foreign ids we are looking for
-                                               if(empty($bTos[$foreignTableRef])) {
-                                                       $bTos[$foreignTableRef] = array();
-                                               }
-                                               // Second array: list of ids found
-                                               if(empty($obj->$foreignTableRef)) {
-                                                       continue;
-                                               }
-                                               if(empty($bTos[$foreignTableRef][$obj->$foreignTableRef])) {
-                                                       $bTos[$foreignTableRef][$obj->$foreignTableRef] = array();
-                                               }
-                                               $bTos[$foreignTableRef][$obj->$foreignTableRef][] = $obj;
-                                       }
-                               }
-                               continue;
-                       }
-
-                       if($rowId>0) {
-                               if(ADODB_JOIN_AR == $extra['loading']) {
-                                       $isNewObj = !isset($uniqArr['_'.$row[0]]);
-                                       if($isNewObj) {
-                                               $uniqArr['_'.$row[0]] = $obj;
-                                       }
-
-                                       // TODO Copy/paste code below: bad!
-                                       if(!empty($relations['hasMany'])) {
-                                               foreach($relations['hasMany'] as $foreignTable) {
-                                                       $foreignName = $foreignTable->foreignName;
-                                                       if(!empty($obj->$foreignName)) {
-                                                               $masterObj = &$uniqArr['_'.$row[0]];
-                                                               // Assumption: this property exists in every object since they are instances of the same class
-                                                               if(!is_array($masterObj->$foreignName)) {
-                                                                       // Pluck!
-                                                                       $foreignObj = $masterObj->$foreignName;
-                                                                       $masterObj->$foreignName = array(clone($foreignObj));
-                                                               }
-                                                               else {
-                                                                       // Pluck pluck!
-                                                                       $foreignObj = $obj->$foreignName;
-                                                                       array_push($masterObj->$foreignName, clone($foreignObj));
-                                                               }
-                                                       }
-                                               }
-                                       }
-                                       if(!empty($relations['belongsTo'])) {
-                                               foreach($relations['belongsTo'] as $foreignTable) {
-                                                       $foreignName = $foreignTable->foreignName;
-                                                       if(!empty($obj->$foreignName)) {
-                                                               $masterObj = &$uniqArr['_'.$row[0]];
-                                                               // Assumption: this property exists in every object since they are instances of the same class
-                                                               if(!is_array($masterObj->$foreignName)) {
-                                                                       // Pluck!
-                                                                       $foreignObj = $masterObj->$foreignName;
-                                                                       $masterObj->$foreignName = array(clone($foreignObj));
-                                                               }
-                                                               else {
-                                                                       // Pluck pluck!
-                                                                       $foreignObj = $obj->$foreignName;
-                                                                       array_push($masterObj->$foreignName, clone($foreignObj));
-                                                               }
-                                                       }
-                                               }
-                                       }
-                                       if(!$isNewObj) {
-                                               unset($obj); // We do not need this object itself anymore and do not want it re-added to the main array
-                                       }
-                               }
-                               else if(ADODB_LAZY_AR == $extra['loading']) {
-                                       // Lazy loading: we need to give AdoDb a hint that we have not really loaded
-                                       // anything, all the while keeping enough information on what we wish to load.
-                                       // Let's do this by keeping the relevant info in our relationship arrays
-                                       // but get rid of the actual properties.
-                                       // We will then use PHP's __get to load these properties on-demand.
-                                       if(!empty($relations['hasMany'])) {
-                                               foreach($relations['hasMany'] as $foreignTable) {
-                                                       $foreignName = $foreignTable->foreignName;
-                                                       if(!empty($obj->$foreignName)) {
-                                                               unset($obj->$foreignName);
-                                                       }
-                                               }
-                                       }
-                                       if(!empty($relations['belongsTo'])) {
-                                               foreach($relations['belongsTo'] as $foreignTable) {
-                                                       $foreignName = $foreignTable->foreignName;
-                                                       if(!empty($obj->$foreignName)) {
-                                                               unset($obj->$foreignName);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-
-                       if(isset($obj)) {
-                               $arr[] = $obj;
-                       }
-               }
-
-               if(ADODB_WORK_AR == $extra['loading']) {
-                       // The best of both worlds?
-                       // Here, the number of queries is constant: 1 + n*relationship.
-                       // The second query will allow us to perform a good join
-                       // while preserving LIMIT etc.
-                       if(!empty($relations['hasMany'])) {
-                               foreach($relations['hasMany'] as $foreignTable) {
-                                       $foreignName = $foreignTable->foreignName;
-                                       $className = ucfirst($foreignTable->_singularize($foreignName));
-                                       $obj = new $className();
-                                       $dbClassRef = $foreignTable->foreignKey;
-                                       $objs = $obj->packageFind($dbClassRef.' IN ('.$indices.')');
-                                       foreach($objs as $obj) {
-                                               if(!is_array($arrRef[$obj->$dbClassRef]->$foreignName)) {
-                                                       $arrRef[$obj->$dbClassRef]->$foreignName = array();
-                                               }
-                                               array_push($arrRef[$obj->$dbClassRef]->$foreignName, $obj);
-                                       }
-                               }
-
-                       }
-                       if(!empty($relations['belongsTo'])) {
-                               foreach($relations['belongsTo'] as $foreignTable) {
-                                       $foreignTableRef = $foreignTable->foreignKey;
-                                       if(empty($bTos[$foreignTableRef])) {
-                                               continue;
-                                       }
-                                       if(($k = reset($foreignTable->TableInfo()->keys))) {
-                                               $belongsToId = $k;
-                                       }
-                                       else {
-                                               $belongsToId = 'id';
-                                       }
-                                       $origObjsArr = $bTos[$foreignTableRef];
-                                       $bTosString = implode(',', array_keys($bTos[$foreignTableRef]));
-                                       $foreignName = $foreignTable->foreignName;
-                                       $className = ucfirst($foreignTable->_singularize($foreignName));
-                                       $obj = new $className();
-                                       $objs = $obj->packageFind($belongsToId.' IN ('.$bTosString.')');
-                                       foreach($objs as $obj)
-                                       {
-                                               foreach($origObjsArr[$obj->$belongsToId] as $idx=>$origObj)
-                                               {
-                                                       $origObj->$foreignName = $obj;
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               return $arr;
-}
diff --git a/typo3/sysext/adodb/adodb/adodb-csvlib.inc.php b/typo3/sysext/adodb/adodb/adodb-csvlib.inc.php
deleted file mode 100644 (file)
index c306235..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-<?php
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-global $ADODB_INCLUDED_CSV;
-$ADODB_INCLUDED_CSV = 1;
-
-/*
-
-  @version   v5.20.3  01-Jan-2016
-  @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 http://adodb.sourceforge.net
-
-  Library for CSV serialization. This is used by the csv/proxy driver and is the
-  CacheExecute() serialization format.
-
-  ==== NOTE ====
-  Format documented at http://php.weblogs.com/ADODB_CSV
-  ==============
-*/
-
-       /**
-        * convert a recordset into special format
-        *
-        * @param rs    the recordset
-        *
-        * @return      the CSV formated data
-        */
-       function _rs2serialize(&$rs,$conn=false,$sql='')
-       {
-               $max = ($rs) ? $rs->FieldCount() : 0;
-
-               if ($sql) $sql = urlencode($sql);
-               // metadata setup
-
-               if ($max <= 0 || $rs->dataProvider == 'empty') { // is insert/update/delete
-                       if (is_object($conn)) {
-                               $sql .= ','.$conn->Affected_Rows();
-                               $sql .= ','.$conn->Insert_ID();
-                       } else
-                               $sql .= ',,';
-
-                       $text = "====-1,0,$sql\n";
-                       return $text;
-               }
-               $tt = ($rs->timeCreated) ? $rs->timeCreated : time();
-
-               ## changed format from ====0 to ====1
-               $line = "====1,$tt,$sql\n";
-
-               if ($rs->databaseType == 'array') {
-                       $rows = $rs->_array;
-               } else {
-                       $rows = array();
-                       while (!$rs->EOF) {
-                               $rows[] = $rs->fields;
-                               $rs->MoveNext();
-                       }
-               }
-
-               for($i=0; $i < $max; $i++) {
-                       $o = $rs->FetchField($i);
-                       $flds[] = $o;
-               }
-
-               $savefetch = isset($rs->adodbFetchMode) ? $rs->adodbFetchMode : $rs->fetchMode;
-               $class = $rs->connection->arrayClass;
-               $rs2 = new $class();
-               $rs2->timeCreated = $rs->timeCreated; # memcache fix
-               $rs2->sql = $rs->sql;
-               $rs2->oldProvider = $rs->dataProvider;
-               $rs2->InitArrayFields($rows,$flds);
-               $rs2->fetchMode = $savefetch;
-               return $line.serialize($rs2);
-       }
-
-
-/**
-* Open CSV file and convert it into Data.
-*
-* @param url           file/ftp/http url
-* @param err           returns the error message
-* @param timeout       dispose if recordset has been alive for $timeout secs
-*
-* @return              recordset, or false if error occured. If no
-*                      error occurred in sql INSERT/UPDATE/DELETE,
-*                      empty recordset is returned
-*/
-       function csv2rs($url,&$err,$timeout=0, $rsclass='ADORecordSet_array')
-       {
-               $false = false;
-               $err = false;
-               $fp = @fopen($url,'rb');
-               if (!$fp) {
-                       $err = $url.' file/URL not found';
-                       return $false;
-               }
-               @flock($fp, LOCK_SH);
-               $arr = array();
-               $ttl = 0;
-
-               if ($meta = fgetcsv($fp, 32000, ",")) {
-                       // check if error message
-                       if (strncmp($meta[0],'****',4) === 0) {
-                               $err = trim(substr($meta[0],4,1024));
-                               fclose($fp);
-                               return $false;
-                       }
-                       // check for meta data
-                       // $meta[0] is -1 means return an empty recordset
-                       // $meta[1] contains a time
-
-                       if (strncmp($meta[0], '====',4) === 0) {
-
-                               if ($meta[0] == "====-1") {
-                                       if (sizeof($meta) < 5) {
-                                               $err = "Corrupt first line for format -1";
-                                               fclose($fp);
-                                               return $false;
-                                       }
-                                       fclose($fp);
-
-                                       if ($timeout > 0) {
-                                               $err = " Illegal Timeout $timeout ";
-                                               return $false;
-                                       }
-
-                                       $rs = new $rsclass($val=true);
-                                       $rs->fields = array();
-                                       $rs->timeCreated = $meta[1];
-                                       $rs->EOF = true;
-                                       $rs->_numOfFields = 0;
-                                       $rs->sql = urldecode($meta[2]);
-                                       $rs->affectedrows = (integer)$meta[3];
-                                       $rs->insertid = $meta[4];
-                                       return $rs;
-                               }
-                       # Under high volume loads, we want only 1 thread/process to _write_file
-                       # so that we don't have 50 processes queueing to write the same data.
-                       # We use probabilistic timeout, ahead of time.
-                       #
-                       # -4 sec before timeout, give processes 1/32 chance of timing out
-                       # -2 sec before timeout, give processes 1/16 chance of timing out
-                       # -1 sec after timeout give processes 1/4 chance of timing out
-                       # +0 sec after timeout, give processes 100% chance of timing out
-                               if (sizeof($meta) > 1) {
-                                       if($timeout >0){
-                                               $tdiff = (integer)( $meta[1]+$timeout - time());
-                                               if ($tdiff <= 2) {
-                                                       switch($tdiff) {
-                                                       case 4:
-                                                       case 3:
-                                                               if ((rand() & 31) == 0) {
-                                                                       fclose($fp);
-                                                                       $err = "Timeout 3";
-                                                                       return $false;
-                                                               }
-                                                               break;
-                                                       case 2:
-                                                               if ((rand() & 15) == 0) {
-                                                                       fclose($fp);
-                                                                       $err = "Timeout 2";
-                                                                       return $false;
-                                                               }
-                                                               break;
-                                                       case 1:
-                                                               if ((rand() & 3) == 0) {
-                                                                       fclose($fp);
-                                                                       $err = "Timeout 1";
-                                                                       return $false;
-                                                               }
-                                                               break;
-                                                       default:
-                                                               fclose($fp);
-                                                               $err = "Timeout 0";
-                                                               return $false;
-                                                       } // switch
-
-                                               } // if check flush cache
-                                       }// (timeout>0)
-                                       $ttl = $meta[1];
-                               }
-                               //================================================
-                               // new cache format - use serialize extensively...
-                               if ($meta[0] === '====1') {
-                                       // slurp in the data
-                                       $MAXSIZE = 128000;
-
-                                       $text = fread($fp,$MAXSIZE);
-                                       if (strlen($text)) {
-                                               while ($txt = fread($fp,$MAXSIZE)) {
-                                                       $text .= $txt;
-                                               }
-                                       }
-                                       fclose($fp);
-                                       $rs = unserialize($text);
-                                       if (is_object($rs)) $rs->timeCreated = $ttl;
-                                       else {
-                                               $err = "Unable to unserialize recordset";
-                                               //echo htmlspecialchars($text),' !--END--!<p>';
-                                       }
-                                       return $rs;
-                               }
-
-                               $meta = false;
-                               $meta = fgetcsv($fp, 32000, ",");
-                               if (!$meta) {
-                                       fclose($fp);
-                                       $err = "Unexpected EOF 1";
-                                       return $false;
-                               }
-                       }
-
-                       // Get Column definitions
-                       $flds = array();
-                       foreach($meta as $o) {
-                               $o2 = explode(':',$o);
-                               if (sizeof($o2)!=3) {
-                                       $arr[] = $meta;
-                                       $flds = false;
-                                       break;
-                               }
-                               $fld = new ADOFieldObject();
-                               $fld->name = urldecode($o2[0]);
-                               $fld->type = $o2[1];
-                               $fld->max_length = $o2[2];
-                               $flds[] = $fld;
-                       }
-               } else {
-                       fclose($fp);
-                       $err = "Recordset had unexpected EOF 2";
-                       return $false;
-               }
-
-               // slurp in the data
-               $MAXSIZE = 128000;
-
-               $text = '';
-               while ($txt = fread($fp,$MAXSIZE)) {
-                       $text .= $txt;
-               }
-
-               fclose($fp);
-               @$arr = unserialize($text);
-               //var_dump($arr);
-               if (!is_array($arr)) {
-                       $err = "Recordset had unexpected EOF (in serialized recordset)";
-                       if (get_magic_quotes_runtime()) $err .= ". Magic Quotes Runtime should be disabled!";
-                       return $false;
-               }
-               $rs = new $rsclass();
-               $rs->timeCreated = $ttl;
-               $rs->InitArrayFields($arr,$flds);
-               return $rs;
-       }
-
-
-       /**
-       * Save a file $filename and its $contents (normally for caching) with file locking
-       * Returns true if ok, false if fopen/fwrite error, 0 if rename error (eg. file is locked)
-       */
-       function adodb_write_file($filename, $contents,$debug=false)
-       {
-       # http://www.php.net/bugs.php?id=9203 Bug that flock fails on Windows
-       # So to simulate locking, we assume that rename is an atomic operation.
-       # First we delete $filename, then we create a $tempfile write to it and
-       # rename to the desired $filename. If the rename works, then we successfully
-       # modified the file exclusively.
-       # What a stupid need - having to simulate locking.
-       # Risks:
-       # 1. $tempfile name is not unique -- very very low
-       # 2. unlink($filename) fails -- ok, rename will fail
-       # 3. adodb reads stale file because unlink fails -- ok, $rs timeout occurs
-       # 4. another process creates $filename between unlink() and rename() -- ok, rename() fails and  cache updated
-               if (strncmp(PHP_OS,'WIN',3) === 0) {
-                       // skip the decimal place
-                       $mtime = substr(str_replace(' ','_',microtime()),2);
-                       // getmypid() actually returns 0 on Win98 - never mind!
-                       $tmpname = $filename.uniqid($mtime).getmypid();
-                       if (!($fd = @fopen($tmpname,'w'))) return false;
-                       if (fwrite($fd,$contents)) $ok = true;
-                       else $ok = false;
-                       fclose($fd);
-
-                       if ($ok) {
-                               @chmod($tmpname,0644);
-                               // the tricky moment
-                               @unlink($filename);
-                               if (!@rename($tmpname,$filename)) {
-                                       @unlink($tmpname);
-                                       $ok = 0;
-                               }
-                               if (!$ok) {
-                                       if ($debug) ADOConnection::outp( " Rename $tmpname ".($ok? 'ok' : 'failed'));
-                               }
-                       }
-                       return $ok;
-               }
-               if (!($fd = @fopen($filename, 'a'))) return false;
-               if (flock($fd, LOCK_EX) && ftruncate($fd, 0)) {
-                       if (fwrite( $fd, $contents )) $ok = true;
-                       else $ok = false;
-                       fclose($fd);
-                       @chmod($filename,0644);
-               }else {
-                       fclose($fd);
-                       if ($debug)ADOConnection::outp( " Failed acquiring lock for $filename<br>\n");
-                       $ok = false;
-               }
-
-               return $ok;
-       }
diff --git a/typo3/sysext/adodb/adodb/adodb-datadict.inc.php b/typo3/sysext/adodb/adodb/adodb-datadict.inc.php
deleted file mode 100644 (file)
index e7629ca..0000000
+++ /dev/null
@@ -1,1035 +0,0 @@
-<?php
-
-/**
-  @version   v5.20.3  01-Jan-2016
-  @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.
-
-       DOCUMENTATION:
-
-               See adodb/tests/test-datadict.php for docs and examples.
-*/
-
-/*
-       Test script for parser
-*/
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-function Lens_ParseTest()
-{
-$str = "`zcol ACOL` NUMBER(32,2) DEFAULT 'The \"cow\" (and Jim''s dog) jumps over the moon' PRIMARY, INTI INT AUTO DEFAULT 0, zcol2\"afs ds";
-print "<p>$str</p>";
-$a= Lens_ParseArgs($str);
-print "<pre>";
-print_r($a);
-print "</pre>";
-}
-
-
-if (!function_exists('ctype_alnum')) {
-       function ctype_alnum($text) {
-               return preg_match('/^[a-z0-9]*$/i', $text);
-       }
-}
-
-//Lens_ParseTest();
-
-/**
-       Parse arguments, treat "text" (text) and 'text' as quotation marks.
-       To escape, use "" or '' or ))
-
-       Will read in "abc def" sans quotes, as: abc def
-       Same with 'abc def'.
-       However if `abc def`, then will read in as `abc def`
-
-       @param endstmtchar    Character that indicates end of statement
-       @param tokenchars     Include the following characters in tokens apart from A-Z and 0-9
-       @returns 2 dimensional array containing parsed tokens.
-*/
-function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
-{
-       $pos = 0;
-       $intoken = false;
-       $stmtno = 0;
-       $endquote = false;
-       $tokens = array();
-       $tokens[$stmtno] = array();
-       $max = strlen($args);
-       $quoted = false;
-       $tokarr = array();
-
-       while ($pos < $max) {
-               $ch = substr($args,$pos,1);
-               switch($ch) {
-               case ' ':
-               case "\t":
-               case "\n":
-               case "\r":
-                       if (!$quoted) {
-                               if ($intoken) {
-                                       $intoken = false;
-                                       $tokens[$stmtno][] = implode('',$tokarr);
-                               }
-                               break;
-                       }
-
-                       $tokarr[] = $ch;
-                       break;
-
-               case '`':
-                       if ($intoken) $tokarr[] = $ch;
-               case '(':
-               case ')':
-               case '"':
-               case "'":
-
-                       if ($intoken) {
-                               if (empty($endquote)) {
-                                       $tokens[$stmtno][] = implode('',$tokarr);
-                                       if ($ch == '(') $endquote = ')';
-                                       else $endquote = $ch;
-                                       $quoted = true;
-                                       $intoken = true;
-                                       $tokarr = array();
-                               } else if ($endquote == $ch) {
-                                       $ch2 = substr($args,$pos+1,1);
-                                       if ($ch2 == $endquote) {
-                                               $pos += 1;
-                                               $tokarr[] = $ch2;
-                                       } else {
-                                               $quoted = false;
-                                               $intoken = false;
-                                               $tokens[$stmtno][] = implode('',$tokarr);
-                                               $endquote = '';
-                                       }
-                               } else
-                                       $tokarr[] = $ch;
-
-                       }else {
-
-                               if ($ch == '(') $endquote = ')';
-                               else $endquote = $ch;
-                               $quoted = true;
-                               $intoken = true;
-                               $tokarr = array();
-                               if ($ch == '`') $tokarr[] = '`';
-                       }
-                       break;
-
-               default:
-
-                       if (!$intoken) {
-                               if ($ch == $endstmtchar) {
-                                       $stmtno += 1;
-                                       $tokens[$stmtno] = array();
-                                       break;
-                               }
-
-                               $intoken = true;
-                               $quoted = false;
-                               $endquote = false;
-                               $tokarr = array();
-
-                       }
-
-                       if ($quoted) $tokarr[] = $ch;
-                       else if (ctype_alnum($ch) || strpos($tokenchars,$ch) !== false) $tokarr[] = $ch;
-                       else {
-                               if ($ch == $endstmtchar) {
-                                       $tokens[$stmtno][] = implode('',$tokarr);
-                                       $stmtno += 1;
-                                       $tokens[$stmtno] = array();
-                                       $intoken = false;
-                                       $tokarr = array();
-                                       break;
-                               }
-                               $tokens[$stmtno][] = implode('',$tokarr);
-                               $tokens[$stmtno][] = $ch;
-                               $intoken = false;
-                       }
-               }
-               $pos += 1;
-       }
-       if ($intoken) $tokens[$stmtno][] = implode('',$tokarr);
-
-       return $tokens;
-}
-
-
-class ADODB_DataDict {
-       var $connection;
-       var $debug = false;
-       var $dropTable = 'DROP TABLE %s';
-       var $renameTable = 'RENAME TABLE %s TO %s';
-       var $dropIndex = 'DROP INDEX %s';
-       var $addCol = ' ADD';
-       var $alterCol = ' ALTER COLUMN';
-       var $dropCol = ' DROP COLUMN';
-       var $renameColumn = 'ALTER TABLE %s RENAME COLUMN %s TO %s';    // table, old-column, new-column, column-definitions (not used by default)
-       var $nameRegex = '\w';
-       var $nameRegexBrackets = 'a-zA-Z0-9_\(\)';
-       var $schema = false;
-       var $serverInfo = array();
-       var $autoIncrement = false;
-       var $dataProvider;
-       var $invalidResizeTypes4 = array('CLOB','BLOB','TEXT','DATE','TIME'); // for changetablesql
-       var $blobNotNull = false; // dbms supports NOT NULL for BLOB/TEXT columns
-       var $blobDefaults = false; // dbms supports defaults for BLOB/TEXT columns
-       var $blobSize = 100;    /// any varchar/char field this size or greater is treated as a blob
-                                                       /// in other words, we use a text area for editting.
-
-       function GetCommentSQL($table,$col)
-       {
-               return false;
-       }
-
-       function SetCommentSQL($table,$col,$cmt)
-       {
-               return false;
-       }
-
-       function MetaTables()
-       {
-               if (!$this->connection->IsConnected()) return array();
-               return $this->connection->MetaTables();
-       }
-
-       function MetaColumns($tab, $upper=true, $schema=false)
-       {
-               if (!$this->connection->IsConnected()) return array();
-               return $this->connection->MetaColumns($this->TableName($tab), $upper, $schema);
-       }
-
-       function MetaPrimaryKeys($tab,$owner=false,$intkey=false)
-       {
-               if (!$this->connection->IsConnected()) return array();
-               return $this->connection->MetaPrimaryKeys($this->TableName($tab), $owner, $intkey);
-       }
-
-       function MetaIndexes($table, $primary = false, $owner = false)
-       {
-               if (!$this->connection->IsConnected()) return array();
-               return $this->connection->MetaIndexes($this->TableName($table), $primary, $owner);
-       }
-
-       function MetaType($t,$len=-1,$fieldobj=false)
-       {
-               static $typeMap = array(
-               'VARCHAR' => 'C',
-               'VARCHAR2' => 'C',
-               'CHAR' => 'C',
-               'C' => 'C',
-               'STRING' => 'C',
-               'NCHAR' => 'C',
-               'NVARCHAR' => 'C',
-               'VARYING' => 'C',
-               'BPCHAR' => 'C',
-               'CHARACTER' => 'C',
-               'INTERVAL' => 'C',  # Postgres
-               'MACADDR' => 'C', # postgres
-               'VAR_STRING' => 'C', # mysql
-               ##
-               'LONGCHAR' => 'X',
-               'TEXT' => 'X',
-               'NTEXT' => 'X',
-               'M' => 'X',
-               'X' => 'X',
-               'CLOB' => 'X',
-               'NCLOB' => 'X',
-               'LVARCHAR' => 'X',
-               ##
-               'BLOB' => 'B',
-               'IMAGE' => 'B',
-               'BINARY' => 'B',
-               'VARBINARY' => 'B',
-               'LONGBINARY' => 'B',
-               'B' => 'B',
-               ##
-               'YEAR' => 'D', // mysql
-               'DATE' => 'D',
-               'D' => 'D',
-               ##
-               'UNIQUEIDENTIFIER' => 'C', # MS SQL Server
-               ##
-               'TIME' => 'T',
-               'TIMESTAMP' => 'T',
-               'DATETIME' => 'T',
-               'TIMESTAMPTZ' => 'T',
-               'SMALLDATETIME' => 'T',
-               'T' => 'T',
-               'TIMESTAMP WITHOUT TIME ZONE' => 'T', // postgresql
-               ##
-               'BOOL' => 'L',
-               'BOOLEAN' => 'L',
-               'BIT' => 'L',
-               'L' => 'L',
-               ##
-               'COUNTER' => 'R',
-               'R' => 'R',
-               'SERIAL' => 'R', // ifx
-               'INT IDENTITY' => 'R',
-               ##
-               'INT' => 'I',
-               'INT2' => 'I',
-               'INT4' => 'I',
-               'INT8' => 'I',
-               'INTEGER' => 'I',
-               'INTEGER UNSIGNED' => 'I',
-               'SHORT' => 'I',
-               'TINYINT' => 'I',
-               'SMALLINT' => 'I',
-               'I' => 'I',
-               ##
-               'LONG' => 'N', // interbase is numeric, oci8 is blob
-               'BIGINT' => 'N', // this is bigger than PHP 32-bit integers
-               'DECIMAL' => 'N',
-               'DEC' => 'N',
-               'REAL' => 'N',
-               'DOUBLE' => 'N',
-               'DOUBLE PRECISION' => 'N',
-               'SMALLFLOAT' => 'N',
-               'FLOAT' => 'N',
-               'NUMBER' => 'N',
-               'NUM' => 'N',
-               'NUMERIC' => 'N',
-               'MONEY' => 'N',
-
-               ## informix 9.2
-               'SQLINT' => 'I',
-               'SQLSERIAL' => 'I',
-               'SQLSMINT' => 'I',
-               'SQLSMFLOAT' => 'N',
-               'SQLFLOAT' => 'N',
-               'SQLMONEY' => 'N',
-               'SQLDECIMAL' => 'N',
-               'SQLDATE' => 'D',
-               'SQLVCHAR' => 'C',
-               'SQLCHAR' => 'C',
-               'SQLDTIME' => 'T',
-               'SQLINTERVAL' => 'N',
-               'SQLBYTES' => 'B',
-               'SQLTEXT' => 'X',
-                ## informix 10
-               "SQLINT8" => 'I8',
-               "SQLSERIAL8" => 'I8',
-               "SQLNCHAR" => 'C',
-               "SQLNVCHAR" => 'C',
-               "SQLLVARCHAR" => 'X',
-               "SQLBOOL" => 'L'
-               );
-
-               if (!$this->connection->IsConnected()) {
-                       $t = strtoupper($t);
-                       if (isset($typeMap[$t])) return $typeMap[$t];
-                       return 'N';
-               }
-               return $this->connection->MetaType($t,$len,$fieldobj);
-       }
-
-       function NameQuote($name = NULL,$allowBrackets=false)
-       {
-               if (!is_string($name)) {
-                       return FALSE;
-               }
-
-               $name = trim($name);
-
-               if ( !is_object($this->connection) ) {
-                       return $name;
-               }
-
-               $quote = $this->connection->nameQuote;
-
-               // if name is of the form `name`, quote it
-               if ( preg_match('/^`(.+)`$/', $name, $matches) ) {
-                       return $quote . $matches[1] . $quote;
-               }
-
-               // if name contains special characters, quote it
-               $regex = ($allowBrackets) ? $this->nameRegexBrackets : $this->nameRegex;
-
-               if ( !preg_match('/^[' . $regex . ']+$/', $name) ) {
-                       return $quote . $name . $quote;
-               }
-
-               return $name;
-       }
-
-       function TableName($name)
-       {
-               if ( $this->schema ) {
-                       return $this->NameQuote($this->schema) .'.'. $this->NameQuote($name);
-               }
-               return $this->NameQuote($name);
-       }
-
-       // Executes the sql array returned by GetTableSQL and GetIndexSQL
-       function ExecuteSQLArray($sql, $continueOnError = true)
-       {
-               $rez = 2;
-               $conn = $this->connection;
-               $saved = $conn->debug;
-               foreach($sql as $line) {
-
-                       if ($this->debug) $conn->debug = true;
-                       $ok = $conn->Execute($line);
-                       $conn->debug = $saved;
-                       if (!$ok) {
-                               if ($this->debug) ADOConnection::outp($conn->ErrorMsg());
-                               if (!$continueOnError) return 0;
-                               $rez = 1;
-                       }
-               }
-               return $rez;
-       }
-
-       /**
-               Returns the actual type given a character code.
-
-               C:  varchar
-               X:  CLOB (character large object) or largest varchar size if CLOB is not supported
-               C2: Multibyte varchar
-               X2: Multibyte CLOB
-
-               B:  BLOB (binary large object)
-
-               D:  Date
-               T:  Date-time
-               L:  Integer field suitable for storing booleans (0 or 1)
-               I:  Integer
-               F:  Floating point number
-               N:  Numeric or decimal number
-       */
-
-       function ActualType($meta)
-       {
-               return $meta;
-       }
-
-       function CreateDatabase($dbname,$options=false)
-       {
-               $options = $this->_Options($options);
-               $sql = array();
-
-               $s = 'CREATE DATABASE ' . $this->NameQuote($dbname);
-               if (isset($options[$this->upperName]))
-                       $s .= ' '.$options[$this->upperName];
-
-               $sql[] = $s;
-               return $sql;
-       }
-
-       /*
-        Generates the SQL to create index. Returns an array of sql strings.
-       */
-       function CreateIndexSQL($idxname, $tabname, $flds, $idxoptions = false)
-       {
-               if (!is_array($flds)) {
-                       $flds = explode(',',$flds);
-               }
-
-               foreach($flds as $key => $fld) {
-                       # some indexes can use partial fields, eg. index first 32 chars of "name" with NAME(32)
-                       $flds[$key] = $this->NameQuote($fld,$allowBrackets=true);
-               }
-
-               return $this->_IndexSQL($this->NameQuote($idxname), $this->TableName($tabname), $flds, $this->_Options($idxoptions));
-       }
-
-       function DropIndexSQL ($idxname, $tabname = NULL)
-       {
-               return array(sprintf($this->dropIndex, $this->NameQuote($idxname), $this->TableName($tabname)));
-       }
-
-       function SetSchema($schema)
-       {
-               $this->schema = $schema;
-       }
-
-       function AddColumnSQL($tabname, $flds)
-       {
-               $tabname = $this->TableName ($tabname);
-               $sql = array();
-               list($lines,$pkey,$idxs) = $this->_GenFields($flds);
-               // genfields can return FALSE at times
-               if ($lines  == null) $lines = array();
-               $alter = 'ALTER TABLE ' . $tabname . $this->addCol . ' ';
-               foreach($lines as $v) {
-                       $sql[] = $alter . $v;
-               }
-               if (is_array($idxs)) {
-                       foreach($idxs as $idx => $idxdef) {
-                               $sql_idxs = $this->CreateIndexSql($idx, $tabname, $idxdef['cols'], $idxdef['opts']);
-                               $sql = array_merge($sql, $sql_idxs);
-                       }
-               }
-               return $sql;
-       }
-
-       /**
-        * Change the definition of one column
-        *
-        * As some DBM's can't do that on there own, you need to supply the complete defintion of the new table,
-        * to allow, recreating the table and copying the content over to the new table
-        * @param string $tabname table-name
-        * @param string $flds column-name and type for the changed column
-        * @param string $tableflds='' complete defintion of the new table, eg. for postgres, default ''
-        * @param array/string $tableoptions='' options for the new table see CreateTableSQL, default ''
-        * @return array with SQL strings
-        */
-       function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
-       {
-               $tabname = $this->TableName ($tabname);
-               $sql = array();
-               list($lines,$pkey,$idxs) = $this->_GenFields($flds);
-               // genfields can return FALSE at times
-               if ($lines == null) $lines = array();
-               $alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' ';
-               foreach($lines as $v) {
-                       $sql[] = $alter . $v;
-               }
-               if (is_array($idxs)) {
-                       foreach($idxs as $idx => $idxdef) {
-                               $sql_idxs = $this->CreateIndexSql($idx, $tabname, $idxdef['cols'], $idxdef['opts']);
-                               $sql = array_merge($sql, $sql_idxs);
-                       }
-
-               }
-               return $sql;
-       }
-
-       /**
-        * Rename one column
-        *
-        * Some DBM's can only do this together with changeing the type of the column (even if that stays the same, eg. mysql)
-        * @param string $tabname table-name
-        * @param string $oldcolumn column-name to be renamed
-        * @param string $newcolumn new column-name
-        * @param string $flds='' complete column-defintion-string like for AddColumnSQL, only used by mysql atm., default=''
-        * @return array with SQL strings
-        */
-       function RenameColumnSQL($tabname,$oldcolumn,$newcolumn,$flds='')
-       {
-               $tabname = $this->TableName ($tabname);
-               if ($flds) {
-                       list($lines,$pkey,$idxs) = $this->_GenFields($flds);
-                       // genfields can return FALSE at times
-                       if ($lines == null) $lines = array();
-                       list(,$first) = each($lines);
-                       list(,$column_def) = preg_split("/[\t ]+/",$first,2);
-               }
-               return array(sprintf($this->renameColumn,$tabname,$this->NameQuote($oldcolumn),$this->NameQuote($newcolumn),$column_def));
-       }
-
-       /**
-        * Drop one column
-        *
-        * Some DBM's can't do that on there own, you need to supply the complete defintion of the new table,
-        * to allow, recreating the table and copying the content over to the new table
-        * @param string $tabname table-name
-        * @param string $flds column-name and type for the changed column
-        * @param string $tableflds='' complete defintion of the new table, eg. for postgres, default ''
-        * @param array/string $tableoptions='' options for the new table see CreateTableSQL, default ''
-        * @return array with SQL strings
-        */
-       function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
-       {
-               $tabname = $this->TableName ($tabname);
-               if (!is_array($flds)) $flds = explode(',',$flds);
-               $sql = array();
-               $alter = 'ALTER TABLE ' . $tabname . $this->dropCol . ' ';
-               foreach($flds as $v) {
-                       $sql[] = $alter . $this->NameQuote($v);
-               }
-               return $sql;
-       }
-
-       function DropTableSQL($tabname)
-       {
-               return array (sprintf($this->dropTable, $this->TableName($tabname)));
-       }
-
-       function RenameTableSQL($tabname,$newname)
-       {
-               return array (sprintf($this->renameTable, $this->TableName($tabname),$this->TableName($newname)));
-       }
-
-       /**
-        Generate the SQL to create table. Returns an array of sql strings.
-       */
-       function CreateTableSQL($tabname, $flds, $tableoptions=array())
-       {
-               list($lines,$pkey,$idxs) = $this->_GenFields($flds, true);
-               // genfields can return FALSE at times
-               if ($lines == null) $lines = array();
-
-               $taboptions = $this->_Options($tableoptions);
-               $tabname = $this->TableName ($tabname);
-               $sql = $this->_TableSQL($tabname,$lines,$pkey,$taboptions);
-
-               // ggiunta - 2006/10/12 - KLUDGE:
-        // if we are on autoincrement, and table options includes REPLACE, the
-        // autoincrement sequence has already been dropped on table creation sql, so
-        // we avoid passing REPLACE to trigger creation code. This prevents
-        // creating sql that double-drops the sequence
-        if ($this->autoIncrement && isset($taboptions['REPLACE']))
-               unset($taboptions['REPLACE']);
-               $tsql = $this->_Triggers($tabname,$taboptions);
-               foreach($tsql as $s) $sql[] = $s;
-
-               if (is_array($idxs)) {
-                       foreach($idxs as $idx => $idxdef) {
-                               $sql_idxs = $this->CreateIndexSql($idx, $tabname,  $idxdef['cols'], $idxdef['opts']);
-                               $sql = array_merge($sql, $sql_idxs);
-                       }
-               }
-
-               return $sql;
-       }
-
-
-
-       function _GenFields($flds,$widespacing=false)
-       {
-               if (is_string($flds)) {
-                       $padding = '     ';
-                       $txt = $flds.$padding;
-                       $flds = array();
-                       $flds0 = Lens_ParseArgs($txt,',');
-                       $hasparam = false;
-                       foreach($flds0 as $f0) {
-                               $f1 = array();
-                               foreach($f0 as $token) {
-                                       switch (strtoupper($token)) {
-                                       case 'INDEX':
-                                               $f1['INDEX'] = '';
-                                               // fall through intentionally
-                                       case 'CONSTRAINT':
-                                       case 'DEFAULT':
-                                               $hasparam = $token;
-                                               break;
-                                       default:
-                                               if ($hasparam) $f1[$hasparam] = $token;
-                                               else $f1[] = $token;
-                                               $hasparam = false;
-                                               break;
-                                       }
-                               }
-                               // 'index' token without a name means single column index: name it after column
-                               if (array_key_exists('INDEX', $f1) && $f1['INDEX'] == '') {
-                                       $f1['INDEX'] = isset($f0['NAME']) ? $f0['NAME'] : $f0[0];
-                                       // check if column name used to create an index name was quoted
-                                       if (($f1['INDEX'][0] == '"' || $f1['INDEX'][0] == "'" || $f1['INDEX'][0] == "`") &&
-                                               ($f1['INDEX'][0] == substr($f1['INDEX'], -1))) {
-                                               $f1['INDEX'] = $f1['INDEX'][0].'idx_'.substr($f1['INDEX'], 1, -1).$f1['INDEX'][0];
-                                       }
-                                       else
-                                               $f1['INDEX'] = 'idx_'.$f1['INDEX'];
-                               }
-                               // reset it, so we don't get next field 1st token as INDEX...
-                               $hasparam = false;
-
-                               $flds[] = $f1;
-
-                       }
-               }
-               $this->autoIncrement = false;
-               $lines = array();
-               $pkey = array();
-               $idxs = array();
-               foreach($flds as $fld) {
-                       $fld = _array_change_key_case($fld);
-
-                       $fname = false;
-                       $fdefault = false;
-                       $fautoinc = false;
-                       $ftype = false;
-                       $fsize = false;
-                       $fprec = false;
-                       $fprimary = false;
-                       $fnoquote = false;
-                       $fdefts = false;
-                       $fdefdate = false;
-                       $fconstraint = false;
-                       $fnotnull = false;
-                       $funsigned = false;
-                       $findex = '';
-                       $funiqueindex = false;
-
-                       //-----------------
-                       // Parse attributes
-                       foreach($fld as $attr => $v) {
-                               if ($attr == 2 && is_numeric($v)) $attr = 'SIZE';
-                               else if (is_numeric($attr) && $attr > 1 && !is_numeric($v)) $attr = strtoupper($v);
-
-                               switch($attr) {
-                               case '0':
-                               case 'NAME':    $fname = $v; break;
-                               case '1':
-                               case 'TYPE':    $ty = $v; $ftype = $this->ActualType(strtoupper($v)); break;
-
-                               case 'SIZE':
-                                                               $dotat = strpos($v,'.'); if ($dotat === false) $dotat = strpos($v,',');
-                                                               if ($dotat === false) $fsize = $v;
-                                                               else {
-                                                                       $fsize = substr($v,0,$dotat);
-                                                                       $fprec = substr($v,$dotat+1);
-                                                               }
-                                                               break;
-                               case 'UNSIGNED': $funsigned = true; break;
-                               case 'AUTOINCREMENT':
-                               case 'AUTO':    $fautoinc = true; $fnotnull = true; break;
-                               case 'KEY':
-                // a primary key col can be non unique in itself (if key spans many cols...)
-                               case 'PRIMARY': $fprimary = $v; $fnotnull = true; /*$funiqueindex = true;*/ break;
-                               case 'DEF':
-                               case 'DEFAULT': $fdefault = $v; break;
-                               case 'NOTNULL': $fnotnull = $v; break;
-                               case 'NOQUOTE': $fnoquote = $v; break;
-                               case 'DEFDATE': $fdefdate = $v; break;
-                               case 'DEFTIMESTAMP': $fdefts = $v; break;
-                               case 'CONSTRAINT': $fconstraint = $v; break;
-                               // let INDEX keyword create a 'very standard' index on column
-                               case 'INDEX': $findex = $v; break;
-                               case 'UNIQUE': $funiqueindex = true; break;
-                               } //switch
-                       } // foreach $fld
-
-                       //--------------------
-                       // VALIDATE FIELD INFO
-                       if (!strlen($fname)) {
-                               if ($this->debug) ADOConnection::outp("Undefined NAME");
-                               return false;
-                       }
-
-                       $fid = strtoupper(preg_replace('/^`(.+)`$/', '$1', $fname));
-                       $fname = $this->NameQuote($fname);
-
-                       if (!strlen($ftype)) {
-                               if ($this->debug) ADOConnection::outp("Undefined TYPE for field '$fname'");
-                               return false;
-                       } else {
-                               $ftype = strtoupper($ftype);
-                       }
-
-                       $ftype = $this->_GetSize($ftype, $ty, $fsize, $fprec);
-
-                       if (($ty == 'X' || $ty == 'X2' || $ty == 'B') && $this->blobNotNull !== true) $fnotnull = false; // some blob types do not accept nulls
-
-                       if ($fprimary) $pkey[] = $fname;
-
-                       // some databases do not allow blobs to have defaults
-                       if ($ty == 'X' && $this->blobDefaults !== true) $fdefault = false;
-
-                       // build list of indexes
-                       if ($findex != '') {
-                               if (array_key_exists($findex, $idxs)) {
-                                       $idxs[$findex]['cols'][] = ($fname);
-                                       if (in_array('UNIQUE', $idxs[$findex]['opts']) != $funiqueindex) {
-                                               if ($this->debug) ADOConnection::outp("Index $findex defined once UNIQUE and once not");
-                                       }
-                                       if ($funiqueindex && !in_array('UNIQUE', $idxs[$findex]['opts']))
-                                               $idxs[$findex]['opts'][] = 'UNIQUE';
-                               }
-                               else
-                               {
-                                       $idxs[$findex] = array();
-                                       $idxs[$findex]['cols'] = array($fname);
-                                       if ($funiqueindex)
-                                               $idxs[$findex]['opts'] = array('UNIQUE');
-                                       else
-                                               $idxs[$findex]['opts'] = array();
-                               }
-                       }
-
-                       //--------------------
-                       // CONSTRUCT FIELD SQL
-                       if ($fdefts) {
-                               if (substr($this->connection->databaseType,0,5) == 'mysql') {
-                                       $ftype = 'TIMESTAMP';
-                               } else {
-                                       $fdefault = $this->connection->sysTimeStamp;
-                               }
-                       } else if ($fdefdate) {
-                               if (substr($this->connection->databaseType,0,5) == 'mysql') {
-                                       $ftype = 'TIMESTAMP';
-                               } else {
-                                       $fdefault = $this->connection->sysDate;
-                               }
-                       } else if ($fdefault !== false && !$fnoquote) {
-                               if ($ty == 'C' or $ty == 'X' or
-                                       ( substr($fdefault,0,1) != "'" && !is_numeric($fdefault))) {
-
-                                       if (($ty == 'D' || $ty == 'T') && strtolower($fdefault) != 'null') {
-                                               // convert default date into database-aware code
-                                               if ($ty == 'T')
-                                               {
-                                                       $fdefault = $this->connection->DBTimeStamp($fdefault);
-                                               }
-                                               else
-                                               {
-                                                       $fdefault = $this->connection->DBDate($fdefault);
-                                               }
-                                       }
-                                       else
-                                       if (strlen($fdefault) != 1 && substr($fdefault,0,1) == ' ' && substr($fdefault,strlen($fdefault)-1) == ' ')
-                                               $fdefault = trim($fdefault);
-                                       else if (strtolower($fdefault) != 'null')
-                                               $fdefault = $this->connection->qstr($fdefault);
-                               }
-                       }
-                       $suffix = $this->_CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned);
-
-                       // add index creation
-                       if ($widespacing) $fname = str_pad($fname,24);
-
-                        // check for field names appearing twice
-            if (array_key_exists($fid, $lines)) {
-                ADOConnection::outp("Field '$fname' defined twice");
-            }
-
-                       $lines[$fid] = $fname.' '.$ftype.$suffix;
-
-                       if ($fautoinc) $this->autoIncrement = true;
-               } // foreach $flds
-
-               return array($lines,$pkey,$idxs);
-       }
-
-       /**
-                GENERATE THE SIZE PART OF THE DATATYPE
-                       $ftype is the actual type
-                       $ty is the type defined originally in the DDL
-       */
-       function _GetSize($ftype, $ty, $fsize, $fprec)
-       {
-               if (strlen($fsize) && $ty != 'X' && $ty != 'B' && strpos($ftype,'(') === false) {
-                       $ftype .= "(".$fsize;
-                       if (strlen($fprec)) $ftype .= ",".$fprec;
-                       $ftype .= ')';
-               }
-               return $ftype;
-       }
-
-
-       // return string must begin with space
-       function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
-       {
-               $suffix = '';
-               if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
-               if ($fnotnull) $suffix .= ' NOT NULL';
-               if ($fconstraint) $suffix .= ' '.$fconstraint;
-               return $suffix;
-       }
-
-       function _IndexSQL($idxname, $tabname, $flds, $idxoptions)
-       {
-               $sql = array();
-
-               if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) {
-                       $sql[] = sprintf ($this->dropIndex, $idxname);
-                       if ( isset($idxoptions['DROP']) )
-                               return $sql;
-               }
-
-               if ( empty ($flds) ) {
-                       return $sql;
-               }
-
-               $unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : '';
-
-               $s = 'CREATE' . $unique . ' INDEX ' . $idxname . ' ON ' . $tabname . ' ';
-
-               if ( isset($idxoptions[$this->upperName]) )
-                       $s .= $idxoptions[$this->upperName];
-
-               if ( is_array($flds) )
-                       $flds = implode(', ',$flds);
-               $s .= '(' . $flds . ')';
-               $sql[] = $s;
-
-               return $sql;
-       }
-
-       function _DropAutoIncrement($tabname)
-       {
-               return false;
-       }
-
-       function _TableSQL($tabname,$lines,$pkey,$tableoptions)
-       {
-               $sql = array();
-
-               if (isset($tableoptions['REPLACE']) || isset ($tableoptions['DROP'])) {
-                       $sql[] = sprintf($this->dropTable,$tabname);
-                       if ($this->autoIncrement) {
-                               $sInc = $this->_DropAutoIncrement($tabname);
-                               if ($sInc) $sql[] = $sInc;
-                       }
-                       if ( isset ($tableoptions['DROP']) ) {
-                               return $sql;
-                       }
-               }
-               $s = "CREATE TABLE $tabname (\n";
-               $s .= implode(",\n", $lines);
-               if (sizeof($pkey)>0) {
-                       $s .= ",\n                 PRIMARY KEY (";
-                       $s .= implode(", ",$pkey).")";
-               }
-               if (isset($tableoptions['CONSTRAINTS']))
-                       $s .= "\n".$tableoptions['CONSTRAINTS'];
-
-               if (isset($tableoptions[$this->upperName.'_CONSTRAINTS']))
-                       $s .= "\n".$tableoptions[$this->upperName.'_CONSTRAINTS'];
-
-               $s .= "\n)";
-               if (isset($tableoptions[$this->upperName])) $s .= $tableoptions[$this->upperName];
-               $sql[] = $s;
-
-               return $sql;
-       }
-
-       /**
-               GENERATE TRIGGERS IF NEEDED
-               used when table has auto-incrementing field that is emulated using triggers
-       */
-       function _Triggers($tabname,$taboptions)
-       {
-               return array();
-       }
-
-       /**
-               Sanitize options, so that array elements with no keys are promoted to keys
-       */
-       function _Options($opts)
-       {
-               if (!is_array($opts)) return array();
-               $newopts = array();
-               foreach($opts as $k => $v) {
-                       if (is_numeric($k)) $newopts[strtoupper($v)] = $v;
-                       else $newopts[strtoupper($k)] = $v;
-               }
-               return $newopts;
-       }
-
-
-       function _getSizePrec($size)
-       {
-               $fsize = false;
-               $fprec = false;
-               $dotat = strpos($size,'.');
-               if ($dotat === false) $dotat = strpos($size,',');
-               if ($dotat === false) $fsize = $size;
-               else {
-                       $fsize = substr($size,0,$dotat);
-                       $fprec = substr($size,$dotat+1);
-               }
-               return array($fsize, $fprec);
-       }
-
-       /**
-       "Florian Buzin [ easywe ]" <florian.buzin#easywe.de>
-
-       This function changes/adds new fields to your table. You don't
-       have to know if the col is new or not. It will check on its own.
-       */
-       function ChangeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds=false)
-       {
-       global $ADODB_FETCH_MODE;
-
-               $save = $ADODB_FETCH_MODE;
-               $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
-               if ($this->connection->fetchMode !== false) $savem = $this->connection->SetFetchMode(false);
-
-               // check table exists
-               $save_handler = $this->connection->raiseErrorFn;
-               $this->connection->raiseErrorFn = '';
-               $cols = $this->MetaColumns($tablename);
-               $this->connection->raiseErrorFn = $save_handler;
-
-               if (isset($savem)) $this->connection->SetFetchMode($savem);
-               $ADODB_FETCH_MODE = $save;
-
-               if ( empty($cols)) {
-                       return $this->CreateTableSQL($tablename, $flds, $tableoptions);
-               }
-
-               if (is_array($flds)) {
-               // Cycle through the update fields, comparing
-               // existing fields to fields to update.
-               // if the Metatype and size is exactly the
-               // same, ignore - by Mark Newham
-                       $holdflds = array();
-                       foreach($flds as $k=>$v) {
-                               if ( isset($cols[$k]) && is_object($cols[$k]) ) {
-                                       // If already not allowing nulls, then don't change
-                                       $obj = $cols[$k];
-                                       if (isset($obj->not_null) && $obj->not_null)
-                                               $v = str_replace('NOT NULL','',$v);
-                                       if (isset($obj->auto_increment) && $obj->auto_increment && empty($v['AUTOINCREMENT']))
-                                           $v = str_replace('AUTOINCREMENT','',$v);
-
-                                       $c = $cols[$k];
-                                       $ml = $c->max_length;
-                                       $mt = $this->MetaType($c->type,$ml);
-
-                                       if (isset($c->scale)) $sc = $c->scale;
-                                       else $sc = 99; // always force change if scale not known.
-
-                                       if ($sc == -1) $sc = false;
-                                       list($fsize, $fprec) = $this->_getSizePrec($v['SIZE']);
-
-                                       if ($ml == -1) $ml = '';
-                                       if ($mt == 'X') $ml = $v['SIZE'];
-                                       if (($mt != $v['TYPE']) || ($ml != $fsize || $sc != $fprec) || (isset($v['AUTOINCREMENT']) && $v['AUTOINCREMENT'] != $obj->auto_increment)) {
-                                               $holdflds[$k] = $v;
-                                       }
-                               } else {
-                                       $holdflds[$k] = $v;
-                               }
-                       }
-                       $flds = $holdflds;
-               }
-
-
-               // already exists, alter table instead
-               list($lines,$pkey,$idxs) = $this->_GenFields($flds);
-               // genfields can return FALSE at times
-               if ($lines == null) $lines = array();
-               $alter = 'ALTER TABLE ' . $this->TableName($tablename);
-               $sql = array();
-
-               foreach ( $lines as $id => $v ) {
-                       if ( isset($cols[$id]) && is_object($cols[$id]) ) {
-
-                               $flds = Lens_ParseArgs($v,',');
-
-                               //  We are trying to change the size of the field, if not allowed, simply ignore the request.
-                               // $flds[1] holds the type, $flds[2] holds the size -postnuke addition
-                               if ($flds && in_array(strtoupper(substr($flds[0][1],0,4)),$this->invalidResizeTypes4)
-                                && (isset($flds[0][2]) && is_numeric($flds[0][2]))) {
-                                       if ($this->debug) ADOConnection::outp(sprintf("<h3>%s cannot be changed to %s currently</h3>", $flds[0][0], $flds[0][1]));
-                                       #echo "<h3>$this->alterCol cannot be changed to $flds currently</h3>";
-                                       continue;
-                               }
-                               $sql[] = $alter . $this->alterCol . ' ' . $v;
-                       } else {
-                               $sql[] = $alter . $this->addCol . ' ' . $v;
-                       }
-               }
-
-               if ($dropOldFlds) {
-                       foreach ( $cols as $id => $v )
-                           if ( !isset($lines[$id]) )
-                                       $sql[] = $alter . $this->dropCol . ' ' . $v->name;
-               }
-               return $sql;
-       }
-} // class
diff --git a/typo3/sysext/adodb/adodb/adodb-error.inc.php b/typo3/sysext/adodb/adodb/adodb-error.inc.php
deleted file mode 100644 (file)
index 307b8b5..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-<?php
-/**
- * @version   v5.20.3  01-Jan-2016
- * @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.
- *
- * The following code is adapted from the PEAR DB error handling code.
- * Portions (c)1997-2002 The PHP Group.
- */
-
-
-if (!defined("DB_ERROR")) define("DB_ERROR",-1);
-
-if (!defined("DB_ERROR_SYNTAX")) {
-       define("DB_ERROR_SYNTAX",              -2);
-       define("DB_ERROR_CONSTRAINT",          -3);
-       define("DB_ERROR_NOT_FOUND",           -4);
-       define("DB_ERROR_ALREADY_EXISTS",      -5);
-       define("DB_ERROR_UNSUPPORTED",         -6);
-       define("DB_ERROR_MISMATCH",            -7);
-       define("DB_ERROR_INVALID",             -8);
-       define("DB_ERROR_NOT_CAPABLE",         -9);
-       define("DB_ERROR_TRUNCATED",          -10);
-       define("DB_ERROR_INVALID_NUMBER",     -11);
-       define("DB_ERROR_INVALID_DATE",       -12);
-       define("DB_ERROR_DIVZERO",            -13);
-       define("DB_ERROR_NODBSELECTED",       -14);
-       define("DB_ERROR_CANNOT_CREATE",      -15);
-       define("DB_ERROR_CANNOT_DELETE",      -16);
-       define("DB_ERROR_CANNOT_DROP",        -17);
-       define("DB_ERROR_NOSUCHTABLE",        -18);
-       define("DB_ERROR_NOSUCHFIELD",        -19);
-       define("DB_ERROR_NEED_MORE_DATA",     -20);
-       define("DB_ERROR_NOT_LOCKED",         -21);
-       define("DB_ERROR_VALUE_COUNT_ON_ROW", -22);
-       define("DB_ERROR_INVALID_DSN",        -23);
-       define("DB_ERROR_CONNECT_FAILED",     -24);
-       define("DB_ERROR_EXTENSION_NOT_FOUND",-25);
-       define("DB_ERROR_NOSUCHDB",           -25);
-       define("DB_ERROR_ACCESS_VIOLATION",   -26);
-       define("DB_ERROR_DEADLOCK",           -27);
-       define("DB_ERROR_STATEMENT_TIMEOUT",  -28);
-       define("DB_ERROR_SERIALIZATION_FAILURE", -29);
-}
-
-function adodb_errormsg($value)
-{
-global $ADODB_LANG,$ADODB_LANG_ARRAY;
-
-       if (empty($ADODB_LANG)) $ADODB_LANG = 'en';
-       if (isset($ADODB_LANG_ARRAY['LANG']) && $ADODB_LANG_ARRAY['LANG'] == $ADODB_LANG) ;
-       else {
-               include_once(ADODB_DIR."/lang/adodb-$ADODB_LANG.inc.php");
-    }
-       return isset($ADODB_LANG_ARRAY[$value]) ? $ADODB_LANG_ARRAY[$value] : $ADODB_LANG_ARRAY[DB_ERROR];
-}
-
-function adodb_error($provider,$dbType,$errno)
-{
-       //var_dump($errno);
-       if (is_numeric($errno) && $errno == 0) return 0;
-       switch($provider) {
-       case 'mysql': $map = adodb_error_mysql(); break;
-
-       case 'oracle':
-       case 'oci8': $map = adodb_error_oci8(); break;
-
-       case 'ibase': $map = adodb_error_ibase(); break;
-
-       case 'odbc': $map = adodb_error_odbc(); break;
-
-       case 'mssql':
-       case 'sybase': $map = adodb_error_mssql(); break;
-
-       case 'informix': $map = adodb_error_ifx(); break;
-
-       case 'postgres': return adodb_error_pg($errno); break;
-
-       case 'sqlite': return $map = adodb_error_sqlite(); break;
-       default:
-               return DB_ERROR;
-       }
-       //print_r($map);
-       //var_dump($errno);
-       if (isset($map[$errno])) return $map[$errno];
-       return DB_ERROR;
-}
-
-//**************************************************************************************
-
-function adodb_error_pg($errormsg)
-{
-       if (is_numeric($errormsg)) return (integer) $errormsg;
-       // Postgres has no lock-wait timeout.  The best we could do would be to set a statement timeout.
-       static $error_regexps = array(
-                       '(Table does not exist\.|Relation [\"\'].*[\"\'] does not exist|sequence does not exist|class ".+" not found)$' => DB_ERROR_NOSUCHTABLE,
-                       'Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key.*violates unique constraint'     => DB_ERROR_ALREADY_EXISTS,
-                       'database ".+" does not exist$'       => DB_ERROR_NOSUCHDB,
-                       '(divide|division) by zero$'          => DB_ERROR_DIVZERO,
-                       'pg_atoi: error in .*: can\'t parse ' => DB_ERROR_INVALID_NUMBER,
-                       'ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']' => DB_ERROR_NOSUCHFIELD,
-                       '(parser: parse|syntax) error at or near \"'   => DB_ERROR_SYNTAX,
-                       'referential integrity violation'     => DB_ERROR_CONSTRAINT,
-                       'deadlock detected$'                  => DB_ERROR_DEADLOCK,
-                       'canceling statement due to statement timeout$' => DB_ERROR_STATEMENT_TIMEOUT,
-                       'could not serialize access due to'   => DB_ERROR_SERIALIZATION_FAILURE
-               );
-       reset($error_regexps);
-       while (list($regexp,$code) = each($error_regexps)) {
-               if (preg_match("/$regexp/mi", $errormsg)) {
-                       return $code;
-               }
-       }
-       // Fall back to DB_ERROR if there was no mapping.
-       return DB_ERROR;
-}
-
-function adodb_error_odbc()
-{
-static $MAP = array(
-            '01004' => DB_ERROR_TRUNCATED,
-            '07001' => DB_ERROR_MISMATCH,
-            '21S01' => DB_ERROR_MISMATCH,
-            '21S02' => DB_ERROR_MISMATCH,
-            '22003' => DB_ERROR_INVALID_NUMBER,
-            '22008' => DB_ERROR_INVALID_DATE,
-            '22012' => DB_ERROR_DIVZERO,
-            '23000' => DB_ERROR_CONSTRAINT,
-            '24000' => DB_ERROR_INVALID,
-            '34000' => DB_ERROR_INVALID,
-            '37000' => DB_ERROR_SYNTAX,
-            '42000' => DB_ERROR_SYNTAX,
-            'IM001' => DB_ERROR_UNSUPPORTED,
-            'S0000' => DB_ERROR_NOSUCHTABLE,
-            'S0001' => DB_ERROR_NOT_FOUND,
-            'S0002' => DB_ERROR_NOSUCHTABLE,
-            'S0011' => DB_ERROR_ALREADY_EXISTS,
-            'S0012' => DB_ERROR_NOT_FOUND,
-            'S0021' => DB_ERROR_ALREADY_EXISTS,
-            'S0022' => DB_ERROR_NOT_FOUND,
-                       'S1000' => DB_ERROR_NOSUCHTABLE,
-            'S1009' => DB_ERROR_INVALID,
-            'S1090' => DB_ERROR_INVALID,
-            'S1C00' => DB_ERROR_NOT_CAPABLE
-        );
-               return $MAP;
-}
-
-function adodb_error_ibase()
-{
-static $MAP = array(
-            -104 => DB_ERROR_SYNTAX,
-            -150 => DB_ERROR_ACCESS_VIOLATION,
-            -151 => DB_ERROR_ACCESS_VIOLATION,
-            -155 => DB_ERROR_NOSUCHTABLE,
-            -157 => DB_ERROR_NOSUCHFIELD,
-            -158 => DB_ERROR_VALUE_COUNT_ON_ROW,
-            -170 => DB_ERROR_MISMATCH,
-            -171 => DB_ERROR_MISMATCH,
-            -172 => DB_ERROR_INVALID,
-            -204 => DB_ERROR_INVALID,
-            -205 => DB_ERROR_NOSUCHFIELD,
-            -206 => DB_ERROR_NOSUCHFIELD,
-            -208 => DB_ERROR_INVALID,
-            -219 => DB_ERROR_NOSUCHTABLE,
-            -297 => DB_ERROR_CONSTRAINT,
-            -530 => DB_ERROR_CONSTRAINT,
-            -803 => DB_ERROR_CONSTRAINT,
-            -551 => DB_ERROR_ACCESS_VIOLATION,
-            -552 => DB_ERROR_ACCESS_VIOLATION,
-            -922 => DB_ERROR_NOSUCHDB,
-            -923 => DB_ERROR_CONNECT_FAILED,
-            -924 => DB_ERROR_CONNECT_FAILED
-        );
-
-               return $MAP;
-}
-
-function adodb_error_ifx()
-{
-static $MAP = array(
-            '-201'    => DB_ERROR_SYNTAX,
-            '-206'    => DB_ERROR_NOSUCHTABLE,
-            '-217'    => DB_ERROR_NOSUCHFIELD,
-            '-329'    => DB_ERROR_NODBSELECTED,
-            '-1204'   => DB_ERROR_INVALID_DATE,
-            '-1205'   => DB_ERROR_INVALID_DATE,
-            '-1206'   => DB_ERROR_INVALID_DATE,
-            '-1209'   => DB_ERROR_INVALID_DATE,
-            '-1210'   => DB_ERROR_INVALID_DATE,
-            '-1212'   => DB_ERROR_INVALID_DATE
-       );
-
-          return $MAP;
-}
-
-function adodb_error_oci8()
-{
-static $MAP = array(
-                        1 => DB_ERROR_ALREADY_EXISTS,
-            900 => DB_ERROR_SYNTAX,
-            904 => DB_ERROR_NOSUCHFIELD,
-            923 => DB_ERROR_SYNTAX,
-            942 => DB_ERROR_NOSUCHTABLE,
-            955 => DB_ERROR_ALREADY_EXISTS,
-            1476 => DB_ERROR_DIVZERO,
-            1722 => DB_ERROR_INVALID_NUMBER,
-            2289 => DB_ERROR_NOSUCHTABLE,
-            2291 => DB_ERROR_CONSTRAINT,
-            2449 => DB_ERROR_CONSTRAINT
-        );
-
-       return $MAP;
-}
-
-function adodb_error_mssql()
-{
-static $MAP = array(
-                 208 => DB_ERROR_NOSUCHTABLE,
-          2601 => DB_ERROR_ALREADY_EXISTS
-       );
-
-       return $MAP;
-}
-
-function adodb_error_sqlite()
-{
-static $MAP = array(
-                 1 => DB_ERROR_SYNTAX
-       );
-
-       return $MAP;
-}
-
-function adodb_error_mysql()
-{
-static $MAP = array(
-           1004 => DB_ERROR_CANNOT_CREATE,
-           1005 => DB_ERROR_CANNOT_CREATE,
-           1006 => DB_ERROR_CANNOT_CREATE,
-           1007 => DB_ERROR_ALREADY_EXISTS,
-           1008 => DB_ERROR_CANNOT_DROP,
-                  1045 => DB_ERROR_ACCESS_VIOLATION,
-           1046 => DB_ERROR_NODBSELECTED,
-                  1049 => DB_ERROR_NOSUCHDB,
-           1050 => DB_ERROR_ALREADY_EXISTS,
-           1051 => DB_ERROR_NOSUCHTABLE,
-           1054 => DB_ERROR_NOSUCHFIELD,
-           1062 => DB_ERROR_ALREADY_EXISTS,
-           1064 => DB_ERROR_SYNTAX,
-           1100 => DB_ERROR_NOT_LOCKED,
-           1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
-           1146 => DB_ERROR_NOSUCHTABLE,
-           1048 => DB_ERROR_CONSTRAINT,
-                   2002 => DB_ERROR_CONNECT_FAILED,
-                       2005 => DB_ERROR_CONNECT_FAILED
-       );
-
-       return $MAP;
-}
diff --git a/typo3/sysext/adodb/adodb/adodb-errorhandler.inc.php b/typo3/sysext/adodb/adodb/adodb-errorhandler.inc.php
deleted file mode 100644 (file)
index 3b20cc2..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-/**
- * @version   v5.20.3  01-Jan-2016
- * @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 http://php.weblogs.com
- *
-*/
-
-
-// added Claudio Bustos  clbustos#entelchile.net
-if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR);
-
-if (!defined('ADODB_ERROR_HANDLER')) define('ADODB_ERROR_HANDLER','ADODB_Error_Handler');
-
-/**
-* Default Error Handler. This will be called with the following params
-*
-* @param $dbms         the RDBMS you are connecting to
-* @param $fn           the name of the calling function (in uppercase)
-* @param $errno                the native error number from the database
-* @param $errmsg       the native error msg from the database
-* @param $p1           $fn specific parameter - see below
-* @param $p2           $fn specific parameter - see below
-* @param $thisConn     $current connection object - can be false if no connection object created
-*/
-function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection)
-{
-       if (error_reporting() == 0) return; // obey @ protocol
-       switch($fn) {
-       case 'EXECUTE':
-               $sql = $p1;
-               $inputparams = $p2;
-
-               $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")\n";
-               break;
-
-       case 'PCONNECT':
-       case 'CONNECT':
-               $host = $p1;
-               $database = $p2;
-
-               $s = "$dbms error: [$errno: $errmsg] in $fn($host, '****', '****', $database)\n";
-               break;
-       default:
-               $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n";
-               break;
-       }
-       /*
-       * Log connection error somewhere
-       *       0 message is sent to PHP's system logger, using the Operating System's system
-       *               logging mechanism or a file, depending on what the error_log configuration
-       *               directive is set to.
-       *       1 message is sent by email to the address in the destination parameter.
-       *               This is the only message type where the fourth parameter, extra_headers is used.
-       *               This message type uses the same internal function as mail() does.
-       *       2 message is sent through the PHP debugging connection.
-       *               This option is only available if remote debugging has been enabled.
-       *               In this case, the destination parameter specifies the host name or IP address
-       *               and optionally, port number, of the socket receiving the debug information.
-       *       3 message is appended to the file destination
-       */
-       if (defined('ADODB_ERROR_LOG_TYPE')) {
-               $t = date('Y-m-d H:i:s');
-               if (defined('ADODB_ERROR_LOG_DEST'))
-                       error_log("($t) $s", ADODB_ERROR_LOG_TYPE, ADODB_ERROR_LOG_DEST);
-               else
-                       error_log("($t) $s", ADODB_ERROR_LOG_TYPE);
-       }
-
-
-       //print "<p>$s</p>";
-       trigger_error($s,ADODB_ERROR_HANDLER_TYPE);
-}
diff --git a/typo3/sysext/adodb/adodb/adodb-errorpear.inc.php b/typo3/sysext/adodb/adodb/adodb-errorpear.inc.php
deleted file mode 100644 (file)
index 733eb17..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/**
- * @version   v5.20.3  01-Jan-2016
- * @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 http://php.weblogs.com
- *
-*/
-include_once('PEAR.php');
-
-if (!defined('ADODB_ERROR_HANDLER')) define('ADODB_ERROR_HANDLER','ADODB_Error_PEAR');
-
-/*
-* Enabled the following if you want to terminate scripts when an error occurs
-*/
-//PEAR::setErrorHandling (PEAR_ERROR_DIE);
-
-/*
-* Name of the PEAR_Error derived class to call.
-*/
-if (!defined('ADODB_PEAR_ERROR_CLASS')) define('ADODB_PEAR_ERROR_CLASS','PEAR_Error');
-
-/*
-* Store the last PEAR_Error object here
-*/
-global $ADODB_Last_PEAR_Error; $ADODB_Last_PEAR_Error = false;
-
-  /**
-* Error Handler with PEAR support. This will be called with the following params
-*
-* @param $dbms         the RDBMS you are connecting to
-* @param $fn           the name of the calling function (in uppercase)
-* @param $errno                the native error number from the database
-* @param $errmsg       the native error msg from the database
-* @param $p1           $fn specific parameter - see below
-* @param $P2           $fn specific parameter - see below
-       */
-function ADODB_Error_PEAR($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)
-{
-global $ADODB_Last_PEAR_Error;
-
-       if (error_reporting() == 0) return; // obey @ protocol
-       switch($fn) {
-       case 'EXECUTE':
-               $sql = $p1;
-               $inputparams = $p2;
-
-               $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")";
-               break;
-
-       case 'PCONNECT':
-       case 'CONNECT':
-               $host = $p1;
-               $database = $p2;
-
-               $s = "$dbms error: [$errno: $errmsg] in $fn('$host', ?, ?, '$database')";
-               break;
-
-       default:
-               $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)";
-               break;
-       }
-
-       $class = ADODB_PEAR_ERROR_CLASS;
-       $ADODB_Last_PEAR_Error = new $class($s, $errno,
-               $GLOBALS['_PEAR_default_error_mode'],
-               $GLOBALS['_PEAR_default_error_options'],
-               $errmsg);
-
-       //print "<p>!$s</p>";
-}
-
-/**
-* Returns last PEAR_Error object. This error might be for an error that
-* occured several sql statements ago.
-*/
-function ADODB_PEAR_Error()
-{
-global $ADODB_Last_PEAR_Error;
-
-       return $ADODB_Last_PEAR_Error;
-}
diff --git a/typo3/sysext/adodb/adodb/adodb-exceptions.inc.php b/typo3/sysext/adodb/adodb/adodb-exceptions.inc.php
deleted file mode 100644 (file)
index 1f92c4a..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-
-/**
- * @version   v5.20.3  01-Jan-2016
- * @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 http://php.weblogs.com
- *
- * Exception-handling code using PHP5 exceptions (try-catch-throw).
- */
-
-
-if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR);
-define('ADODB_ERROR_HANDLER','adodb_throw');
-
-class ADODB_Exception extends Exception {
-var $dbms;
-var $fn;
-var $sql = '';
-var $params = '';
-var $host = '';
-var $database = '';
-
-       function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
-       {
-               switch($fn) {
-               case 'EXECUTE':
-                       $this->sql = is_array($p1) ? $p1[0] : $p1;
-                       $this->params = $p2;
-                       $s = "$dbms error: [$errno: $errmsg] in $fn(\"$this->sql\")\n";
-                       break;
-
-               case 'PCONNECT':
-               case 'CONNECT':
-                       $user = $thisConnection->user;
-                       $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n";
-                       break;
-               default:
-                       $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n";
-                       break;
-               }
-
-               $this->dbms = $dbms;
-               if ($thisConnection) {
-                       $this->host = $thisConnection->host;
-                       $this->database = $thisConnection->database;
-               }
-               $this->fn = $fn;
-               $this->msg = $errmsg;
-
-               if (!is_numeric($errno)) $errno = -1;
-               parent::__construct($s,$errno);
-       }
-}
-
-/**
-* Default Error Handler. This will be called with the following params
-*
-* @param $dbms         the RDBMS you are connecting to
-* @param $fn           the name of the calling function (in uppercase)
-* @param $errno                the native error number from the database
-* @param $errmsg       the native error msg from the database
-* @param $p1           $fn specific parameter - see below
-* @param $P2           $fn specific parameter - see below
-*/
-
-function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
-{
-global $ADODB_EXCEPTION;
-
-       if (error_reporting() == 0) return; // obey @ protocol
-       if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION;
-       else $errfn = 'ADODB_EXCEPTION';
-       throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection);
-}
diff --git a/typo3/sysext/adodb/adodb/adodb-iterator.inc.php b/typo3/sysext/adodb/adodb/adodb-iterator.inc.php
deleted file mode 100644 (file)
index 6b75388..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/*
-  @version   v5.20.3  01-Jan-2016
-  @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.
-
-  Declares the ADODB Base Class for PHP5 "ADODB_BASE_RS", and supports iteration with
-  the ADODB_Iterator class.
-
-               $rs = $db->Execute("select * from adoxyz");
-               foreach($rs as $k => $v) {
-                       echo $k; print_r($v); echo "<br>";
-               }
-
-
-       Iterator code based on http://cvs.php.net/cvs.php/php-src/ext/spl/examples/cachingiterator.inc?login=2
-
-
-       Moved to adodb.inc.php to improve performance.
- */
diff --git a/typo3/sysext/adodb/adodb/adodb-lib.inc.php b/typo3/sysext/adodb/adodb/adodb-lib.inc.php
deleted file mode 100644 (file)
index 7711290..0000000
+++ /dev/null
@@ -1,1251 +0,0 @@
-<?php
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-global $ADODB_INCLUDED_LIB;
-$ADODB_INCLUDED_LIB = 1;
-
-/*
-  @version   v5.20.3  01-Jan-2016
-  @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.
-
-  Less commonly used functions are placed here to reduce size of adodb.inc.php.
-*/
-
-function adodb_strip_order_by($sql)
-{
-       $rez = preg_match('/(\sORDER\s+BY\s(?:[^)](?!LIMIT))*)/is', $sql, $arr);
-       if ($arr)
-               if (strpos($arr[1], '(') !== false) {
-                       $at = strpos($sql, $arr[1]);
-                       $cntin = 0;
-                       for ($i=$at, $max=strlen($sql); $i < $max; $i++) {
-                               $ch = $sql[$i];
-                               if ($ch == '(') {
-                                       $cntin += 1;
-                               } elseif($ch == ')') {
-                                       $cntin -= 1;
-                                       if ($cntin < 0) {
-                                               break;
-                                       }
-                               }
-                       }
-                       $sql = substr($sql,0,$at).substr($sql,$i);
-               } else {
-                       $sql = str_replace($arr[1], '', $sql);
-               }
-       return $sql;
-}
-
-if (false) {
-       $sql = 'select * from (select a from b order by a(b),b(c) desc)';
-       $sql = '(select * from abc order by 1)';
-       die(adodb_strip_order_by($sql));
-}
-
-function adodb_probetypes(&$array,&$types,$probe=8)
-{
-// probe and guess the type
-       $types = array();
-       if ($probe > sizeof($array)) $max = sizeof($array);
-       else $max = $probe;
-
-
-       for ($j=0;$j < $max; $j++) {
-               $row = $array[$j];
-               if (!$row) break;
-               $i = -1;
-               foreach($row as $v) {
-                       $i += 1;
-
-                       if (isset($types[$i]) && $types[$i]=='C') continue;
-
-                       //print " ($i ".$types[$i]. "$v) ";
-                       $v = trim($v);
-
-                       if (!preg_match('/^[+-]{0,1}[0-9\.]+$/',$v)) {
-                               $types[$i] = 'C'; // once C, always C
-
-                               continue;
-                       }
-                       if ($j == 0) {
-                       // If empty string, we presume is character
-                       // test for integer for 1st row only
-                       // after that it is up to testing other rows to prove
-                       // that it is not an integer
-                               if (strlen($v) == 0) $types[$i] = 'C';
-                               if (strpos($v,'.') !== false) $types[$i] = 'N';
-                               else  $types[$i] = 'I';
-                               continue;
-                       }
-
-                       if (strpos($v,'.') !== false) $types[$i] = 'N';
-
-               }
-       }
-
-}
-
-function  adodb_transpose(&$arr, &$newarr, &$hdr, &$fobjs)
-{
-       $oldX = sizeof(reset($arr));
-       $oldY = sizeof($arr);
-
-       if ($hdr) {
-               $startx = 1;
-               $hdr = array('Fields');
-               for ($y = 0; $y < $oldY; $y++) {
-                       $hdr[] = $arr[$y][0];
-               }
-       } else
-               $startx = 0;
-
-       for ($x = $startx; $x < $oldX; $x++) {
-               if ($fobjs) {
-                       $o = $fobjs[$x];
-                       $newarr[] = array($o->name);
-               } else
-                       $newarr[] = array();
-
-               for ($y = 0; $y < $oldY; $y++) {
-                       $newarr[$x-$startx][] = $arr[$y][$x];
-               }
-       }
-}
-
-// Force key to upper.
-// See also http://www.php.net/manual/en/function.array-change-key-case.php
-function _array_change_key_case($an_array)
-{
-       if (is_array($an_array)) {
-               $new_array = array();
-               foreach($an_array as $key=>$value)
-                       $new_array[strtoupper($key)] = $value;
-
-               return $new_array;
-   }
-
-       return $an_array;
-}
-
-function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_autoinc)
-{
-               if (count($fieldArray) == 0) return 0;
-               $first = true;
-               $uSet = '';
-
-               if (!is_array($keyCol)) {
-                       $keyCol = array($keyCol);
-               }
-               foreach($fieldArray as $k => $v) {
-                       if ($v === null) {
-                               $v = 'NULL';
-                               $fieldArray[$k] = $v;
-                       } else if ($autoQuote && /*!is_numeric($v) /*and strncmp($v,"'",1) !== 0 -- sql injection risk*/ strcasecmp($v,$zthis->null2null)!=0) {
-                               $v = $zthis->qstr($v);
-                               $fieldArray[$k] = $v;
-                       }
-                       if (in_array($k,$keyCol)) continue; // skip UPDATE if is key
-
-                       if ($first) {
-                               $first = false;
-                               $uSet = "$k=$v";
-                       } else
-                               $uSet .= ",$k=$v";
-               }
-
-               $where = false;
-               foreach ($keyCol as $v) {
-                       if (isset($fieldArray[$v])) {
-                               if ($where) $where .= ' and '.$v.'='.$fieldArray[$v];
-                               else $where = $v.'='.$fieldArray[$v];
-                       }
-               }
-
-               if ($uSet && $where) {
-                       $update = "UPDATE $table SET $uSet WHERE $where";
-
-                       $rs = $zthis->Execute($update);
-
-
-                       if ($rs) {
-                               if ($zthis->poorAffectedRows) {
-                               /*
-                                The Select count(*) wipes out any errors that the update would have returned.
-                               http://phplens.com/lens/lensforum/msgs.php?id=5696
-                               */
-                                       if ($zthis->ErrorNo()<>0) return 0;
-
-                               # affected_rows == 0 if update field values identical to old values
-                               # for mysql - which is silly.
-
-                                       $cnt = $zthis->GetOne("select count(*) from $table where $where");
-                                       if ($cnt > 0) return 1; // record already exists
-                               } else {
-                                       if (($zthis->Affected_Rows()>0)) return 1;
-                               }
-                       } else
-                               return 0;
-               }
-
-       //      print "<p>Error=".$this->ErrorNo().'<p>';
-               $first = true;
-               foreach($fieldArray as $k => $v) {
-                       if ($has_autoinc && in_array($k,$keyCol)) continue; // skip autoinc col
-
-                       if ($first) {
-                               $first = false;
-                               $iCols = "$k";
-                               $iVals = "$v";
-                       } else {
-                               $iCols .= ",$k";
-                               $iVals .= ",$v";
-                       }
-               }
-               $insert = "INSERT INTO $table ($iCols) VALUES ($iVals)";
-               $rs = $zthis->Execute($insert);
-               return ($rs) ? 2 : 0;
-}
-
-// Requires $ADODB_FETCH_MODE = ADODB_FETCH_NUM
-function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=false,
-                       $size=0, $selectAttr='',$compareFields0=true)
-{
-       $hasvalue = false;
-
-       if ($multiple or is_array($defstr)) {
-               if ($size==0) $size=5;
-               $attr = ' multiple size="'.$size.'"';
-               if (!strpos($name,'[]')) $name .= '[]';
-       } else if ($size) $attr = ' size="'.$size.'"';
-       else $attr ='';
-
-       $s = '<select name="'.$name.'"'.$attr.' '.$selectAttr.'>';
-       if ($blank1stItem)
-               if (is_string($blank1stItem))  {
-                       $barr = explode(':',$blank1stItem);
-                       if (sizeof($barr) == 1) $barr[] = '';
-                       $s .= "\n<option value=\"".$barr[0]."\">".$barr[1]."</option>";
-               } else $s .= "\n<option></option>";
-
-       if ($zthis->FieldCount() > 1) $hasvalue=true;
-       else $compareFields0 = true;
-
-       $value = '';
-    $optgroup = null;
-    $firstgroup = true;
-    $fieldsize = $zthis->FieldCount();
-       while(!$zthis->EOF) {
-               $zval = rtrim(reset($zthis->fields));
-
-               if ($blank1stItem && $zval=="") {
-                       $zthis->MoveNext();
-                       continue;
-               }
-
-        if ($fieldsize > 1) {
-                       if (isset($zthis->fields[1]))
-                               $zval2 = rtrim($zthis->fields[1]);
-                       else
-                               $zval2 = rtrim(next($zthis->fields));
-               }
-               $selected = ($compareFields0) ? $zval : $zval2;
-
-        $group = '';
-               if ($fieldsize > 2) {
-            $group = rtrim($zthis->fields[2]);
-        }
-/*
-        if ($optgroup != $group) {
-            $optgroup = $group;
-            if ($firstgroup) {
-                $firstgroup = false;
-                $s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
-            } else {
-                $s .="\n</optgroup>";
-                $s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
-            }
-               }
-*/
-               if ($hasvalue)
-                       $value = " value='".htmlspecialchars($zval2)."'";
-
-               if (is_array($defstr))  {
-
-                       if (in_array($selected,$defstr))
-                               $s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
-                       else
-                               $s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
-               }
-               else {
-                       if (strcasecmp($selected,$defstr)==0)
-                               $s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
-                       else
-                               $s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
-               }
-               $zthis->MoveNext();
-       } // while
-
-    // closing last optgroup
-    if($optgroup != null) {
-        $s .= "\n</optgroup>";
-       }
-       return $s ."\n</select>\n";
-}
-
-// Requires $ADODB_FETCH_MODE = ADODB_FETCH_NUM
-function _adodb_getmenu_gp(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=false,
-                       $size=0, $selectAttr='',$compareFields0=true)
-{
-       $hasvalue = false;
-
-       if ($multiple or is_array($defstr)) {
-               if ($size==0) $size=5;
-               $attr = ' multiple size="'.$size.'"';
-               if (!strpos($name,'[]')) $name .= '[]';
-       } else if ($size) $attr = ' size="'.$size.'"';
-       else $attr ='';
-
-       $s = '<select name="'.$name.'"'.$attr.' '.$selectAttr.'>';
-       if ($blank1stItem)
-               if (is_string($blank1stItem))  {
-                       $barr = explode(':',$blank1stItem);
-                       if (sizeof($barr) == 1) $barr[] = '';
-                       $s .= "\n<option value=\"".$barr[0]."\">".$barr[1]."</option>";
-               } else $s .= "\n<option></option>";
-
-       if ($zthis->FieldCount() > 1) $hasvalue=true;
-       else $compareFields0 = true;
-
-       $value = '';
-    $optgroup = null;
-    $firstgroup = true;
-    $fieldsize = sizeof($zthis->fields);
-       while(!$zthis->EOF) {
-               $zval = rtrim(reset($zthis->fields));
-
-               if ($blank1stItem && $zval=="") {
-                       $zthis->MoveNext();
-                       continue;
-               }
-
-        if ($fieldsize > 1) {
-                       if (isset($zthis->fields[1]))
-                               $zval2 = rtrim($zthis->fields[1]);
-                       else
-                               $zval2 = rtrim(next($zthis->fields));
-               }
-               $selected = ($compareFields0) ? $zval : $zval2;
-
-        $group = '';
-               if (isset($zthis->fields[2])) {
-            $group = rtrim($zthis->fields[2]);
-        }
-
-        if ($optgroup != $group) {
-            $optgroup = $group;
-            if ($firstgroup) {
-                $firstgroup = false;
-                $s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
-            } else {
-                $s .="\n</optgroup>";
-                $s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
-            }
-               }
-
-               if ($hasvalue)
-                       $value = " value='".htmlspecialchars($zval2)."'";
-
-               if (is_array($defstr))  {
-
-                       if (in_array($selected,$defstr))
-                               $s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
-                       else
-                               $s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
-               }
-               else {
-                       if (strcasecmp($selected,$defstr)==0)
-                               $s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
-                       else
-                               $s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
-               }
-               $zthis->MoveNext();
-       } // while
-
-    // closing last optgroup
-    if($optgroup != null) {
-        $s .= "\n</optgroup>";
-       }
-       return $s ."\n</select>\n";
-}
-
-
-/*
-       Count the number of records this sql statement will return by using
-       query rewriting heuristics...
-
-       Does not work with UNIONs, except with postgresql and oracle.
-
-       Usage:
-
-       $conn->Connect(...);
-       $cnt = _adodb_getcount($conn, $sql);
-
-*/
-function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
-{
-       $qryRecs = 0;
-
-        if (!empty($zthis->_nestedSQL) || preg_match("/^\s*SELECT\s+DISTINCT/is", $sql) ||
-               preg_match('/\s+GROUP\s+BY\s+/is',$sql) ||
-               preg_match('/\s+UNION\s+/is',$sql)) {
-
-               $rewritesql = adodb_strip_order_by($sql);
-
-               // ok, has SELECT DISTINCT or GROUP BY so see if we can use a table alias
-               // but this is only supported by oracle and postgresql...
-               if ($zthis->dataProvider == 'oci8') {
-                       // Allow Oracle hints to be used for query optimization, Chris Wrye
-                       if (preg_match('#/\\*+.*?\\*\\/#', $sql, $hint)) {
-                               $rewritesql = "SELECT ".$hint[0]." COUNT(*) FROM (".$rewritesql.")";
-                       } else
-                               $rewritesql = "SELECT COUNT(*) FROM (".$rewritesql.")";
-
-               } else if (strncmp($zthis->databaseType,'postgres',8) == 0 || strncmp($zthis->databaseType,'mysql',5) == 0)  {
-                       $rewritesql = "SELECT COUNT(*) FROM ($rewritesql) _ADODB_ALIAS_";
-               } else {
-                       $rewritesql = "SELECT COUNT(*) FROM ($rewritesql)";
-               }
-       } else {
-               // now replace SELECT ... FROM with SELECT COUNT(*) FROM
-               if ( strpos($sql, '_ADODB_COUNT') !== FALSE ) {
-                       $rewritesql = preg_replace('/^\s*?SELECT\s+_ADODB_COUNT(.*)_ADODB_COUNT\s/is','SELECT COUNT(*) ',$sql);
-               } else {
-                       $rewritesql = preg_replace('/^\s*?SELECT\s.*?\s+(.*?)\s+FROM\s/is','SELECT COUNT(*) FROM ',$sql);
-               }
-               // fix by alexander zhukov, alex#unipack.ru, because count(*) and 'order by' fails
-               // with mssql, access and postgresql. Also a good speedup optimization - skips sorting!
-               // also see http://phplens.com/lens/lensforum/msgs.php?id=12752
-               $rewritesql = adodb_strip_order_by($rewritesql);
-       }
-
-       if (isset($rewritesql) && $rewritesql != $sql) {
-               if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0];
-
-               if ($secs2cache) {
-                       // we only use half the time of secs2cache because the count can quickly
-                       // become inaccurate if new records are added
-                       $qryRecs = $zthis->CacheGetOne($secs2cache/2,$rewritesql,$inputarr);
-
-               } else {
-                       $qryRecs = $zthis->GetOne($rewritesql,$inputarr);
-               }
-               if ($qryRecs !== false) return $qryRecs;
-       }
-       //--------------------------------------------
-       // query rewrite failed - so try slower way...
-
-
-       // strip off unneeded ORDER BY if no UNION
-       if (preg_match('/\s*UNION\s*/is', $sql)) $rewritesql = $sql;
-       else $rewritesql = $rewritesql = adodb_strip_order_by($sql);
-
-       if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0];
-
-       if ($secs2cache) {
-               $rstest = $zthis->CacheExecute($secs2cache,$rewritesql,$inputarr);
-               if (!$rstest) $rstest = $zthis->CacheExecute($secs2cache,$sql,$inputarr);
-       } else {
-               $rstest = $zthis->Execute($rewritesql,$inputarr);
-               if (!$rstest) $rstest = $zthis->Execute($sql,$inputarr);
-       }
-       if ($rstest) {
-                       $qryRecs = $rstest->RecordCount();
-               if ($qryRecs == -1) {
-               global $ADODB_EXTENSION;
-               // some databases will return -1 on MoveLast() - change to MoveNext()
-                       if ($ADODB_EXTENSION) {
-                               while(!$rstest->EOF) {
-                                       adodb_movenext($rstest);
-                               }
-                       } else {
-                               while(!$rstest->EOF) {
-                                       $rstest->MoveNext();
-                               }
-                       }
-                       $qryRecs = $rstest->_currentRow;
-               }
-               $rstest->Close();
-               if ($qryRecs == -1) return 0;
-       }
-       return $qryRecs;
-}
-
-/*
-       Code originally from "Cornel G" <conyg@fx.ro>
-