From 279cd0dc5b138705d1811f15139fca4454e64169 Mon Sep 17 00:00:00 2001 From: Koldo Picaza <1093654+kpicaza@users.noreply.github.com> Date: Thu, 30 Dec 2021 02:47:01 +0100 Subject: [PATCH] Drop php 7.3 support --- .github/dependabot.yml | 11 + composer.json | 5 +- constants.php | 55 + .../config/configuration_files.config.php | 3 + phpcs.xml.dist | 4 +- phpstan-baseline.neon | 502 + phpstan.neon | 7 + phpunit.xml => phpunit.xml.dist | 0 rector.php | 32 + src/Browscap/Browscap.php | 45 +- src/Browscap/cache.php | 14856 ++++++++-------- src/Php-Sql-Parser/php-sql-parser.php | 53 +- src/PhpThumb/GdThumb.inc.php | 7 +- src/PhpThumb/ThumbLib.inc.php | 4 +- .../thumb_plugins/gd_reflection.inc.php | 4 +- src/RSS_PHP/rss_php.php | 9 +- src/Sifo/API/Twitter.php | 814 - src/Sifo/API/Youtube.php | 162 - src/Sifo/Bootstrap.php | 13 +- src/Sifo/CLBootstrap.php | 11 +- src/Sifo/Cache.php | 12 +- src/Sifo/Cache/Base.php | 4 +- src/Sifo/Cache/Lock.php | 10 +- src/Sifo/Client.php | 4 +- src/Sifo/Config.php | 12 +- src/Sifo/Controller.php | 19 +- src/Sifo/Cookie.php | 6 +- src/Sifo/Database.php | 19 +- src/Sifo/Debug.php | 17 +- src/Sifo/Debug/DataBaseHandler.php | 21 +- src/Sifo/Debug/Mysql.php | 10 +- src/Sifo/Debug/PredisProxyClient.php | 1 + src/Sifo/Debug/Search.php | 11 +- src/Sifo/Debug/Sphinxql.php | 4 +- src/Sifo/DependencyInjector.php | 3 +- src/Sifo/Dir.php | 140 - src/Sifo/Domains.php | 3 +- src/Sifo/Exceptions.php | 2 +- src/Sifo/Filter.php | 6 +- src/Sifo/FlashMessages.php | 13 +- src/Sifo/Form.php | 2 +- src/Sifo/Headers.php | 4 +- src/Sifo/I18N.php | 47 +- src/Sifo/JsPacker.php | 1 + src/Sifo/LoadBalancer.php | 6 +- src/Sifo/Mail.php | 5 +- src/Sifo/MediaGenerator.php | 8 +- src/Sifo/Metadata.php | 1 + src/Sifo/Mysql.php | 6 +- src/Sifo/Password.php | 2 +- src/Sifo/RedisModel.php | 4 +- src/Sifo/Registry.php | 4 +- src/Sifo/Search.php | 1 + src/Sifo/Session.php | 2 +- .../Session/SessionEnvironmentStrategy.php | 2 +- src/Sifo/Sphinxql.php | 5 +- src/Sifo/Urls.php | 25 +- src/Sifo/View.php | 9 +- src/Sifo/View/Smarty.php | 9 +- src/Sifo/View/Twig.php | 6 +- src/Sifo/imageController.php | 5 +- src/Smarty-sifo-plugins/block.t.php | 4 +- .../function.email_obfuscator.php | 14 +- src/Smarty-sifo-plugins/function.fill.php | 4 +- src/Smarty-sifo-plugins/function.filln.php | 2 +- src/Smarty-sifo-plugins/function.genurl.php | 2 +- src/Smarty-sifo-plugins/function.paginate.php | 6 +- .../modifier.link_urls.php | 6 +- .../modifier.size_format.php | 8 +- .../modifier.time_format.php | 2 +- .../modifier.time_since.php | 1 + src/Twig-sifo-plugins/filter.link_urls.php | 12 +- src/Twig-sifo-plugins/filter.normalize.php | 6 +- src/Twig-sifo-plugins/filter.size_format.php | 8 +- src/Twig-sifo-plugins/filter.time_since.php | 1 + .../function.email_obfuscator.php | 14 +- src/Twig-sifo-plugins/function.fill.php | 4 +- src/Twig-sifo-plugins/function.filln.php | 2 +- src/Twig-sifo-plugins/function.genurl.php | 2 +- src/Twig-sifo-plugins/function.pagelink.php | 4 +- src/Twig-sifo-plugins/function.t.php | 4 +- src/adodb5/adodb-active-record.inc.php | 26 +- src/adodb5/adodb-active-recordx.inc.php | 16 +- src/adodb5/adodb-csvlib.inc.php | 15 +- src/adodb5/adodb-datadict.inc.php | 233 +- src/adodb5/adodb-error.inc.php | 2 +- src/adodb5/adodb-errorpear.inc.php | 16 +- src/adodb5/adodb-iterator.inc.php | 18 +- src/adodb5/adodb-lib.inc.php | 241 +- src/adodb5/adodb-memcache.lib.inc.php | 7 +- src/adodb5/adodb-pager.inc.php | 7 +- src/adodb5/adodb-pear.inc.php | 8 +- src/adodb5/adodb-perf.inc.php | 237 +- src/adodb5/adodb-php4.inc.php | 16 - src/adodb5/adodb-time.inc.php | 108 +- src/adodb5/adodb-xmlschema.inc.php | 20 +- src/adodb5/adodb-xmlschema03.inc.php | 17 +- src/adodb5/adodb.inc.php | 32 +- src/adodb5/contrib/toxmlrpc.inc.php | 183 - src/adodb5/datadict/datadict-access.inc.php | 96 - src/adodb5/datadict/datadict-db2.inc.php | 144 - src/adodb5/datadict/datadict-firebird.inc.php | 152 - src/adodb5/datadict/datadict-generic.inc.php | 50 +- src/adodb5/datadict/datadict-ibase.inc.php | 68 - src/adodb5/datadict/datadict-informix.inc.php | 81 - src/adodb5/datadict/datadict-mssql.inc.php | 284 - .../datadict/datadict-mssqlnative.inc.php | 282 - src/adodb5/datadict/datadict-oci8.inc.php | 297 - src/adodb5/datadict/datadict-postgres.inc.php | 448 - src/adodb5/datadict/datadict-sapdb.inc.php | 122 - src/adodb5/drivers/adodb-access.inc.php | 87 - src/adodb5/drivers/adodb-ado.inc.php | 660 - src/adodb5/drivers/adodb-ado5.inc.php | 704 - src/adodb5/drivers/adodb-ado_access.inc.php | 54 - src/adodb5/drivers/adodb-ado_mssql.inc.php | 154 - src/adodb5/drivers/adodb-ads.inc.php | 788 - src/adodb5/drivers/adodb-csv.inc.php | 207 - src/adodb5/drivers/adodb-db2.inc.php | 819 - src/adodb5/drivers/adodb-informix.inc.php | 40 - src/adodb5/drivers/adodb-informix72.inc.php | 475 - src/adodb5/drivers/adodb-ldap.inc.php | 423 - src/adodb5/drivers/adodb-mysqli.inc.php | 17 +- src/adodb5/drivers/adodb-netezza.inc.php | 170 - src/adodb5/drivers/adodb-oci8.inc.php | 1612 -- src/adodb5/drivers/adodb-oci805.inc.php | 59 - src/adodb5/drivers/adodb-oci8po.inc.php | 218 - src/adodb5/drivers/adodb-odbc.inc.php | 731 - src/adodb5/drivers/adodb-odbc_db2.inc.php | 368 - src/adodb5/drivers/adodb-odbc_mssql.inc.php | 306 - src/adodb5/drivers/adodb-odbc_oracle.inc.php | 110 - src/adodb5/drivers/adodb-odbtp.inc.php | 834 - .../drivers/adodb-odbtp_unicode.inc.php | 39 - src/adodb5/drivers/adodb-oracle.inc.php | 342 - src/adodb5/drivers/adodb-pdo.inc.php | 10 +- src/adodb5/drivers/adodb-pdo_mssql.inc.php | 6 +- src/adodb5/drivers/adodb-pdo_mysql.inc.php | 13 +- src/adodb5/drivers/adodb-pdo_oci.inc.php | 4 +- src/adodb5/drivers/adodb-pdo_pgsql.inc.php | 8 +- src/adodb5/drivers/adodb-pdo_sqlite.inc.php | 13 +- src/adodb5/drivers/adodb-postgres.inc.php | 14 - src/adodb5/drivers/adodb-postgres64.inc.php | 1071 -- src/adodb5/drivers/adodb-postgres7.inc.php | 313 - src/adodb5/drivers/adodb-postgres8.inc.php | 12 - src/adodb5/drivers/adodb-proxy.inc.php | 33 - src/adodb5/drivers/adodb-sapdb.inc.php | 184 - src/adodb5/drivers/adodb-sqlanywhere.inc.php | 169 - src/adodb5/drivers/adodb-vfp.inc.php | 107 - src/adodb5/pear/Auth/Container/ADOdb.php | 413 - src/adodb5/pear/readme.Auth.txt | 20 - src/adodb5/perf/perf-db2.inc.php | 102 - src/adodb5/perf/perf-informix.inc.php | 70 - src/adodb5/perf/perf-mssql.inc.php | 164 - src/adodb5/perf/perf-mssqlnative.inc.php | 164 - src/adodb5/perf/perf-mysql.inc.php | 98 +- src/adodb5/perf/perf-oci8.inc.php | 570 - src/adodb5/perf/perf-postgres.inc.php | 153 - src/adodb5/pivottable.inc.php | 6 +- src/adodb5/server.php | 2 +- src/adodb5/session/adodb-compress-bzip2.php | 10 +- src/adodb5/session/adodb-compress-gzip.php | 8 +- src/adodb5/session/adodb-cryptsession.php | 4 +- src/adodb5/session/adodb-cryptsession2.php | 4 +- src/adodb5/session/adodb-encrypt-secret.php | 2 +- src/adodb5/session/adodb-session-clob.php | 4 +- src/adodb5/session/adodb-session-clob2.php | 4 +- src/adodb5/session/adodb-session.php | 23 +- src/adodb5/session/adodb-session2.php | 26 +- .../session/adodb-sessions.oracle.clob.sql | 15 - src/adodb5/session/adodb-sessions.oracle.sql | 16 - src/adodb5/session/crypt.inc.php | 22 +- src/adodb5/session/old/adodb-cryptsession.php | 58 +- src/adodb5/session/old/adodb-session-clob.php | 15 +- src/adodb5/session/old/adodb-session.php | 22 +- src/adodb5/session/old/crypt.inc.php | 12 +- src/adodb5/toexport.inc.php | 5 +- src/googleTranslate-1.7/LICENSE | 339 - .../GoogleTranslateWrapper.html | 751 - .../GoogleTranslateWrapper/_example.php.html | 171 - .../_googleTranslate.class.php.html | 169 - ...e_GoogleTranslateWrapper__example.php.html | 39 - ...ateWrapper__googleTranslate.class.php.html | 444 - src/googleTranslate-1.7/docs/blank.html | 13 - .../classtrees_GoogleTranslateWrapper.html | 24 - .../docs/elementindex.html | 214 - .../elementindex_GoogleTranslateWrapper.html | 212 - src/googleTranslate-1.7/docs/errors.html | 20 - src/googleTranslate-1.7/docs/index.html | 24 - .../docs/li_GoogleTranslateWrapper.html | 141 - .../docs/media/images/Class.gif | Bin 1078 -> 0 bytes .../docs/media/images/Constant.gif | Bin 1041 -> 0 bytes .../docs/media/images/Constants.gif | Bin 1068 -> 0 bytes .../docs/media/images/Constructor.gif | Bin 1044 -> 0 bytes .../docs/media/images/Destructor.gif | Bin 1043 -> 0 bytes .../docs/media/images/Disk.gif | Bin 941 -> 0 bytes .../docs/media/images/FolderClosed.gif | Bin 963 -> 0 bytes .../docs/media/images/FolderOpened.gif | Bin 957 -> 0 bytes .../docs/media/images/Functions.gif | Bin 1064 -> 0 bytes .../docs/media/images/GhostClass.gif | Bin 1071 -> 0 bytes .../docs/media/images/I.png | Bin 148 -> 0 bytes .../docs/media/images/L.png | Bin 153 -> 0 bytes .../docs/media/images/Lminus.png | Bin 219 -> 0 bytes .../docs/media/images/Lplus.png | Bin 224 -> 0 bytes .../docs/media/images/PrivateDataMember.gif | Bin 967 -> 0 bytes .../docs/media/images/PrivateMethod.gif | Bin 1062 -> 0 bytes .../docs/media/images/PrivateProperty.gif | Bin 1063 -> 0 bytes .../docs/media/images/ProtectedDataMember.gif | Bin 1064 -> 0 bytes .../docs/media/images/ProtectedMethod.gif | Bin 1080 -> 0 bytes .../docs/media/images/ProtectedProperty.gif | Bin 1068 -> 0 bytes .../docs/media/images/PublicDataMember.gif | Bin 954 -> 0 bytes .../docs/media/images/PublicMethod.gif | Bin 1038 -> 0 bytes .../docs/media/images/PublicProperty.gif | Bin 1053 -> 0 bytes .../docs/media/images/T.png | Bin 152 -> 0 bytes .../docs/media/images/Thumbs.db | Bin 35328 -> 0 bytes .../docs/media/images/Tminus.png | Bin 207 -> 0 bytes .../docs/media/images/Tplus.png | Bin 222 -> 0 bytes .../docs/media/images/Types.gif | Bin 1049 -> 0 bytes .../docs/media/images/Variable.gif | Bin 1051 -> 0 bytes .../docs/media/images/Vars.gif | Bin 1064 -> 0 bytes .../docs/media/images/blank.png | Bin 144 -> 0 bytes .../docs/media/images/classFolder.gif | Bin 1069 -> 0 bytes .../docs/media/images/error.gif | Bin 122 -> 0 bytes .../docs/media/images/file.png | Bin 462 -> 0 bytes .../docs/media/images/foldericon.png | Bin 229 -> 0 bytes .../docs/media/images/minus.gif | Bin 64 -> 0 bytes .../docs/media/images/msgError.gif | Bin 997 -> 0 bytes .../docs/media/images/msgFatalError.gif | Bin 1040 -> 0 bytes .../docs/media/images/msgHint.gif | Bin 989 -> 0 bytes .../docs/media/images/msgInformation.gif | Bin 963 -> 0 bytes .../docs/media/images/msgWarning.gif | Bin 1043 -> 0 bytes .../docs/media/images/openfoldericon.png | Bin 232 -> 0 bytes .../docs/media/images/plus.gif | Bin 67 -> 0 bytes .../docs/media/images/spacer.gif | Bin 55 -> 0 bytes src/googleTranslate-1.7/docs/media/layout.css | 81 - .../docs/media/lib/classTree.js | 454 - .../docs/media/lib/tab.webfx.css | 86 - .../docs/media/lib/tabpane.js | 308 - src/googleTranslate-1.7/docs/media/lib/ua.js | 111 - src/googleTranslate-1.7/docs/media/print.css | 25 - src/googleTranslate-1.7/docs/media/style.css | 236 - .../docs/media/stylesheet.css | 230 - src/googleTranslate-1.7/docs/packages.html | 15 - src/googleTranslate-1.7/example.php | 22 - .../googleTranslate.class.php | 424 - 243 files changed, 9059 insertions(+), 29080 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 constants.php create mode 100644 instances/default/config/configuration_files.config.php create mode 100644 phpstan-baseline.neon create mode 100644 phpstan.neon rename phpunit.xml => phpunit.xml.dist (100%) create mode 100644 rector.php mode change 100755 => 100644 src/Browscap/Browscap.php mode change 100755 => 100644 src/RSS_PHP/rss_php.php delete mode 100644 src/Sifo/API/Twitter.php delete mode 100644 src/Sifo/API/Youtube.php delete mode 100644 src/Sifo/Dir.php delete mode 100644 src/adodb5/adodb-php4.inc.php delete mode 100644 src/adodb5/contrib/toxmlrpc.inc.php delete mode 100644 src/adodb5/datadict/datadict-access.inc.php delete mode 100644 src/adodb5/datadict/datadict-db2.inc.php delete mode 100644 src/adodb5/datadict/datadict-firebird.inc.php delete mode 100644 src/adodb5/datadict/datadict-ibase.inc.php delete mode 100644 src/adodb5/datadict/datadict-informix.inc.php delete mode 100644 src/adodb5/datadict/datadict-mssql.inc.php delete mode 100644 src/adodb5/datadict/datadict-mssqlnative.inc.php delete mode 100644 src/adodb5/datadict/datadict-oci8.inc.php delete mode 100644 src/adodb5/datadict/datadict-postgres.inc.php delete mode 100644 src/adodb5/datadict/datadict-sapdb.inc.php delete mode 100644 src/adodb5/drivers/adodb-access.inc.php delete mode 100644 src/adodb5/drivers/adodb-ado.inc.php delete mode 100644 src/adodb5/drivers/adodb-ado5.inc.php delete mode 100644 src/adodb5/drivers/adodb-ado_access.inc.php delete mode 100644 src/adodb5/drivers/adodb-ado_mssql.inc.php delete mode 100644 src/adodb5/drivers/adodb-ads.inc.php delete mode 100644 src/adodb5/drivers/adodb-csv.inc.php delete mode 100644 src/adodb5/drivers/adodb-db2.inc.php delete mode 100644 src/adodb5/drivers/adodb-informix.inc.php delete mode 100644 src/adodb5/drivers/adodb-informix72.inc.php delete mode 100644 src/adodb5/drivers/adodb-ldap.inc.php delete mode 100644 src/adodb5/drivers/adodb-netezza.inc.php delete mode 100644 src/adodb5/drivers/adodb-oci8.inc.php delete mode 100644 src/adodb5/drivers/adodb-oci805.inc.php delete mode 100644 src/adodb5/drivers/adodb-oci8po.inc.php delete mode 100644 src/adodb5/drivers/adodb-odbc.inc.php delete mode 100644 src/adodb5/drivers/adodb-odbc_db2.inc.php delete mode 100644 src/adodb5/drivers/adodb-odbc_mssql.inc.php delete mode 100644 src/adodb5/drivers/adodb-odbc_oracle.inc.php delete mode 100644 src/adodb5/drivers/adodb-odbtp.inc.php delete mode 100644 src/adodb5/drivers/adodb-odbtp_unicode.inc.php delete mode 100644 src/adodb5/drivers/adodb-oracle.inc.php delete mode 100644 src/adodb5/drivers/adodb-postgres.inc.php delete mode 100644 src/adodb5/drivers/adodb-postgres64.inc.php delete mode 100644 src/adodb5/drivers/adodb-postgres7.inc.php delete mode 100644 src/adodb5/drivers/adodb-postgres8.inc.php delete mode 100644 src/adodb5/drivers/adodb-proxy.inc.php delete mode 100644 src/adodb5/drivers/adodb-sapdb.inc.php delete mode 100644 src/adodb5/drivers/adodb-sqlanywhere.inc.php delete mode 100644 src/adodb5/drivers/adodb-vfp.inc.php delete mode 100644 src/adodb5/pear/Auth/Container/ADOdb.php delete mode 100644 src/adodb5/pear/readme.Auth.txt delete mode 100644 src/adodb5/perf/perf-db2.inc.php delete mode 100644 src/adodb5/perf/perf-informix.inc.php delete mode 100644 src/adodb5/perf/perf-mssql.inc.php delete mode 100644 src/adodb5/perf/perf-mssqlnative.inc.php delete mode 100644 src/adodb5/perf/perf-oci8.inc.php delete mode 100644 src/adodb5/perf/perf-postgres.inc.php delete mode 100644 src/adodb5/session/adodb-sessions.oracle.clob.sql delete mode 100644 src/adodb5/session/adodb-sessions.oracle.sql delete mode 100644 src/googleTranslate-1.7/LICENSE delete mode 100644 src/googleTranslate-1.7/docs/GoogleTranslateWrapper/GoogleTranslateWrapper.html delete mode 100644 src/googleTranslate-1.7/docs/GoogleTranslateWrapper/_example.php.html delete mode 100644 src/googleTranslate-1.7/docs/GoogleTranslateWrapper/_googleTranslate.class.php.html delete mode 100644 src/googleTranslate-1.7/docs/__filesource/fsource_GoogleTranslateWrapper__example.php.html delete mode 100644 src/googleTranslate-1.7/docs/__filesource/fsource_GoogleTranslateWrapper__googleTranslate.class.php.html delete mode 100644 src/googleTranslate-1.7/docs/blank.html delete mode 100644 src/googleTranslate-1.7/docs/classtrees_GoogleTranslateWrapper.html delete mode 100644 src/googleTranslate-1.7/docs/elementindex.html delete mode 100644 src/googleTranslate-1.7/docs/elementindex_GoogleTranslateWrapper.html delete mode 100644 src/googleTranslate-1.7/docs/errors.html delete mode 100644 src/googleTranslate-1.7/docs/index.html delete mode 100644 src/googleTranslate-1.7/docs/li_GoogleTranslateWrapper.html delete mode 100644 src/googleTranslate-1.7/docs/media/images/Class.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/Constant.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/Constants.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/Constructor.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/Destructor.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/Disk.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/FolderClosed.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/FolderOpened.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/Functions.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/GhostClass.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/I.png delete mode 100644 src/googleTranslate-1.7/docs/media/images/L.png delete mode 100644 src/googleTranslate-1.7/docs/media/images/Lminus.png delete mode 100644 src/googleTranslate-1.7/docs/media/images/Lplus.png delete mode 100644 src/googleTranslate-1.7/docs/media/images/PrivateDataMember.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/PrivateMethod.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/PrivateProperty.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/ProtectedDataMember.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/ProtectedMethod.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/ProtectedProperty.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/PublicDataMember.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/PublicMethod.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/PublicProperty.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/T.png delete mode 100644 src/googleTranslate-1.7/docs/media/images/Thumbs.db delete mode 100644 src/googleTranslate-1.7/docs/media/images/Tminus.png delete mode 100644 src/googleTranslate-1.7/docs/media/images/Tplus.png delete mode 100644 src/googleTranslate-1.7/docs/media/images/Types.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/Variable.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/Vars.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/blank.png delete mode 100644 src/googleTranslate-1.7/docs/media/images/classFolder.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/error.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/file.png delete mode 100644 src/googleTranslate-1.7/docs/media/images/foldericon.png delete mode 100644 src/googleTranslate-1.7/docs/media/images/minus.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/msgError.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/msgFatalError.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/msgHint.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/msgInformation.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/msgWarning.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/openfoldericon.png delete mode 100644 src/googleTranslate-1.7/docs/media/images/plus.gif delete mode 100644 src/googleTranslate-1.7/docs/media/images/spacer.gif delete mode 100644 src/googleTranslate-1.7/docs/media/layout.css delete mode 100644 src/googleTranslate-1.7/docs/media/lib/classTree.js delete mode 100644 src/googleTranslate-1.7/docs/media/lib/tab.webfx.css delete mode 100644 src/googleTranslate-1.7/docs/media/lib/tabpane.js delete mode 100644 src/googleTranslate-1.7/docs/media/lib/ua.js delete mode 100644 src/googleTranslate-1.7/docs/media/print.css delete mode 100644 src/googleTranslate-1.7/docs/media/style.css delete mode 100644 src/googleTranslate-1.7/docs/media/stylesheet.css delete mode 100644 src/googleTranslate-1.7/docs/packages.html delete mode 100644 src/googleTranslate-1.7/example.php delete mode 100644 src/googleTranslate-1.7/googleTranslate.class.php diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..a8392555 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" diff --git a/composer.json b/composer.json index bd04e50a..62f86b4c 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "issues": "https://github.com/sifophp/SIFO/issues" }, "require": { - "php": ">=7.2", + "php": "^7.4", "geoip/geoip": "^1.17", "neutron/sphinxsearch-api": "^2.0", "phpmailer/phpmailer": "^6.0", @@ -34,7 +34,10 @@ }, "require-dev": { "phpcompatibility/php-compatibility": "^9.3", + "phpstan/phpstan": "^1.3", "phpunit/phpunit": "^5.0", + "predis/predis": "^1.1", + "rector/rector": "^0.12.9", "symfony/var-dumper": "^3.2" }, "scripts": { diff --git a/constants.php b/constants.php new file mode 100644 index 00000000..bb1a0e17 --- /dev/null +++ b/constants.php @@ -0,0 +1,55 @@ +Bad $rs in %s. Connection or SQL invalid. Try using $connection->debug=true;
'); +define('ADODB_FETCH_NUM', 1); +define('ADODB_FETCH_ASSOC', 2); +define('ADODB_FETCH_BOTH', 3); +define('ADODB_FETCH_DEFAULT', 0); +define('ADODB_OPT_HIGH', 2); +define('ADODB_OPT_LOW', 1); +define('ADODB_ASSOC_CASE',0); +define('ADODB_PHPVER',74000); +define('ADODB_EXTENSION', '.php'); +define('ADODB_TABLE_REGEX','([]0-9a-z_\:\"\`\.\@\[-]*)'); + + +define('PEAR_ERROR_RETURN', 1); +define('SMARTY_RESOURCE_CHAR_SET', 'utf-8'); + +define('IFX_SCROLL',1); + +define('TIMESTAMP_FIRST_YEAR',0); + +define("DB_ERROR", -1); +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", -30); +define("DB_ERROR_ACCESS_VIOLATION", -26); +define("DB_ERROR_DEADLOCK", -27); +define("DB_ERROR_STATEMENT_TIMEOUT", -28); +define("DB_ERROR_SERIALIZATION_FAILURE", -29); +define('DB_FETCHMODE_ASSOC', 2); diff --git a/instances/default/config/configuration_files.config.php b/instances/default/config/configuration_files.config.php new file mode 100644 index 00000000..7c19642b --- /dev/null +++ b/instances/default/config/configuration_files.config.php @@ -0,0 +1,3 @@ + -instance_static_host}",
Hash = window.Hash ? window.Hash : "unset",
diff --git a/src/Sifo/LoadBalancer.php b/src/Sifo/LoadBalancer.php
index 44fcd157..d453d292 100644
--- a/src/Sifo/LoadBalancer.php
+++ b/src/Sifo/LoadBalancer.php
@@ -32,7 +32,7 @@ abstract class LoadBalancer
* Time in seconds the servers will be cached after checking if they are online.
* @var integer
*/
- const CACHE_EXPIRATION = 60;
+ public const CACHE_EXPIRATION = 60;
/**
* Name of the cache where the results of server status are stored.
@@ -96,7 +96,7 @@ public function setNodes( array $nodes )
$this->total_weights = $available_servers['total_weights'];
}
- $num_nodes = count( $this->nodes );
+ $num_nodes = count( (array) $this->nodes );
if ( 1 > $num_nodes )
{
@@ -136,7 +136,7 @@ public function get()
throw new LoadBalancer_Exception( "There aren't any nodes set in the balancer. Have you called setNodes( Array nodes ) ?" );
}
- $x = round( mt_rand( 0, $this->total_weights ) );
+ $x = round( random_int( 0, $this->total_weights ) );
$max = ( $i = 0 );
do
diff --git a/src/Sifo/Mail.php b/src/Sifo/Mail.php
index e5ba6434..ff005f31 100644
--- a/src/Sifo/Mail.php
+++ b/src/Sifo/Mail.php
@@ -29,10 +29,7 @@ class Mail
*/
protected $mail;
- /**
- * @var self
- */
- static private $instance;
+ static private self $instance;
/**
* Singleton of Client class.
diff --git a/src/Sifo/MediaGenerator.php b/src/Sifo/MediaGenerator.php
index 0fcbc7d7..f940f9d4 100644
--- a/src/Sifo/MediaGenerator.php
+++ b/src/Sifo/MediaGenerator.php
@@ -240,6 +240,7 @@ protected function buildMediaArray( array $media_config )
protected function getGeneratedHashes()
{
+ $revision = null;
if ( Domains::getInstance()->getDevMode() )
{
return false;
@@ -259,7 +260,7 @@ protected function getGeneratedHashes()
protected function isGeneratedFilesUpToDate( $revision )
{
- $checkout_revision = $this->getCheckoutRevision();
+ $checkout_revision = static::getCheckoutRevision();
return ( $checkout_revision === $revision );
}
@@ -278,12 +279,14 @@ public static function getCheckoutRevision( $root_path = ROOT_PATH )
protected function getHashesFileContent( Array $generated )
{
- $revision = $this->getCheckoutRevision();
+ $revision = static::getCheckoutRevision();
return "media_config['packages'] as $group => $media_config )
{
@@ -538,6 +541,7 @@ public static function getInstance()
*/
protected function getBaseCode( Array $media_list, Array $generated_files )
{
+ $base_array = [];
if ( count( $media_list ) !== count( $generated_files ) )
{
trigger_error( 'The number of groups does not match the number of files generated!', E_USER_WARNING );
diff --git a/src/Sifo/Metadata.php b/src/Sifo/Metadata.php
index 1361300d..c54edec2 100644
--- a/src/Sifo/Metadata.php
+++ b/src/Sifo/Metadata.php
@@ -137,6 +137,7 @@ static private function _replaceVars( $metadata, $metadata_info )
*/
static public function set( $key, $value, $is_metadata_key = false )
{
+ $metadata_information = [];
$registry = Registry::getInstance();
if ( $registry->keyExists( 'metadata_information' ) )
{
diff --git a/src/Sifo/Mysql.php b/src/Sifo/Mysql.php
index 3285d69b..4ec12044 100644
--- a/src/Sifo/Mysql.php
+++ b/src/Sifo/Mysql.php
@@ -113,7 +113,7 @@ class Mysql
*
* @var Mysql Object.
*/
- static private $instance = NULL;
+ static private ?\Sifo\Mysql $instance = NULL;
/**
* The PDO instance.
@@ -134,7 +134,7 @@ class Mysql
*
* @var string
*/
- const STATEMENT_CLASS = '\\Sifo\\MysqlStatement';
+ public const STATEMENT_CLASS = '\\Sifo\\MysqlStatement';
/**
* Initializes the PDO object with the domains.config.php database configuration.
@@ -158,7 +158,7 @@ public function __construct( $profile )
$init_commands
);
- $class = get_called_class();
+ $class = static::class;
$this->pdo->setAttribute( PDO::ATTR_STATEMENT_CLASS, array( $class::STATEMENT_CLASS, array( $this->pdo, $profile ) ) );
}
diff --git a/src/Sifo/Password.php b/src/Sifo/Password.php
index d2a18514..73ddd872 100644
--- a/src/Sifo/Password.php
+++ b/src/Sifo/Password.php
@@ -122,7 +122,7 @@ private function crypt_private( $password, $setting )
if ( $id != '$P$' && $id != '$H$' )
return $output;
- $count_log2 = strpos( $this->itoa64, $setting[3] );
+ $count_log2 = strpos( $this->itoa64, (string) $setting[3] );
if ( $count_log2 < 7 || $count_log2 > 30 )
return $output;
diff --git a/src/Sifo/RedisModel.php b/src/Sifo/RedisModel.php
index 862cdb6d..189fa765 100644
--- a/src/Sifo/RedisModel.php
+++ b/src/Sifo/RedisModel.php
@@ -29,9 +29,9 @@ class RedisModel
{
/**
* Redis client object.
- * @var \Predis\Client
+ * @var \Predis\Client[] $connected_client
*/
- private static $connected_client = array();
+ private static array $connected_client = array();
private $profile;
diff --git a/src/Sifo/Registry.php b/src/Sifo/Registry.php
index dac7073e..7dc5c994 100644
--- a/src/Sifo/Registry.php
+++ b/src/Sifo/Registry.php
@@ -33,10 +33,8 @@ class Registry
/**
* Array where all the storage is done.
- *
- * @var array
*/
- private static $storage = array();
+ private static array $storage = array();
/**
* Retrieves the default registry instance.
diff --git a/src/Sifo/Search.php b/src/Sifo/Search.php
index 39771246..3bcace8b 100644
--- a/src/Sifo/Search.php
+++ b/src/Sifo/Search.php
@@ -174,6 +174,7 @@ function __call( $method, $args )
*/
static function connect( $node_properties )
{
+ $sphinx = null;
if ( true === $node_properties['active'] )
{
$sphinx = new \SphinxClient();
diff --git a/src/Sifo/Session.php b/src/Sifo/Session.php
index caf5b70b..c207e6de 100644
--- a/src/Sifo/Session.php
+++ b/src/Sifo/Session.php
@@ -79,7 +79,7 @@ public static function getInstance()
/**
* Use it to set a single var like $ses->set( 'name', 'val' ); or an array of pairs key-value like $ses->set( array( 'key' => 'val' ) );
*
- * @param string|array $name
+ * @param string|array|null $name
* @param string|null $value
* @return boolean
*/
diff --git a/src/Sifo/Session/SessionEnvironmentStrategy.php b/src/Sifo/Session/SessionEnvironmentStrategy.php
index 62f19c23..708fe0b0 100644
--- a/src/Sifo/Session/SessionEnvironmentStrategy.php
+++ b/src/Sifo/Session/SessionEnvironmentStrategy.php
@@ -8,7 +8,7 @@ public function set()
{
$instance_inheritance = Domains::getInstance()->getInstanceInheritance();
$vertical_instance = array_pop($instance_inheritance);
- $instance_environment_initial = isset($_SERVER['APP_ENV'][0]) ? $_SERVER['APP_ENV'][0] : '';
+ $instance_environment_initial = $_SERVER['APP_ENV'][0] ?? '';
$instance_session_name = "SSID_{$instance_environment_initial}_{$vertical_instance}";
session_name($instance_session_name);
}
diff --git a/src/Sifo/Sphinxql.php b/src/Sifo/Sphinxql.php
index 39c6c5bb..d4348aeb 100644
--- a/src/Sifo/Sphinxql.php
+++ b/src/Sifo/Sphinxql.php
@@ -44,7 +44,7 @@ class Sphinxql
/**
* @var string Multi query string.
*/
- private $multi_query = '';
+ private string $multi_query = '';
/**
* Query options.
@@ -395,8 +395,7 @@ class LoadBalancerSphinxql extends LoadBalancer
*/
protected $load_balancer_cache_key = 'BalancedNodesSphinxql';
- /** @var Sphinxql */
- private $sphinxql_object;
+ private \Sifo\Sphinxql $sphinxql_object;
protected function addNodeIfAvailable( $index, $node_properties )
{
diff --git a/src/Sifo/Urls.php b/src/Sifo/Urls.php
index 91dce9bf..08e13435 100644
--- a/src/Sifo/Urls.php
+++ b/src/Sifo/Urls.php
@@ -30,10 +30,9 @@ class Urls
/**
* Singleton Instance.
- *
- * @var Urls
+ * @var \Sifo\Urls[] $instance
*/
- static private $instance;
+ static private array $instance;
/**
* Params passed via URL.
*
@@ -54,16 +53,12 @@ class Urls
static public $scheme = 'http';
/**
* Evaluated path context.
- *
- * @var string
*/
- static private $path = '';
+ static private string $path = '';
/**
* Splitted path.
- *
- * @var string
*/
- static private $path_parts = array( );
+ static private array $path_parts = array( );
/**
* This is the address the user used to access this webpage. E.g: http://myapp.com
*
@@ -93,12 +88,10 @@ class Urls
static public $url_definition = array( );
/**
* Stores all the available URLs.
- *
- * @var array
*/
- static private $url_config = array( );
+ static private array $url_config = array( );
- private $url_instance_config = array( );
+ private array $url_instance_config = array( );
/**
* Singleton for managing URLs. Use this static method instead of construct.
@@ -122,7 +115,7 @@ static public function getInstance( $instance_name = null )
private function __construct( $instance_name )
{
- $domains = Domains::getInstance( $instance_name );
+ $domains = Domains::getInstance();
$filter_server = FilterServer::getInstance();
$language = $domains->getLanguage();
@@ -175,7 +168,7 @@ private function __construct( $instance_name )
// Path is the first part of the explode, rest are parameters.
self::$path = array_shift( $params_parts );
- if ( count( $params_parts ) > 0 )
+ if ( (is_countable($params_parts) ? count( $params_parts ) : 0) > 0 )
{
self::$params = $params_parts;
}
@@ -322,7 +315,7 @@ static public function normalize( $string )
static public function buildUrl( $hostname, $controller, array $actions = array(), array $params = array() )
{
$url = Urls::getUrl( $hostname ) . '/';
- $callback = function( $a ) { return urlencode( $a ); };
+ $callback = fn($a) => urlencode( $a );
$actions = array_map($callback, $actions );
array_unshift( $actions, Urls::getUrl( $controller ) );
diff --git a/src/Sifo/View.php b/src/Sifo/View.php
index 98c62ef2..d7fd560d 100644
--- a/src/Sifo/View.php
+++ b/src/Sifo/View.php
@@ -25,14 +25,11 @@
*/
class View
{
- /** @var string */
- private $template_path;
+ private string $template_path = '';
- /** @var ViewSmarty|ViewTwig */
- private $templating_engine;
+ private ?\Sifo\ViewInterface $templating_engine = null;
- /** @var array */
- private $variables = [];
+ private array $variables = [];
public function fetch($template)
{
diff --git a/src/Sifo/View/Smarty.php b/src/Sifo/View/Smarty.php
index 5f378876..25e58fc8 100644
--- a/src/Sifo/View/Smarty.php
+++ b/src/Sifo/View/Smarty.php
@@ -4,8 +4,8 @@
class ViewSmarty implements ViewInterface
{
- /** @var \Smarty */
- private $smarty;
+ private \Smarty $smarty;
+ private $template_path;
public function __construct()
{
@@ -70,10 +70,7 @@ public function fetch($template)
$template,
$cache_id = null,
$compile_id = null,
- $parent = null,
- $display = false,
- $merge_tpl_vars = true,
- $no_output_filter = false
+ $parent = null
);
}
catch (\Exception $e)
diff --git a/src/Sifo/View/Twig.php b/src/Sifo/View/Twig.php
index a98b6544..516776ab 100644
--- a/src/Sifo/View/Twig.php
+++ b/src/Sifo/View/Twig.php
@@ -4,8 +4,7 @@
class ViewTwig implements ViewInterface
{
- /** @var \Twig_Environment */
- private $twig;
+ private \Twig_Environment $twig;
private $auto_literal;
@@ -13,8 +12,7 @@ class ViewTwig implements ViewInterface
private $twig_plugins_directory_path;
- /** @var array */
- private $variables = [];
+ private array $variables = [];
public function __construct()
{
diff --git a/src/Sifo/imageController.php b/src/Sifo/imageController.php
index 602f2b62..34f9c00c 100644
--- a/src/Sifo/imageController.php
+++ b/src/Sifo/imageController.php
@@ -59,6 +59,7 @@ abstract class ImageController extends Controller
*/
protected function customizeHeader()
{
+ $content_type = null;
if ( !( $this->is_gif || $this->is_jpeg || $this->is_png || $this->is_bmp || $this->is_ico ) || ( $this->is_gif + $this->is_jpeg + $this->is_png + $this->is_bmp + $this->is_ico ) > 1 )
{
throw new Exception_500( "Please do the favour of use one (and only one) image content_type helper!" );
@@ -115,13 +116,13 @@ protected function grabCache()
$cache = new CacheDisk();
$content = $cache->get( $cache_key['name'] );
- return ( $content ? $content : false );
+ return ( $content ?: false );
}
/**
* Dispatch the controller.
*/
- public function dispatch()
+ public function dispatch($container = null)
{
$this->customizeHeader();
diff --git a/src/Smarty-sifo-plugins/block.t.php b/src/Smarty-sifo-plugins/block.t.php
index e80c09ea..97301392 100644
--- a/src/Smarty-sifo-plugins/block.t.php
+++ b/src/Smarty-sifo-plugins/block.t.php
@@ -59,7 +59,7 @@ function smarty_block_t($params, $text, &$smarty)
if( ( $smarty == null ) || ( !$smarty->escape_html ) )
{
// In the don't protected configuration, the expectd behaviour is escapeing html:
- $escape = ( isset($params['escape'] ) )? $params['escape'] : "html";
+ $escape = $params['escape'] ?? "html";
unset($params['escape']);
if( isset( $params['escapevar'] ) )
@@ -106,7 +106,7 @@ function smarty_block_t($params, $text, &$smarty)
$text = \Sifo\I18N::getTranslation( $text );
// run strarg if there are parameters
- if (count($params)) {
+ if (is_countable($params) ? count($params) : 0) {
$text = smarty_gettext_strarg($text, $params);
}
diff --git a/src/Smarty-sifo-plugins/function.email_obfuscator.php b/src/Smarty-sifo-plugins/function.email_obfuscator.php
index f8e7505b..75460a03 100644
--- a/src/Smarty-sifo-plugins/function.email_obfuscator.php
+++ b/src/Smarty-sifo-plugins/function.email_obfuscator.php
@@ -23,9 +23,9 @@ function smarty_function_email_obfuscator($params, &$smarty)
{
// email address to obfuscate.
- $email = ( isset( $params['email'] ) ) ? $params['email'] : '';
+ $email = $params['email'] ?? '';
// optional text to show instead the email
- $linktext = ( isset( $params['text'] ) ) ? $params['text'] : '';
+ $linktext = $params['text'] ?? '';
// style information via class.
$style_class = ( isset( $params['class'] ) ) ? ' class=\"' . $params['class'] . '\" ' : '';
// style information via id.
@@ -42,16 +42,16 @@ function smarty_function_email_obfuscator($params, &$smarty)
$textafter = '';
if ( !empty( $linktext ) )
{
- $calling_class = get_called_class();
+ $calling_class = static::class;
$obj = new $calling_class();
$temp = smarty_block_t( $extra_params, $linktext, $obj);
// If the email is inside the text string
- $email_position = strpos( $temp, $email );
+ $email_position = strpos( $temp, (string) $email );
if ( $email_position )
{
// If the email is inside the string we make the link only in the email address
$textbefore = substr( $temp, 0, $email_position );
- $textafter = substr( $temp, strpos( $temp, $email ) + strlen( $email ) );
+ $textafter = substr( $temp, strpos( $temp, (string) $email ) + strlen( $email ) );
$linktext = '';
}
else
@@ -64,10 +64,10 @@ function smarty_function_email_obfuscator($params, &$smarty)
$character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
$key = str_shuffle( $character_set );
$cipher_text = '';
- $id = 'e'.rand( 1, 999999999 );
+ $id = 'e'.random_int( 1, 999_999_999 );
for ( $i = 0; $i < strlen( $email ); $i += 1 )
{
- $cipher_text.= $key[ strpos( $character_set, $email[ $i ] ) ];
+ $cipher_text.= $key[ strpos( $character_set, (string) $email[ $i ] ) ];
}
$script = 'var namex="' . $linktext . '";var a="' . $key . '";var b=a.split("").sort().join("");var c="' . $cipher_text . '";var d="";';
$script .= 'for(var e=0;efetch( $aParam['data']['template'] );
}
-
+
return $sOut;
-
+
}//smarty_paginate
-?>
\ No newline at end of file
+?>
diff --git a/src/Smarty-sifo-plugins/modifier.link_urls.php b/src/Smarty-sifo-plugins/modifier.link_urls.php
index 6c477eb0..6d677237 100644
--- a/src/Smarty-sifo-plugins/modifier.link_urls.php
+++ b/src/Smarty-sifo-plugins/modifier.link_urls.php
@@ -21,13 +21,11 @@ function smarty_modifier_link_urls($string)
{
$linkedString = preg_replace_callback(
"/\b(https?):\/\/([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]*)\b/i",
- static function($matches) {
- return "".($matches[0])."";
- },
+ static fn($matches) => "".($matches[0])."",
$string
);
return $linkedString;
}
-?>
\ No newline at end of file
+?>
diff --git a/src/Smarty-sifo-plugins/modifier.size_format.php b/src/Smarty-sifo-plugins/modifier.size_format.php
index c5ecc173..c5f89b21 100644
--- a/src/Smarty-sifo-plugins/modifier.size_format.php
+++ b/src/Smarty-sifo-plugins/modifier.size_format.php
@@ -37,7 +37,7 @@ function smarty_modifier_size_format( $size, $decimals=null )
// Kilobytes.
$formatted_size = number_format( $size, $decimals, $decimal_separator, $thousand_separator ).' B';
}
- elseif ( $size < 1048576 )
+ elseif ( $size < 1_048_576 )
{
if ( is_null( $decimals ) )
{
@@ -46,14 +46,14 @@ function smarty_modifier_size_format( $size, $decimals=null )
// Kylobytes.
$formatted_size = number_format( ( $size / 1024 ), $decimals, $decimal_separator, $thousand_separator ).' KB';
}
- elseif ( $size < 1073741824 )
+ elseif ( $size < 1_073_741_824 )
{
if ( is_null( $decimals ) )
{
$decimals = 1;
}
// Megabytes.
- $formatted_size = number_format( ( $size / 1048576 ), $decimals, $decimal_separator, $thousand_separator ).' MB';
+ $formatted_size = number_format( ( $size / 1_048_576 ), $decimals, $decimal_separator, $thousand_separator ).' MB';
}
else
{
@@ -62,7 +62,7 @@ function smarty_modifier_size_format( $size, $decimals=null )
$decimals = 1;
}
// Gigabytes.
- $formatted_size = number_format( ( $size / 1073741824 ), $decimals, $decimal_separator, $thousand_separator ).' GB';
+ $formatted_size = number_format( ( $size / 1_073_741_824 ), $decimals, $decimal_separator, $thousand_separator ).' GB';
}
diff --git a/src/Smarty-sifo-plugins/modifier.time_format.php b/src/Smarty-sifo-plugins/modifier.time_format.php
index fae1aad1..e34c9c5a 100644
--- a/src/Smarty-sifo-plugins/modifier.time_format.php
+++ b/src/Smarty-sifo-plugins/modifier.time_format.php
@@ -32,7 +32,7 @@ function smarty_modifier_time_format( $time, $decimals=3 )
{
$decimals = 0;
}
-
+
$time = $time*1000;
if ( $time < 100 )
diff --git a/src/Smarty-sifo-plugins/modifier.time_since.php b/src/Smarty-sifo-plugins/modifier.time_since.php
index 3b1ebceb..0224729f 100644
--- a/src/Smarty-sifo-plugins/modifier.time_since.php
+++ b/src/Smarty-sifo-plugins/modifier.time_since.php
@@ -22,6 +22,7 @@
*/
function smarty_modifier_time_since( $diff_time )
{
+ $value = [];
if ( !is_numeric ( $diff_time ) )
$diff_time = strtotime( date("Y-m-d H:i:s") ) - strtotime($diff_time);
diff --git a/src/Twig-sifo-plugins/filter.link_urls.php b/src/Twig-sifo-plugins/filter.link_urls.php
index 9b6932d6..9b394190 100644
--- a/src/Twig-sifo-plugins/filter.link_urls.php
+++ b/src/Twig-sifo-plugins/filter.link_urls.php
@@ -3,16 +3,10 @@
function twig_filter_link_urls()
{
return new \Twig_Filter(
- 'link_urls', function (
- $string
- ) {
- return preg_replace_callback(
+ 'link_urls', fn($string) => preg_replace_callback(
"/\b(https?):\/\/([-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]*)\b/i",
- static function ($matches) {
- return "".($matches[0])."";
- },
+ static fn($matches) => "".($matches[0])."",
$string
- );
- }
+ )
);
}
diff --git a/src/Twig-sifo-plugins/filter.normalize.php b/src/Twig-sifo-plugins/filter.normalize.php
index c6f1c64e..ba8cc194 100644
--- a/src/Twig-sifo-plugins/filter.normalize.php
+++ b/src/Twig-sifo-plugins/filter.normalize.php
@@ -3,10 +3,6 @@
function twig_filter_normalize()
{
return new \Twig_Filter(
- 'normalize', function (
- $string
- ) {
- return \Sifo\Urls::normalize($string);
- }
+ 'normalize', fn($string) => \Sifo\Urls::normalize($string)
);
}
diff --git a/src/Twig-sifo-plugins/filter.size_format.php b/src/Twig-sifo-plugins/filter.size_format.php
index 5c678043..f7f8cd21 100644
--- a/src/Twig-sifo-plugins/filter.size_format.php
+++ b/src/Twig-sifo-plugins/filter.size_format.php
@@ -24,7 +24,7 @@ function twig_filter_size_format()
// Kilobytes.
$formatted_size = number_format($size, $decimals, $decimal_separator, $thousand_separator) . ' B';
}
- elseif ($size < 1048576)
+ elseif ($size < 1_048_576)
{
if (null === $decimals)
{
@@ -33,14 +33,14 @@ function twig_filter_size_format()
// Kylobytes.
$formatted_size = number_format(($size / 1024), $decimals, $decimal_separator, $thousand_separator) . ' KB';
}
- elseif ($size < 1073741824)
+ elseif ($size < 1_073_741_824)
{
if (null === $decimals)
{
$decimals = 1;
}
// Megabytes.
- $formatted_size = number_format(($size / 1048576), $decimals, $decimal_separator, $thousand_separator) . ' MB';
+ $formatted_size = number_format(($size / 1_048_576), $decimals, $decimal_separator, $thousand_separator) . ' MB';
}
else
{
@@ -49,7 +49,7 @@ function twig_filter_size_format()
$decimals = 1;
}
// Gigabytes.
- $formatted_size = number_format(($size / 1073741824), $decimals, $decimal_separator, $thousand_separator) . ' GB';
+ $formatted_size = number_format(($size / 1_073_741_824), $decimals, $decimal_separator, $thousand_separator) . ' GB';
}
return $formatted_size;
diff --git a/src/Twig-sifo-plugins/filter.time_since.php b/src/Twig-sifo-plugins/filter.time_since.php
index 23d5c004..9f975ab2 100644
--- a/src/Twig-sifo-plugins/filter.time_since.php
+++ b/src/Twig-sifo-plugins/filter.time_since.php
@@ -6,6 +6,7 @@ function twig_filter_time_since()
'time_since', function (
$diff_time
) {
+ $value = [];
if (!is_numeric($diff_time))
{
$diff_time = strtotime(date("Y-m-d H:i:s")) - strtotime($diff_time);
diff --git a/src/Twig-sifo-plugins/function.email_obfuscator.php b/src/Twig-sifo-plugins/function.email_obfuscator.php
index a374f0b2..389571d5 100644
--- a/src/Twig-sifo-plugins/function.email_obfuscator.php
+++ b/src/Twig-sifo-plugins/function.email_obfuscator.php
@@ -5,9 +5,9 @@ function twig_function_email_obfuscator()
return new \Twig_Function(
'email_obfuscator', function (array $args = []) {
// email address to obfuscate.
- $email = isset($args[0]['email']) ? $args[0]['email'] : '';
+ $email = $args[0]['email'] ?? '';
// optional text to show instead the email
- $linktext = isset($args[0]['text']) ? $args[0]['text'] : '';
+ $linktext = $args[0]['text'] ?? '';
// style information via class.
$style_class = isset($args[0]['class']) ? ' class=\"' . $args[0]['class'] . '\" ' : '';
// style information via id.
@@ -25,16 +25,16 @@ function twig_function_email_obfuscator()
$textafter = '';
if (!empty($linktext))
{
- $calling_class = get_called_class();
+ $calling_class = static::class;
$obj = new $calling_class();
$temp = smarty_block_t($extra_params, $linktext, $obj);
// If the email is inside the text string
- $email_position = strpos($temp, $email);
+ $email_position = strpos($temp, (string) $email);
if ($email_position)
{
// If the email is inside the string we make the link only in the email address
$textbefore = substr($temp, 0, $email_position);
- $textafter = substr($temp, strpos($temp, $email) + strlen($email));
+ $textafter = substr($temp, strpos($temp, (string) $email) + strlen($email));
$linktext = '';
}
else
@@ -47,10 +47,10 @@ function twig_function_email_obfuscator()
$character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
$key = str_shuffle($character_set);
$cipher_text = '';
- $id = 'e' . rand(1, 999999999);
+ $id = 'e' . random_int(1, 999_999_999);
for ($i = 0; $i < strlen($email); $i += 1)
{
- $cipher_text .= $key[strpos($character_set, $email[$i])];
+ $cipher_text .= $key[strpos($character_set, (string) $email[$i])];
}
$script = 'var namex="' . $linktext . '";var a="' . $key . '";var b=a.split("").sort().join("");var c="' . $cipher_text . '";var d="";';
$script .= 'for(var e=0;egetString(
diff --git a/src/Twig-sifo-plugins/function.genurl.php b/src/Twig-sifo-plugins/function.genurl.php
index 2c169ff1..8ceb055b 100644
--- a/src/Twig-sifo-plugins/function.genurl.php
+++ b/src/Twig-sifo-plugins/function.genurl.php
@@ -16,7 +16,7 @@ function twig_function_genurl()
trigger_error("fill: The delimiter '$' is banned in function {url}", E_USER_NOTICE);
}
- $action = isset($args[0]['action']) ? $args[0]['action'] : 'replace';
+ $action = $args[0]['action'] ?? 'replace';
if (!in_array($action, array('add', 'replace', 'remove', 'clean_params')))
{
diff --git a/src/Twig-sifo-plugins/function.pagelink.php b/src/Twig-sifo-plugins/function.pagelink.php
index 7a5ed155..aa088d21 100644
--- a/src/Twig-sifo-plugins/function.pagelink.php
+++ b/src/Twig-sifo-plugins/function.pagelink.php
@@ -10,7 +10,7 @@ function twig_function_pagelink()
$delimiter = $args[0]['delimiter'];
unset($args[0]['delimiter']);
}
- if (class_exists('\Sifo\FilterServer') && method_exists('\Sifo\FilterServer', 'getString'))
+ if (class_exists(\Sifo\FilterServer::class) && method_exists(\Sifo\FilterServer::class, 'getString'))
{
$current_querystring = \Sifo\FilterServer::getInstance()->getString('QUERY_STRING');
$current_path = \Sifo\FilterServer::getInstance()->getString('REQUEST_URI');
@@ -44,7 +44,7 @@ function twig_function_pagelink()
if (!isset($args[0]['page']))
{
- trigger_error('pagelink: You should provide the destination pagelink. Params: ' . json_encode($args[0]), E_USER_WARNING);
+ trigger_error('pagelink: You should provide the destination pagelink. Params: ' . json_encode($args[0], JSON_THROW_ON_ERROR), E_USER_WARNING);
}
else
{
diff --git a/src/Twig-sifo-plugins/function.t.php b/src/Twig-sifo-plugins/function.t.php
index 6e3a19a6..ff6326ce 100644
--- a/src/Twig-sifo-plugins/function.t.php
+++ b/src/Twig-sifo-plugins/function.t.php
@@ -3,8 +3,6 @@
function twig_function_t()
{
return new \Twig_Function(
- 't', function ($text) {
- return \Sifo\I18N::getTranslation($text);
- }
+ 't', fn($text) => \Sifo\I18N::getTranslation($text)
);
}
diff --git a/src/adodb5/adodb-active-record.inc.php b/src/adodb5/adodb-active-record.inc.php
index daf3aac2..3829b508 100644
--- a/src/adodb5/adodb-active-record.inc.php
+++ b/src/adodb5/adodb-active-record.inc.php
@@ -96,7 +96,7 @@ static function UseDefaultValues($bool=null)
// should be static
static function SetDatabaseAdapter(&$db, $index=false)
{
- return ADODB_SetDatabaseAdapter($db, $index);
+ return ADODB_SetDatabaseAdapter($db);
}
@@ -125,8 +125,7 @@ function __construct($table = false, $pkeyarr=false, $db=false)
$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->_dbat = array_key_last($_ADODB_ACTIVE_DBS);
}
$this->_table = $table;
@@ -169,6 +168,7 @@ function _pluralize($table)
function _singularize($tables)
{
+ $table = null;
if (!ADODB_Active_Record::$_changeNames) return $table;
$ut = strtoupper($tables);
@@ -197,7 +197,7 @@ function hasMany($foreignRef, $foreignKey = false, $foreignClass = 'ADODB_Active
$ar = new $foreignClass($foreignRef);
$ar->foreignName = $foreignRef;
$ar->UpdateActiveTable();
- $ar->foreignKey = ($foreignKey) ? $foreignKey : $foreignRef.ADODB_Active_Record::$_foreignSuffix;
+ $ar->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()
@@ -207,7 +207,7 @@ function hasMany($foreignRef, $foreignKey = false, $foreignClass = 'ADODB_Active
static function TableHasMany($table, $foreignRef, $foreignKey = false, $foreignClass = 'ADODB_Active_Record')
{
$ar = new ADODB_Active_Record($table);
- $ar->hasMany($foreignRef, $foreignKey, $foreignClass);
+ $ar->hasMany($foreignRef, $foreignKey);
}
// use when you don't want ADOdb to auto-pluralize tablename
@@ -215,7 +215,7 @@ static function TableKeyHasMany($table, $tablePKey, $foreignRef, $foreignKey = f
{
if (!is_array($tablePKey)) $tablePKey = array($tablePKey);
$ar = new ADODB_Active_Record($table,$tablePKey);
- $ar->hasMany($foreignRef, $foreignKey, $foreignClass);
+ $ar->hasMany($foreignRef, $foreignKey);
}
@@ -236,8 +236,8 @@ function belongsTo($foreignRef,$foreignKey=false, $parentKey='', $parentClass =
$ar->foreignName = $foreignRef;
$ar->parentKey = $parentKey;
$ar->UpdateActiveTable();
- $ar->foreignKey = ($foreignKey) ? $foreignKey : $foreignRef.ADODB_Active_Record::$_foreignSuffix;
-
+ $ar->foreignKey = $foreignKey ?: $foreignRef.ADODB_Active_Record::$_foreignSuffix;
+
$table =& $this->TableInfo();
$table->_belongsTo[$foreignRef] = $ar;
# $this->$foreignRef = $this->_belongsTo[$foreignRef];
@@ -252,14 +252,14 @@ static function ClassBelongsTo($class, $foreignRef, $foreignKey=false, $parentKe
static function TableBelongsTo($table, $foreignRef, $foreignKey=false, $parentKey='', $parentClass = 'ADODB_Active_Record')
{
$ar = new ADOdb_Active_Record($table);
- $ar->belongsTo($foreignRef, $foreignKey, $parentKey, $parentClass);
+ $ar->belongsTo($foreignRef, $foreignKey);
}
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);
+ $ar->belongsTo($foreignRef, $foreignKey);
}
@@ -360,7 +360,7 @@ function UpdateActiveTable($pkeys=false,$forceUpdate=false)
@flock($fp, LOCK_SH);
$acttab = unserialize(fread($fp,100000));
fclose($fp);
- if ($acttab->_created + $ADODB_ACTIVE_CACHESECS - (abs(rand()) % 16) > time()) {
+ if ($acttab->_created + $ADODB_ACTIVE_CACHESECS - (abs(random_int(0, mt_getrandmax())) % 16) > time()) {
// abs(rand()) randomizes deletion, reducing contention to delete/refresh file
// ideally, you should cache at least 32 secs
$activedb->tables[$table] = $acttab;
@@ -557,6 +557,7 @@ function Reload()
// set a numeric array (using natural table field ordering) as object properties
function Set(&$row)
{
+ $keys = null;
global $ACTIVE_RECORD_SAFETY;
$db = $this->DB();
@@ -792,6 +793,7 @@ function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array())
// returns 0 on error, 1 on update, 2 on insert
function Replace()
{
+ $arr = [];
global $ADODB_ASSOC_CASE;
$db = $this->DB(); if (!$db) return false;
@@ -978,4 +980,4 @@ function adodb_GetActiveRecordsClass(&$db, $class, $table,$whereOrderBy,$bindarr
return $arr;
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/adodb-active-recordx.inc.php b/src/adodb5/adodb-active-recordx.inc.php
index 6d270b65..afb1e71b 100644
--- a/src/adodb5/adodb-active-recordx.inc.php
+++ b/src/adodb5/adodb-active-recordx.inc.php
@@ -293,7 +293,7 @@ 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;
+ $ar->foreignKey = $foreignKey ?: strtolower(get_class($this)) . self::$_foreignSuffix;
$table =& $this->TableInfo();
if(!isset($table->_hasMany[$foreignRef]))
@@ -319,7 +319,7 @@ function belongsTo($foreignRef,$foreignKey=false)
$ar = new ADODB_Active_Record($this->_pluralize($foreignRef));
$ar->foreignName = $foreignRef;
$ar->UpdateActiveTable();
- $ar->foreignKey = ($foreignKey) ? $foreignKey : $ar->foreignName . self::$_foreignSuffix;
+ $ar->foreignKey = $foreignKey ?: $ar->foreignName . self::$_foreignSuffix;
$table =& $this->TableInfo();
if(!isset($table->_belongsTo[$foreignRef]))
@@ -420,7 +420,7 @@ function UpdateActiveTable($pkeys=false,$forceUpdate=false)
@flock($fp, LOCK_SH);
$acttab = unserialize(fread($fp,100000));
fclose($fp);
- if ($acttab->_created + $ADODB_ACTIVE_CACHESECS - (abs(rand()) % 16) > time()) {
+ if ($acttab->_created + $ADODB_ACTIVE_CACHESECS - (abs(random_int(0, mt_getrandmax())) % 16) > time()) {
// abs(rand()) randomizes deletion, reducing contention to delete/refresh file
// ideally, you should cache at least 32 secs
$activedb->tables[$table] = $acttab;
@@ -619,6 +619,7 @@ function Reload()
// set a numeric array (using natural table field ordering) as object properties
function Set(&$row)
{
+ $keys = null;
global $ACTIVE_RECORD_SAFETY;
$db = $this->DB();
@@ -782,7 +783,7 @@ function Load($where=null,$bindarr=false)
$qry .= ' WHERE '.$where;
// Simple case: no relations. Load row and return.
- if((count($table->_hasMany) + count($table->_belongsTo)) < 1)
+ if(((is_countable($table->_hasMany) ? count($table->_hasMany) : 0) + (is_countable($table->_belongsTo) ? count($table->_belongsTo) : 0)) < 1)
{
$row = $db->GetRow($qry,$bindarr);
if(!$row)
@@ -796,7 +797,7 @@ function Load($where=null,$bindarr=false)
if(!$rows)
return false;
$db->SetFetchMode($save);
- if(count($rows) < 1)
+ if((is_countable($rows) ? count($rows) : 0) < 1)
return false;
$class = get_class($this);
$isFirstRow = true;
@@ -834,7 +835,7 @@ function Load($where=null,$bindarr=false)
$obj = new $class($table,false,$db);
$obj->Set($row);
// TODO Copy/paste code below: bad!
- if(count($table->_hasMany) > 0)
+ if((is_countable($table->_hasMany) ? count($table->_hasMany) : 0) > 0)
{
foreach($table->_hasMany as $foreignTable)
{
@@ -854,7 +855,7 @@ function Load($where=null,$bindarr=false)
}
}
}
- if(count($table->_belongsTo) > 0)
+ if((is_countable($table->_belongsTo) ? count($table->_belongsTo) : 0) > 0)
{
foreach($table->_belongsTo as $foreignTable)
{
@@ -984,6 +985,7 @@ function packageFind($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array()
// returns 0 on error, 1 on update, 2 on insert
function Replace()
{
+ $arr = [];
global $ADODB_ASSOC_CASE;
$db = $this->DB(); if (!$db) return false;
diff --git a/src/adodb5/adodb-csvlib.inc.php b/src/adodb5/adodb-csvlib.inc.php
index 7ad251a8..60effa06 100644
--- a/src/adodb5/adodb-csvlib.inc.php
+++ b/src/adodb5/adodb-csvlib.inc.php
@@ -33,6 +33,7 @@
*/
function _rs2serialize(&$rs,$conn=false,$sql='')
{
+ $flds = [];
$max = ($rs) ? $rs->FieldCount() : 0;
if ($sql) $sql = urlencode($sql);
@@ -48,7 +49,7 @@ function _rs2serialize(&$rs,$conn=false,$sql='')
$text = "====-1,0,$sql\n";
return $text;
}
- $tt = ($rs->timeCreated) ? $rs->timeCreated : time();
+ $tt = $rs->timeCreated ?: time();
## changed format from ====0 to ====1
$line = "====1,$tt,$sql\n";
@@ -68,7 +69,7 @@ function _rs2serialize(&$rs,$conn=false,$sql='')
$flds[] = $o;
}
- $savefetch = isset($rs->adodbFetchMode) ? $rs->adodbFetchMode : $rs->fetchMode;
+ $savefetch = $rs->adodbFetchMode ?? $rs->fetchMode;
$class = $rs->connection->arrayClass;
$rs2 = new $class();
$rs2->sql = $rs->sql;
@@ -154,21 +155,21 @@ function csv2rs($url,&$err,$timeout=0, $rsclass='ADORecordSet_array')
switch($tdiff) {
case 4:
case 3:
- if ((rand() & 31) == 0) {
+ if ((random_int(0, mt_getrandmax()) & 31) == 0) {
fclose($fp);
$err = "Timeout 3";
return $false;
}
break;
case 2:
- if ((rand() & 15) == 0) {
+ if ((random_int(0, mt_getrandmax()) & 15) == 0) {
fclose($fp);
$err = "Timeout 2";
return $false;
}
break;
case 1:
- if ((rand() & 3) == 0) {
+ if ((random_int(0, mt_getrandmax()) & 3) == 0) {
fclose($fp);
$err = "Timeout 1";
return $false;
@@ -179,7 +180,7 @@ function csv2rs($url,&$err,$timeout=0, $rsclass='ADORecordSet_array')
$err = "Timeout 0";
return $false;
} // switch
-
+
} // if check flush cache
}// (timeout>0)
$ttl = $meta[1];
@@ -313,4 +314,4 @@ function adodb_write_file($filename, $contents,$debug=false)
return $ok;
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/adodb-datadict.inc.php b/src/adodb5/adodb-datadict.inc.php
index 22e2c92c..25ebf69a 100644
--- a/src/adodb5/adodb-datadict.inc.php
+++ b/src/adodb5/adodb-datadict.inc.php
@@ -5,11 +5,11 @@
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.
*/
@@ -42,11 +42,11 @@ function ctype_alnum($text) {
/**
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.
@@ -62,7 +62,7 @@ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
$max = strlen($args);
$quoted = false;
$tokarr = array();
-
+
while ($pos < $max) {
$ch = substr($args,$pos,1);
switch($ch) {
@@ -77,17 +77,17 @@ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
}
break;
}
-
+
$tokarr[] = $ch;
break;
-
+
case '`':
if ($intoken) $tokarr[] = $ch;
case '(':
case ')':
case '"':
case "'":
-
+
if ($intoken) {
if (empty($endquote)) {
$tokens[$stmtno][] = implode('',$tokarr);
@@ -109,9 +109,9 @@ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
}
} else
$tokarr[] = $ch;
-
+
}else {
-
+
if ($ch == '(') $endquote = ')';
else $endquote = $ch;
$quoted = true;
@@ -120,23 +120,23 @@ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
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 {
@@ -156,7 +156,7 @@ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
$pos += 1;
}
if ($intoken) $tokens[$stmtno][] = implode('',$tokarr);
-
+
return $tokens;
}
@@ -180,41 +180,41 @@ class ADODB_DataDict {
var $invalidResizeTypes4 = array('CLOB','BLOB','TEXT','DATE','TIME'); // for changetablesql
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(
@@ -296,7 +296,7 @@ function MetaType($t,$len=-1,$fieldobj=false)
'NUM' => 'N',
'NUMERIC' => 'N',
'MONEY' => 'N',
-
+
## informix 9.2
'SQLINT' => 'I',
'SQLSERIAL' => 'I',
@@ -320,7 +320,7 @@ function MetaType($t,$len=-1,$fieldobj=false)
"SQLLVARCHAR" => 'X',
"SQLBOOL" => 'L'
);
-
+
if (!$this->connection->IsConnected()) {
$t = strtoupper($t);
if (isset($typeMap[$t])) return $typeMap[$t];
@@ -328,36 +328,36 @@ function MetaType($t,$len=-1,$fieldobj=false)
}
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 ) {
@@ -365,7 +365,7 @@ function TableName($name)
}
return $this->NameQuote($name);
}
-
+
// Executes the sql array returned by GetTableSQL and GetIndexSQL
function ExecuteSQLArray($sql, $continueOnError = true)
{
@@ -373,7 +373,7 @@ function ExecuteSQLArray($sql, $continueOnError = true)
$conn = $this->connection;
$saved = $conn->debug;
foreach($sql as $line) {
-
+
if ($this->debug) $conn->debug = true;
$ok = $conn->Execute($line);
$conn->debug = $saved;
@@ -385,17 +385,17 @@ function ExecuteSQLArray($sql, $continueOnError = true)
}
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)
@@ -403,25 +403,25 @@ function ExecuteSQLArray($sql, $continueOnError = true)
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.
*/
@@ -430,30 +430,30 @@ 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);
+ [$lines, $pkey, $idxs] = $this->_GenFields($flds);
// genfields can return FALSE at times
if ($lines == null) $lines = array();
$alter = 'ALTER TABLE ' . $tabname . $this->addCol . ' ';
@@ -468,7 +468,7 @@ function AddColumnSQL($tabname, $flds)
}
return $sql;
}
-
+
/**
* Change the definition of one column
*
@@ -484,7 +484,7 @@ function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
{
$tabname = $this->TableName ($tabname);
$sql = array();
- list($lines,$pkey,$idxs) = $this->_GenFields($flds);
+ [$lines, $pkey, $idxs] = $this->_GenFields($flds);
// genfields can return FALSE at times
if ($lines == null) $lines = array();
$alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' ';
@@ -500,7 +500,7 @@ function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
}
return $sql;
}
-
+
/**
* Rename one column
*
@@ -513,17 +513,18 @@ function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
*/
function RenameColumnSQL($tabname,$oldcolumn,$newcolumn,$flds='')
{
+ $column_def = null;
$tabname = $this->TableName ($tabname);
if ($flds) {
- list($lines,$pkey,$idxs) = $this->_GenFields($flds);
+ [$lines, $pkey, $idxs] = $this->_GenFields($flds);
// genfields can return FALSE at times
if ($lines == null) $lines = array();
$first = current($lines);
- list(,$column_def) = explode(' ',$first,2);
+ [, $column_def] = explode(' ',$first,2);
}
return array(sprintf($this->renameColumn,$tabname,$this->NameQuote($oldcolumn),$this->NameQuote($newcolumn),$column_def));
}
-
+
/**
* Drop one column
*
@@ -546,30 +547,30 @@ function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
}
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);
+ [$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
@@ -579,7 +580,7 @@ function CreateTableSQL($tabname, $flds, $tableoptions=array())
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']);
@@ -589,7 +590,7 @@ function CreateTableSQL($tabname, $flds, $tableoptions=array())
return $sql;
}
-
+
function _GenFields($flds,$widespacing=false)
{
if (is_string($flds)) {
@@ -618,7 +619,7 @@ function _GenFields($flds,$widespacing=false)
}
// '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];
+ $f1['INDEX'] = $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))) {
@@ -631,7 +632,7 @@ function _GenFields($flds,$widespacing=false)
$hasparam = false;
$flds[] = $f1;
-
+
}
}
$this->autoIncrement = false;
@@ -640,7 +641,7 @@ function _GenFields($flds,$widespacing=false)
$idxs = array();
foreach($flds as $fld) {
$fld = _array_change_key_case($fld);
-
+
$fname = false;
$fdefault = false;
$fautoinc = false;
@@ -656,19 +657,19 @@ function _GenFields($flds,$widespacing=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;
@@ -695,33 +696,33 @@ function _GenFields($flds,$widespacing=false)
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') $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') $fdefault = false;
-
+
// build list of indexes
if ($findex != '') {
if (array_key_exists($findex, $idxs)) {
@@ -780,20 +781,20 @@ function _GenFields($flds,$widespacing=false)
}
}
$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);
}
@@ -811,8 +812,8 @@ function _GetSize($ftype, $ty, $fsize, $fprec)
}
return $ftype;
}
-
-
+
+
// return string must begin with space
function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
{
@@ -822,45 +823,45 @@ function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint
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) {
@@ -879,17 +880,17 @@ function _TableSQL($tabname,$lines,$pkey,$tableoptions)
}
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
@@ -898,7 +899,7 @@ function _Triggers($tabname,$taboptions)
{
return array();
}
-
+
/**
Sanitize options, so that array elements with no keys are promoted to keys
*/
@@ -912,34 +913,34 @@ function _Options($opts)
}
return $newopts;
}
-
+
/**
"Florian Buzin [ easywe ]"
-
+
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.
@@ -954,7 +955,7 @@ function ChangeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds=f
$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);
@@ -969,10 +970,10 @@ function ChangeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds=f
}
$flds = $holdflds;
}
-
+
// already exists, alter table instead
- list($lines,$pkey,$idxs) = $this->_GenFields($flds);
+ [$lines, $pkey, $idxs] = $this->_GenFields($flds);
// genfields can return FALSE at times
if ($lines == null) $lines = array();
$alter = 'ALTER TABLE ' . $this->TableName($tablename);
@@ -980,9 +981,9 @@ function ChangeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds=f
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)
@@ -996,7 +997,7 @@ function ChangeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds=f
$sql[] = $alter . $this->addCol . ' ' . $v;
}
}
-
+
if ($dropOldFlds) {
foreach ( $cols as $id => $v )
if ( !isset($lines[$id]) )
diff --git a/src/adodb5/adodb-error.inc.php b/src/adodb5/adodb-error.inc.php
index db44dff2..6ef54375 100644
--- a/src/adodb5/adodb-error.inc.php
+++ b/src/adodb5/adodb-error.inc.php
@@ -52,7 +52,7 @@ function adodb_errormsg($value)
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];
+ return $ADODB_LANG_ARRAY[$value] ?? $ADODB_LANG_ARRAY[DB_ERROR];
}
function adodb_error($provider,$dbType,$errno)
diff --git a/src/adodb5/adodb-errorpear.inc.php b/src/adodb5/adodb-errorpear.inc.php
index d1e2eb98..078fe985 100644
--- a/src/adodb5/adodb-errorpear.inc.php
+++ b/src/adodb5/adodb-errorpear.inc.php
@@ -42,35 +42,35 @@
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 "!$s
";
}
@@ -85,4 +85,4 @@ function ADODB_PEAR_Error()
return $ADODB_Last_PEAR_Error;
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/adodb-iterator.inc.php b/src/adodb5/adodb-iterator.inc.php
index 55d66a35..532020c2 100644
--- a/src/adodb5/adodb-iterator.inc.php
+++ b/src/adodb5/adodb-iterator.inc.php
@@ -5,26 +5,26 @@
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 "
";
}
-
-
+
+
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.
*/
-
-?>
\ No newline at end of file
+
+?>
diff --git a/src/adodb5/adodb-lib.inc.php b/src/adodb5/adodb-lib.inc.php
index 0f82ba3a..290eb631 100644
--- a/src/adodb5/adodb-lib.inc.php
+++ b/src/adodb5/adodb-lib.inc.php
@@ -15,7 +15,7 @@
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.
*/
@@ -24,7 +24,7 @@ function adodb_strip_order_by($sql)
$rez = preg_match('/(\sORDER\s+BY\s[^)]*)/is',$sql,$arr);
if ($arr)
if (strpos($arr[0],'(') !== false) {
- $at = strpos($sql,$arr[0]);
+ $at = strpos($sql,(string) $arr[0]);
$cntin = 0;
for ($i=$at, $max=strlen($sql); $i < $max; $i++) {
$ch = $sql[$i];
@@ -55,8 +55,8 @@ function adodb_probetypes(&$array,&$types,$probe=8)
$types = array();
if ($probe > sizeof($array)) $max = sizeof($array);
else $max = $probe;
-
-
+
+
for ($j=0;$j < $max; $j++) {
$row = $array[$j];
if (!$row) break;
@@ -65,13 +65,13 @@ function adodb_probetypes(&$array,&$types,$probe=8)
$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) {
@@ -84,19 +84,19 @@ function adodb_probetypes(&$array,&$types,$probe=8)
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');
@@ -112,7 +112,7 @@ function adodb_transpose(&$arr, &$newarr, &$hdr, &$fobjs)
$newarr[] = array($o->name);
} else
$newarr[] = array();
-
+
for ($y = 0; $y < $oldY; $y++) {
$newarr[$x-$startx][] = $arr[$y][$x];
}
@@ -136,10 +136,12 @@ function _array_change_key_case($an_array)
function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_autoinc)
{
- if (count($fieldArray) == 0) return 0;
+ $iCols = null;
+ $iVals = null;
+ if ((is_countable($fieldArray) ? count($fieldArray) : 0) == 0) return 0;
$first = true;
$uSet = '';
-
+
if (!is_array($keyCol)) {
$keyCol = array($keyCol);
}
@@ -152,14 +154,14 @@ function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_
$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])) {
@@ -167,13 +169,13 @@ function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_
else $where = $v.'='.$fieldArray[$v];
}
}
-
+
if ($uSet && $where) {
$update = "UPDATE $table SET $uSet WHERE $where";
$rs = $zthis->Execute($update);
-
-
+
+
if ($rs) {
if ($zthis->poorAffectedRows) {
/*
@@ -181,10 +183,10 @@ function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_
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 {
@@ -193,12 +195,12 @@ function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_
} else
return 0;
}
-
+
// print "Error=".$this->ErrorNo().'
';
$first = true;
foreach($fieldArray as $k => $v) {
if ($has_autoinc && in_array($k,$keyCol)) continue; // skip autoinc col
-
+
if ($first) {
$first = false;
$iCols = "$k";
@@ -217,6 +219,7 @@ function _adodb_replace(&$zthis, $table, $fieldArray, $keyCol, $autoQuote, $has_
function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=false,
$size=0, $selectAttr='',$compareFields0=true)
{
+ $zval2 = null;
$hasvalue = false;
if ($multiple or is_array($defstr)) {
@@ -225,7 +228,7 @@ function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=f
if (!strpos($name,'[]')) $name .= '[]';
} else if ($size) $attr = ' size="'.$size.'"';
else $attr ='';
-
+
$s = '
";
flush();
@@ -988,16 +991,16 @@ function DoSQLForm()
}
} // foreach
}
-
+
function SplitSQL($sql)
{
$arr = explode(';',$sql);
return $arr;
}
-
+
/************************************************************************/
-
+
/**
* Reorganise multiple table-indices/statistics/..
* OptimizeMode could be given by last Parameter
@@ -1025,16 +1028,16 @@ function OptimizeTables()
{
$args = func_get_args();
$numArgs = func_num_args();
-
+
if ( $numArgs == 0) return false;
-
+
$mode = ADODB_OPT_LOW;
$lastArg = $args[ $numArgs - 1];
if ( !is_string($lastArg)) {
$mode = $lastArg;
unset( $args[ $numArgs - 1]);
}
-
+
foreach( $args as $table) {
$this->optimizeTable( $table, $mode);
}
@@ -1054,10 +1057,10 @@ function OptimizeTables()
*/
function OptimizeTable( $table, $mode = ADODB_OPT_LOW)
{
- ADOConnection::outp( sprintf( "%s: '%s' not implemented for driver '%s'
", __CLASS__, __FUNCTION__, $this->conn->databaseType));
+ ADOConnection::outp( sprintf( "%s: '%s' not implemented for driver '%s'
", self::class, __FUNCTION__, $this->conn->databaseType));
return false;
}
-
+
/**
* Reorganise current database.
* Default implementation loops over all MetaTables()
and
@@ -1070,7 +1073,7 @@ function optimizeDatabase()
{
$conn = $this->conn;
if ( !$conn) return false;
-
+
$tables = $conn->MetaTables( 'TABLES');
if ( !$tables ) return false;
@@ -1079,7 +1082,7 @@ function optimizeDatabase()
return false;
}
}
-
+
return true;
}
// end hack
diff --git a/src/adodb5/adodb-php4.inc.php b/src/adodb5/adodb-php4.inc.php
deleted file mode 100644
index 788d9ec3..00000000
--- a/src/adodb5/adodb-php4.inc.php
+++ /dev/null
@@ -1,16 +0,0 @@
-
\ No newline at end of file
diff --git a/src/adodb5/adodb-time.inc.php b/src/adodb5/adodb-time.inc.php
index dbf83c41..af059a2d 100644
--- a/src/adodb5/adodb-time.inc.php
+++ b/src/adodb5/adodb-time.inc.php
@@ -407,7 +407,7 @@ function adodb_daylight_sv(&$arr, $is_gmt)
function adodb_date_test_date($y1,$m,$d=13)
{
- $h = round(rand()% 24);
+ $h = round(random_int(0, mt_getrandmax())% 24);
$t = adodb_mktime($h,0,0,$m,$d,$y1);
$rez = adodb_date('Y-n-j H:i:s',$t);
if ($h == 0) $h = '00';
@@ -525,7 +525,7 @@ function adodb_date_test()
flush();
for ($i=100; --$i > 0; ) {
- $ts = 3600.0*((rand()%60000)+(rand()%60000))+(rand()%60000);
+ $ts = 3600.0*((random_int(0, mt_getrandmax())%60000)+(random_int(0, mt_getrandmax())%60000))+(random_int(0, mt_getrandmax())%60000);
$s1 = date($fmt,$ts);
$s2 = adodb_date($fmt,$ts);
//print "$s1
$s2 ";
@@ -561,18 +561,18 @@ function adodb_date_test()
print "
Testing random dates between 100 and 4000
";
adodb_date_test_date(100,1);
for ($i=100; --$i >= 0;) {
- $y1 = 100+rand(0,1970-100);
- $m = rand(1,12);
+ $y1 = 100+random_int(0,1970-100);
+ $m = random_int(1,12);
adodb_date_test_date($y1,$m);
- $y1 = 3000-rand(0,3000-1970);
+ $y1 = 3000-random_int(0,3000-1970);
adodb_date_test_date($y1,$m);
}
print '';
- $start = 1960+rand(0,10);
+ $start = 1960+random_int(0,10);
$yrs = 12;
$i = 365.25*86400*($start-1970);
- $offset = 36000+rand(10000,60000);
+ $offset = 36000+random_int(10000,60000);
$max = 365*$yrs*86400;
$lastyear = 0;
@@ -799,6 +799,11 @@ function adodb_validdate($y,$m,$d)
*/
function _adodb_getdate($origd=false,$fast=false,$is_gmt=false)
{
+$leaf = null;
+$lastd = null;
+$ndays = null;
+$year = null;
+$month = null;
static $YRS;
global $_month_table_normal,$_month_table_leaf;
@@ -807,7 +812,7 @@ function _adodb_getdate($origd=false,$fast=false,$is_gmt=false)
$_hour_power = 3600;
$_min_power = 60;
- if ($d < -12219321600) $d -= 86400*10; // if 15 Oct 1582 or earlier, gregorian correction
+ if ($d < -12_219_321_600) $d -= 86400*10; // if 15 Oct 1582 or earlier, gregorian correction
$_month_table_normal = array("",31,28,31,30,31,30,31,31,30,31,30,31);
$_month_table_leaf = array("",31,29,31,30,31,30,31,31,30,31,30,31);
@@ -819,43 +824,43 @@ function _adodb_getdate($origd=false,$fast=false,$is_gmt=false)
if (empty($YRS)) $YRS = array(
1970 => 0,
- 1960 => -315619200,
- 1950 => -631152000,
- 1940 => -946771200,
- 1930 => -1262304000,
- 1920 => -1577923200,
- 1910 => -1893456000,
- 1900 => -2208988800,
- 1890 => -2524521600,
- 1880 => -2840140800,
- 1870 => -3155673600,
- 1860 => -3471292800,
- 1850 => -3786825600,
- 1840 => -4102444800,
- 1830 => -4417977600,
- 1820 => -4733596800,
- 1810 => -5049129600,
- 1800 => -5364662400,
- 1790 => -5680195200,
- 1780 => -5995814400,
- 1770 => -6311347200,
- 1760 => -6626966400,
- 1750 => -6942499200,
- 1740 => -7258118400,
- 1730 => -7573651200,
- 1720 => -7889270400,
- 1710 => -8204803200,
- 1700 => -8520336000,
- 1690 => -8835868800,
- 1680 => -9151488000,
- 1670 => -9467020800,
- 1660 => -9782640000,
- 1650 => -10098172800,
- 1640 => -10413792000,
- 1630 => -10729324800,
- 1620 => -11044944000,
- 1610 => -11360476800,
- 1600 => -11676096000);
+ 1960 => -315_619_200,
+ 1950 => -631_152_000,
+ 1940 => -946_771_200,
+ 1930 => -1_262_304_000,
+ 1920 => -1_577_923_200,
+ 1910 => -1_893_456_000,
+ 1900 => -2_208_988_800,
+ 1890 => -2_524_521_600,
+ 1880 => -2_840_140_800,
+ 1870 => -3_155_673_600,
+ 1860 => -3_471_292_800,
+ 1850 => -3_786_825_600,
+ 1840 => -4_102_444_800,
+ 1830 => -4_417_977_600,
+ 1820 => -4_733_596_800,
+ 1810 => -5_049_129_600,
+ 1800 => -5_364_662_400,
+ 1790 => -5_680_195_200,
+ 1780 => -5_995_814_400,
+ 1770 => -6_311_347_200,
+ 1760 => -6_626_966_400,
+ 1750 => -6_942_499_200,
+ 1740 => -7_258_118_400,
+ 1730 => -7_573_651_200,
+ 1720 => -7_889_270_400,
+ 1710 => -8_204_803_200,
+ 1700 => -8_520_336_000,
+ 1690 => -8_835_868_800,
+ 1680 => -9_151_488_000,
+ 1670 => -9_467_020_800,
+ 1660 => -9_782_640_000,
+ 1650 => -10_098_172_800,
+ 1640 => -10_413_792_000,
+ 1630 => -10_729_324_800,
+ 1620 => -11_044_944_000,
+ 1610 => -11_360_476_800,
+ 1600 => -11_676_096_000);
if ($is_gmt) $origd = $d;
// The valid range of a 32bit signed timestamp is typically from
@@ -1206,6 +1211,7 @@ function adodb_gmmktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=
*/
function adodb_mktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=false,$is_gmt=false)
{
+ $loop_table = [];
if (!defined('ADODB_TEST_DATES')) {
if ($mon === false) {
@@ -1301,12 +1307,12 @@ function adodb_mktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=fa
}
}
$_total_date += $loop_table[$mon] - $day;
-
+
$_day_time = $hr * $_hour_power + $min * $_min_power + $sec;
$_day_time = $_day_power - $_day_time;
$ret = -( $_total_date * $_day_power + $_day_time - $gmt_different);
- if ($ret < -12220185600) $ret += 10*86400; // if earlier than 5 Oct 1582 - gregorian correction
- else if ($ret < -12219321600) $ret = -12219321600; // if in limbo, reset to 15 Oct 1582.
+ if ($ret < -12_220_185_600) $ret += 10*86400; // if earlier than 5 Oct 1582 - gregorian correction
+ else if ($ret < -12_219_321_600) $ret = -12_219_321_600; // if in limbo, reset to 15 Oct 1582.
}
//print " dmy=$day/$mon/$year $hr:$min:$sec => " .$ret;
return $ret;
@@ -1337,9 +1343,9 @@ function adodb_strftime($fmt, $ts=false,$is_gmt=false)
$hasAM = strrpos($tstr,'M') !== false;
*/
# see http://phplens.com/lens/lensforum/msgs.php?id=14865 for reasoning, and changelog for version 0.24
- $dstr = gmstrftime('%x',31366800); // 30 Dec 1970, 1 am
+ $dstr = gmstrftime('%x',31_366_800); // 30 Dec 1970, 1 am
$sep = substr($dstr,2,1);
- $tstr = strtoupper(gmstrftime('%X',31366800)); // 30 Dec 1970, 1 am
+ $tstr = strtoupper(gmstrftime('%X',31_366_800)); // 30 Dec 1970, 1 am
$hasAM = strrpos($tstr,'M') !== false;
$ADODB_DATE_LOCALE = array();
@@ -1423,4 +1429,4 @@ function adodb_strftime($fmt, $ts=false,$is_gmt=false)
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/adodb-xmlschema.inc.php b/src/adodb5/adodb-xmlschema.inc.php
index 50c2fa0e..096bcbc4 100644
--- a/src/adodb5/adodb-xmlschema.inc.php
+++ b/src/adodb5/adodb-xmlschema.inc.php
@@ -280,8 +280,8 @@ function _tag_open( &$parser, $tag, $attributes ) {
// Add a field
$fieldName = $attributes['NAME'];
$fieldType = $attributes['TYPE'];
- $fieldSize = isset( $attributes['SIZE'] ) ? $attributes['SIZE'] : NULL;
- $fieldOpts = isset( $attributes['OPTS'] ) ? $attributes['OPTS'] : NULL;
+ $fieldSize = $attributes['SIZE'] ?? NULL;
+ $fieldOpts = $attributes['OPTS'] ?? NULL;
$this->addField( $fieldName, $fieldType, $fieldSize, $fieldOpts );
break;
@@ -496,10 +496,10 @@ function create( &$xmls ) {
// drop table
if( $this->drop_table ) {
$sql[] = $xmls->dict->DropTableSQL( $this->name );
-
+
return $sql;
}
-
+
// drop any existing fields not in schema
foreach( $legacy_fields as $field_id => $field ) {
if( !isset( $this->fields[$field_id] ) ) {
@@ -856,7 +856,7 @@ function addField( $attributes ) {
if( isset( $attributes['NAME'] ) ) {
$name = $attributes['NAME'];
} else {
- $name = count($this->data[$this->row]);
+ $name = is_countable($this->data[$this->row]) ? count($this->data[$this->row]) : 0;
}
// Set the field index so we know where we are
@@ -889,7 +889,7 @@ function addData( $cdata ) {
*/
function create( &$xmls ) {
$table = $xmls->dict->TableName($this->parent->name);
- $table_field_count = count($this->parent->fields);
+ $table_field_count = is_countable($this->parent->fields) ? count($this->parent->fields) : 0;
$sql = array();
// eliminate any columns that aren't in the table
@@ -900,7 +900,8 @@ function create( &$xmls ) {
foreach( $row as $field_id => $field_data ) {
if( !array_key_exists( $field_id, $table_fields ) ) {
if( is_numeric( $field_id ) ) {
- $field_id = reset( array_keys( $table_fields ) );
+ $arrayKeys = array_keys( $table_fields );
+ $field_id = reset( $arrayKeys );
} else {
continue;
}
@@ -1774,7 +1775,7 @@ function TransformSchema( $schema, $xsl, $schematype='string' )
return FALSE;
}
- $xsl_file = dirname( __FILE__ ) . '/xsl/' . $xsl . '.xsl';
+ $xsl_file = __DIR__ . '/xsl/' . $xsl . '.xsl';
// look for xsl
if( !is_readable( $xsl_file ) ) {
@@ -2191,7 +2192,7 @@ function logMsg( $msg, $title = NULL, $force = FALSE ) {
echo '
' . htmlentities( $title ) . '
';
}
- $calling_class = get_called_class();
+ $calling_class = static::class;
$obj = new $calling_class();
if( is_object($obj) ) {
echo '[' . get_class($obj) . '] ';
@@ -2202,4 +2203,3 @@ function logMsg( $msg, $title = NULL, $force = FALSE ) {
echo '';
}
}
-?>
diff --git a/src/adodb5/adodb-xmlschema03.inc.php b/src/adodb5/adodb-xmlschema03.inc.php
index 559954f3..486a264c 100644
--- a/src/adodb5/adodb-xmlschema03.inc.php
+++ b/src/adodb5/adodb-xmlschema03.inc.php
@@ -305,7 +305,7 @@ function _tag_open( &$parser, $tag, $attributes ) {
// Add a field
$fieldName = $attributes['NAME'];
$fieldType = $attributes['TYPE'];
- $fieldSize = isset( $attributes['SIZE'] ) ? $attributes['SIZE'] : NULL;
+ $fieldSize = $attributes['SIZE'] ?? NULL;
$fieldOpts = !empty( $attributes['OPTS'] ) ? $attributes['OPTS'] : NULL;
$this->addField( $fieldName, $fieldType, $fieldSize, $fieldOpts );
@@ -537,10 +537,10 @@ function create( &$xmls ) {
// drop table
if( $this->drop_table ) {
$sql[] = $xmls->dict->DropTableSQL( $this->name );
-
+
return $sql;
}
-
+
// drop any existing fields not in schema
foreach( $legacy_fields as $field_id => $field ) {
if( !isset( $this->fields[$field_id] ) ) {
@@ -904,7 +904,7 @@ function addField( $attributes ) {
if( isset( $attributes['NAME'] ) ) {
$this->current_field = $this->FieldID( $attributes['NAME'] );
} else {
- $this->current_field = count( $this->data[$this->row] );
+ $this->current_field = is_countable($this->data[$this->row]) ? count( $this->data[$this->row] ) : 0;
}
// initialise data
@@ -935,7 +935,7 @@ function addData( $cdata ) {
*/
function create( &$xmls ) {
$table = $xmls->dict->TableName($this->parent->name);
- $table_field_count = count($this->parent->fields);
+ $table_field_count = is_countable($this->parent->fields) ? count($this->parent->fields) : 0;
$tables = $xmls->db->MetaTables();
$sql = array();
@@ -955,7 +955,8 @@ function create( &$xmls ) {
foreach( $row as $field_id => $field_data ) {
if( !array_key_exists( $field_id, $table_fields ) ) {
if( is_numeric( $field_id ) ) {
- $field_id = reset( array_keys( $table_fields ) );
+ $arrayKeys = array_keys( $table_fields );
+ $field_id = reset( $arrayKeys );
} else {
continue;
}
@@ -1934,7 +1935,7 @@ function TransformSchema( $schema, $xsl, $schematype='string' )
return FALSE;
}
- $xsl_file = dirname( __FILE__ ) . '/xsl/' . $xsl . '.xsl';
+ $xsl_file = __DIR__ . '/xsl/' . $xsl . '.xsl';
// look for xsl
if( !is_readable( $xsl_file ) ) {
@@ -2372,7 +2373,7 @@ function logMsg( $msg, $title = NULL, $force = FALSE ) {
echo '' . htmlentities( $title ) . '
';
}
- $calling_class = get_called_class();
+ $calling_class = static::class;
$obj = new $calling_class();
if( @is_object($obj) ) {
echo '[' . get_class($obj) . '] ';
diff --git a/src/adodb5/adodb.inc.php b/src/adodb5/adodb.inc.php
index ec66fb5a..8fed3705 100644
--- a/src/adodb5/adodb.inc.php
+++ b/src/adodb5/adodb.inc.php
@@ -44,7 +44,7 @@ class library to hide the differences between the different database API's (enca
* Set ADODB_DIR to the directory where this file resides...
* This constant was formerly called $ADODB_RootPath
*/
- if (!defined('ADODB_DIR')) define('ADODB_DIR',dirname(__FILE__));
+ if (!defined('ADODB_DIR')) define('ADODB_DIR',__DIR__);
//==============================================================================================
// GLOBAL VARIABLES
@@ -172,7 +172,7 @@ function ADODB_Setup()
// Initialize random number generator for randomizing cache flushes
// -- note Since PHP 4.2.0, the seed becomes optional and defaults to a random value if omitted.
- srand(((double)microtime())*1000000);
+ mt_srand(((double)microtime())*1_000_000);
/**
* ADODB version as a string.
@@ -256,6 +256,7 @@ function &readcache($filename, &$err, $secs2cache, $rsClass)
// flush all items in cache
function flushall($debug=false)
{
+ $dir = null;
global $ADODB_CACHE_DIR;
$rez = false;
@@ -492,7 +493,7 @@ static function outp($msg,$newline=true)
function Time()
{
$rs = $this->_Execute("select $this->sysTimeStamp");
- if ($rs && !$rs->EOF) return $this->UnixTimeStamp(reset($rs->fields));
+ if ($rs && !$rs->EOF) return static::UnixTimeStamp(reset($rs->fields));
return false;
}
@@ -674,7 +675,7 @@ function Prepare($sql)
*/
function PrepareSP($sql,$param=true)
{
- return $this->Prepare($sql,$param);
+ return $this->Prepare($sql);
}
/**
@@ -1376,7 +1377,7 @@ function &_rs2rs(&$rs,$nrows=-1,$offset=-1,$close=true)
$rs2->sql = $rs->sql;
$rs2->dataProvider = $this->dataProvider;
$rs2->InitArrayFields($arr,$flds);
- $rs2->fetchMode = isset($rs->adodbFetchMode) ? $rs->adodbFetchMode : $rs->fetchMode;
+ $rs2->fetchMode = $rs->adodbFetchMode ?? $rs->fetchMode;
return $rs2;
}
@@ -1595,7 +1596,7 @@ function GetRandRow($sql, $arr= false)
{
$rezarr = $this->GetAll($sql, $arr);
$sz = sizeof($rezarr);
- return $rezarr[abs(rand()) % $sz];
+ return $rezarr[abs(random_int(0, mt_getrandmax())) % $sz];
}
/**
@@ -2557,7 +2558,7 @@ static function UnixTimeStamp($v)
function UserDate($v,$fmt='Y-m-d',$gmt=false)
{
- $tt = $this->UnixDate($v);
+ $tt = static::UnixDate($v);
// $tt == -1 if pre TIMESTAMP_FIRST_YEAR
if (($tt === false || $tt == -1) && $v != false) return $v;
@@ -2581,7 +2582,7 @@ function UserTimeStamp($v,$fmt='Y-m-d H:i:s',$gmt=false)
if (!isset($v)) return $this->emptyTimeStamp;
# strlen(14) allows YYYYMMDDHHMMSS format
if (is_numeric($v) && strlen($v)<14) return ($gmt) ? adodb_gmdate($fmt,$v) : adodb_date($fmt,$v);
- $tt = $this->UnixTimeStamp($v);
+ $tt = static::UnixTimeStamp($v);
// $tt == -1 if pre TIMESTAMP_FIRST_YEAR
if (($tt === false || $tt == -1) && $v != false) return $v;
if ($tt == 0) return $this->emptyTimeStamp;
@@ -3198,7 +3199,7 @@ function GetAssoc($force_array = false, $first2cols = false)
function UserTimeStamp($v,$fmt='Y-m-d H:i:s')
{
if (is_numeric($v) && strlen($v)<14) return adodb_date($fmt,$v);
- $tt = $this->UnixTimeStamp($v);
+ $tt = static::UnixTimeStamp($v);
// $tt == -1 if pre TIMESTAMP_FIRST_YEAR
if (($tt === false || $tt == -1) && $v != false) return $v;
if ($tt === 0) return $this->emptyTimeStamp;
@@ -3214,7 +3215,7 @@ function UserTimeStamp($v,$fmt='Y-m-d H:i:s')
*/
function UserDate($v,$fmt='Y-m-d')
{
- $tt = $this->UnixDate($v);
+ $tt = static::UnixDate($v);
// $tt == -1 if pre TIMESTAMP_FIRST_YEAR
if (($tt === false || $tt == -1) && $v != false) return $v;
else if ($tt == 0) return $this->emptyDate;
@@ -3490,7 +3491,7 @@ function RecordCount() {return $this->_numOfRows;}
*/
function MaxRecordCount()
{
- return ($this->_maxRecordCount) ? $this->_maxRecordCount : $this->RecordCount();
+ return $this->_maxRecordCount ?: $this->RecordCount();
}
/**
@@ -3791,7 +3792,7 @@ function MetaType($t,$len=-1,$fieldobj=false)
$tmap = false;
$t = strtoupper($t);
- $tmap = (isset($typeMap[$t])) ? $typeMap[$t] : 'N';
+ $tmap = $typeMap[$t] ?? 'N';
switch ($tmap) {
case 'C':
@@ -4003,7 +4004,7 @@ function _initrs()
/* Use associative array to get fields array */
function Fields($colname)
{
- $mode = isset($this->adodbFetchMode) ? $this->adodbFetchMode : $this->fetchMode;
+ $mode = $this->adodbFetchMode ?? $this->fetchMode;
if ($mode & ADODB_FETCH_ASSOC) {
if (!isset($this->fields[$colname]) && !is_null($this->fields[$colname])) $colname = strtolower($colname);
@@ -4150,6 +4151,9 @@ function NewADOConnection($db='')
*/
function ADONewConnection($db='')
{
+ $obj = null;
+ $persist = null;
+ $nconnect = null;
GLOBAL $ADODB_NEWCONNECTION, $ADODB_LASTDB;
if (!defined('ADODB_ASSOC_CASE')) define('ADODB_ASSOC_CASE',2);
@@ -4314,7 +4318,7 @@ function _adodb_getdriver($provider,$drivername,$perf=false)
switch($drivername) {
case 'mysqlt':
- case 'mysqli':
+ case \mysqli::class:
$drivername='mysql';
break;
case 'postgres7':
diff --git a/src/adodb5/contrib/toxmlrpc.inc.php b/src/adodb5/contrib/toxmlrpc.inc.php
deleted file mode 100644
index 030d60af..00000000
--- a/src/adodb5/contrib/toxmlrpc.inc.php
+++ /dev/null
@@ -1,183 +0,0 @@
-GetArray()) would work with:
- * - ADODB_FETCH_BOTH
- * - null values
- */
-
- /**
- * Include the main libraries
- */
- require_once('xmlrpc.inc');
- if (!defined('ADODB_DIR')) require_once('adodb.inc.php');
-
- /**
- * Builds an xmlrpc struct value out of an AdoDB recordset
- */
- function rs2xmlrpcval(&$adodbrs) {
-
- $header = rs2xmlrpcval_header($adodbrs);
- $body = rs2xmlrpcval_body($adodbrs);
-
- // put it all together and build final xmlrpc struct
- $xmlrpcrs = new xmlrpcval ( array(
- "header" => $header,
- "body" => $body,
- ), "struct");
-
- return $xmlrpcrs;
-
- }
-
- /**
- * Builds an xmlrpc struct value describing an AdoDB recordset
- */
- function rs2xmlrpcval_header($adodbrs)
- {
- $numfields = $adodbrs->FieldCount();
- $numrecords = $adodbrs->RecordCount();
-
- // build structure holding recordset information
- $fieldstruct = array();
- for ($i = 0; $i < $numfields; $i++) {
- $fld = $adodbrs->FetchField($i);
- $fieldarray = array();
- if (isset($fld->name))
- $fieldarray["name"] = new xmlrpcval ($fld->name);
- if (isset($fld->type))
- $fieldarray["type"] = new xmlrpcval ($fld->type);
- if (isset($fld->max_length))
- $fieldarray["max_length"] = new xmlrpcval ($fld->max_length, "int");
- if (isset($fld->not_null))
- $fieldarray["not_null"] = new xmlrpcval ($fld->not_null, "boolean");
- if (isset($fld->has_default))
- $fieldarray["has_default"] = new xmlrpcval ($fld->has_default, "boolean");
- if (isset($fld->default_value))
- $fieldarray["default_value"] = new xmlrpcval ($fld->default_value);
- $fieldstruct[$i] = new xmlrpcval ($fieldarray, "struct");
- }
- $fieldcount = new xmlrpcval ($numfields, "int");
- $recordcount = new xmlrpcval ($numrecords, "int");
- $sql = new xmlrpcval ($adodbrs->sql);
- $fieldinfo = new xmlrpcval ($fieldstruct, "array");
-
- $header = new xmlrpcval ( array(
- "fieldcount" => $fieldcount,
- "recordcount" => $recordcount,
- "sql" => $sql,
- "fieldinfo" => $fieldinfo
- ), "struct");
-
- return $header;
- }
-
- /**
- * Builds an xmlrpc struct value out of an AdoDB recordset
- * (data values only, no data definition)
- */
- function rs2xmlrpcval_body($adodbrs)
- {
- $numfields = $adodbrs->FieldCount();
-
- // build structure containing recordset data
- $adodbrs->MoveFirst();
- $rows = array();
- while (!$adodbrs->EOF) {
- $columns = array();
- // This should work on all cases of fetch mode: assoc, num, both or default
- if ($adodbrs->fetchMode == 'ADODB_FETCH_BOTH' || count($adodbrs->fields) == 2 * $adodbrs->FieldCount())
- for ($i = 0; $i < $numfields; $i++)
- if ($adodbrs->fields[$i] === null)
- $columns[$i] = new xmlrpcval ('');
- else
- $columns[$i] = xmlrpc_encode ($adodbrs->fields[$i]);
- else
- foreach ($adodbrs->fields as $val)
- if ($val === null)
- $columns[] = new xmlrpcval ('');
- else
- $columns[] = xmlrpc_encode ($val);
-
- $rows[] = new xmlrpcval ($columns, "array");
-
- $adodbrs->MoveNext();
- }
- $body = new xmlrpcval ($rows, "array");
-
- return $body;
- }
-
- /**
- * Returns an xmlrpc struct value as string out of an AdoDB recordset
- */
- function rs2xmlrpcstring (&$adodbrs) {
- $xmlrpc = rs2xmlrpcval ($adodbrs);
- if ($xmlrpc)
- return $xmlrpc->serialize();
- else
- return null;
- }
-
- /**
- * Given a well-formed xmlrpc struct object returns an AdoDB object
- *
- * @todo add some error checking on the input value
- */
- function xmlrpcval2rs (&$xmlrpcval) {
-
- $fields_array = array();
- $data_array = array();
-
- // rebuild column information
- $header = $xmlrpcval->structmem('header');
-
- $numfields = $header->structmem('fieldcount');
- $numfields = $numfields->scalarval();
- $numrecords = $header->structmem('recordcount');
- $numrecords = $numrecords->scalarval();
- $sqlstring = $header->structmem('sql');
- $sqlstring = $sqlstring->scalarval();
-
- $fieldinfo = $header->structmem('fieldinfo');
- for ($i = 0; $i < $numfields; $i++) {
- $temp = $fieldinfo->arraymem($i);
- $fld = new ADOFieldObject();
- while (list($key,$value) = $temp->structeach()) {
- if ($key == "name") $fld->name = $value->scalarval();
- if ($key == "type") $fld->type = $value->scalarval();
- if ($key == "max_length") $fld->max_length = $value->scalarval();
- if ($key == "not_null") $fld->not_null = $value->scalarval();
- if ($key == "has_default") $fld->has_default = $value->scalarval();
- if ($key == "default_value") $fld->default_value = $value->scalarval();
- } // while
- $fields_array[] = $fld;
- } // for
-
- // fetch recordset information into php array
- $body = $xmlrpcval->structmem('body');
- for ($i = 0; $i < $numrecords; $i++) {
- $data_array[$i]= array();
- $xmlrpcrs_row = $body->arraymem($i);
- for ($j = 0; $j < $numfields; $j++) {
- $temp = $xmlrpcrs_row->arraymem($j);
- $data_array[$i][$j] = $temp->scalarval();
- } // for j
- } // for i
-
- // finally build in-memory recordset object and return it
- $rs = new ADORecordSet_array();
- $rs->InitArrayFields($data_array,$fields_array);
- return $rs;
-
- }
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/datadict/datadict-access.inc.php b/src/adodb5/datadict/datadict-access.inc.php
deleted file mode 100644
index 906c8a74..00000000
--- a/src/adodb5/datadict/datadict-access.inc.php
+++ /dev/null
@@ -1,96 +0,0 @@
-debug) ADOConnection::outp("Warning: Access does not supported DEFAULT values (field $fname)");
- }
- if ($fnotnull) $suffix .= ' NOT NULL';
- if ($fconstraint) $suffix .= ' '.$fconstraint;
- return $suffix;
- }
-
- function CreateDatabase($dbname,$options=false)
- {
- return array();
- }
-
-
- function SetSchema($schema)
- {
- }
-
- function AlterColumnSQL($tabname, $flds)
- {
- if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported");
- return array();
- }
-
-
- function DropColumnSQL($tabname, $flds)
- {
- if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
- return array();
- }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/datadict/datadict-db2.inc.php b/src/adodb5/datadict/datadict-db2.inc.php
deleted file mode 100644
index 5f02f23e..00000000
--- a/src/adodb5/datadict/datadict-db2.inc.php
+++ /dev/null
@@ -1,144 +0,0 @@
-debug) ADOConnection::outp("AlterColumnSQL not supported");
- return array();
- }
-
-
- function DropColumnSQL($tabname, $flds)
- {
- if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
- return array();
- }
-
-
- function ChangeTableSQL($tablename, $flds, $tableoptions = false)
- {
-
- /**
- Allow basic table changes to DB2 databases
- DB2 will fatally reject changes to non character columns
-
- */
-
- $validTypes = array("CHAR","VARC");
- $invalidTypes = array("BIGI","BLOB","CLOB","DATE", "DECI","DOUB", "INTE", "REAL","SMAL", "TIME");
- // check table exists
- $cols = $this->MetaColumns($tablename);
- if ( empty($cols)) {
- return $this->CreateTableSQL($tablename, $flds, $tableoptions);
- }
-
- // already exists, alter table instead
- list($lines,$pkey) = $this->_GenFields($flds);
- $alter = 'ALTER TABLE ' . $this->TableName($tablename);
- $sql = array();
-
- foreach ( $lines as $id => $v ) {
- if ( isset($cols[$id]) && is_object($cols[$id]) ) {
- /**
- If the first field of $v is the fieldname, and
- the second is the field type/size, we assume its an
- attempt to modify the column size, so check that it is allowed
- $v can have an indeterminate number of blanks between the
- fields, so account for that too
- */
- $vargs = explode(' ' , $v);
- // assume that $vargs[0] is the field name.
- $i=0;
- // Find the next non-blank value;
- for ($i=1;$ialterCol . ' ' . $v;
- } else {
- $sql[] = $alter . $this->addCol . ' ' . $v;
- }
- }
-
- return $sql;
- }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/datadict/datadict-firebird.inc.php b/src/adodb5/datadict/datadict-firebird.inc.php
deleted file mode 100644
index 5794c8b2..00000000
--- a/src/adodb5/datadict/datadict-firebird.inc.php
+++ /dev/null
@@ -1,152 +0,0 @@
-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
- if ( !preg_match('/^[' . $this->nameRegex . ']+$/', $name) ) {
- return $quote . $name . $quote;
- }
-
- return $quote . $name . $quote;
- }
-
- function CreateDatabase($dbname, $options=false)
- {
- $options = $this->_Options($options);
- $sql = array();
-
- $sql[] = "DECLARE EXTERNAL FUNCTION LOWER CSTRING(80) RETURNS CSTRING(80) FREE_IT ENTRY_POINT 'IB_UDF_lower' MODULE_NAME 'ib_udf'";
-
- return $sql;
- }
-
- function _DropAutoIncrement($t)
- {
- if (strpos($t,'.') !== false) {
- $tarr = explode('.',$t);
- return 'DROP GENERATOR '.$tarr[0].'."gen_'.$tarr[1].'"';
- }
- return 'DROP GENERATOR "GEN_'.$t;
- }
-
-
- function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
- {
- $suffix = '';
-
- if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
- if ($fnotnull) $suffix .= ' NOT NULL';
- if ($fautoinc) $this->seqField = $fname;
- if ($fconstraint) $suffix .= ' '.$fconstraint;
-
- return $suffix;
- }
-
-/*
-CREATE or replace TRIGGER jaddress_insert
-before insert on jaddress
-for each row
-begin
-IF ( NEW."seqField" IS NULL OR NEW."seqField" = 0 ) THEN
- NEW."seqField" = GEN_ID("GEN_tabname", 1);
-end;
-*/
- function _Triggers($tabname,$tableoptions)
- {
- if (!$this->seqField) return array();
-
- $tab1 = preg_replace( '/"/', '', $tabname );
- if ($this->schema) {
- $t = strpos($tab1,'.');
- if ($t !== false) $tab = substr($tab1,$t+1);
- else $tab = $tab1;
- $seqField = $this->seqField;
- $seqname = $this->schema.'.'.$this->seqPrefix.$tab;
- $trigname = $this->schema.'.trig_'.$this->seqPrefix.$tab;
- } else {
- $seqField = $this->seqField;
- $seqname = $this->seqPrefix.$tab1;
- $trigname = 'trig_'.$seqname;
- }
- if (isset($tableoptions['REPLACE']))
- { $sql[] = "DROP GENERATOR \"$seqname\"";
- $sql[] = "CREATE GENERATOR \"$seqname\"";
- $sql[] = "ALTER TRIGGER \"$trigname\" BEFORE INSERT OR UPDATE AS BEGIN IF ( NEW.$seqField IS NULL OR NEW.$seqField = 0 ) THEN NEW.$seqField = GEN_ID(\"$seqname\", 1); END";
- }
- else
- { $sql[] = "CREATE GENERATOR \"$seqname\"";
- $sql[] = "CREATE TRIGGER \"$trigname\" FOR $tabname BEFORE INSERT OR UPDATE AS BEGIN IF ( NEW.$seqField IS NULL OR NEW.$seqField = 0 ) THEN NEW.$seqField = GEN_ID(\"$seqname\", 1); END";
- }
-
- $this->seqField = false;
- return $sql;
- }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/datadict/datadict-generic.inc.php b/src/adodb5/datadict/datadict-generic.inc.php
index 8f24d37e..5d8e8f62 100644
--- a/src/adodb5/datadict/datadict-generic.inc.php
+++ b/src/adodb5/datadict/datadict-generic.inc.php
@@ -5,43 +5,43 @@
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.
-
+
*/
// security - hide paths
if (!defined('ADODB_DIR')) die();
class ADODB2_generic extends ADODB_DataDict {
-
+
var $databaseType = 'generic';
var $seqField = false;
-
-
+
+
function ActualType($meta)
{
switch($meta) {
case 'C': return 'VARCHAR';
case 'XL':
case 'X': return 'VARCHAR(250)';
-
+
case 'C2': return 'VARCHAR';
case 'X2': return 'VARCHAR(250)';
-
+
case 'B': return 'VARCHAR';
-
+
case 'D': return 'DATE';
case 'TS':
case 'T': return 'DATE';
-
+
case 'L': return 'DECIMAL(1)';
case 'I': return 'DECIMAL(10)';
case 'I1': return 'DECIMAL(3)';
case 'I2': return 'DECIMAL(5)';
case 'I4': return 'DECIMAL(10)';
case 'I8': return 'DECIMAL(20)';
-
+
case 'F': return 'DECIMAL(32,8)';
case 'N': return 'DECIMAL';
default:
@@ -54,14 +54,14 @@ function AlterColumnSQL($tabname, $flds)
if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported");
return array();
}
-
-
+
+
function DropColumnSQL($tabname, $flds)
{
if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
return array();
}
-
+
}
/*
@@ -71,51 +71,51 @@ function ActualType($meta)
switch($meta) {
case 'C': return 'VARCHAR';
case 'X': return 'VARCHAR';
-
+
case 'C2': return 'VARCHAR'; // up to 32K
case 'X2': return 'VARCHAR';
-
+
case 'B': return 'BLOB';
-
+
case 'D': return 'DATE';
case 'T': return 'TIMESTAMP';
-
+
case 'L': return 'SMALLINT';
case 'I': return 'INTEGER';
case 'I1': return 'SMALLINT';
case 'I2': return 'SMALLINT';
case 'I4': return 'INTEGER';
case 'I8': return 'BIGINT';
-
+
case 'F': return 'DOUBLE';
case 'N': return 'DECIMAL';
default:
return $meta;
}
}
-
+
// ifx
function ActualType($meta)
{
switch($meta) {
case 'C': return 'VARCHAR';// 255
case 'X': return 'TEXT';
-
+
case 'C2': return 'NVARCHAR';
case 'X2': return 'TEXT';
-
+
case 'B': return 'BLOB';
-
+
case 'D': return 'DATE';
case 'T': return 'DATETIME';
-
+
case 'L': return 'SMALLINT';
case 'I': return 'INTEGER';
case 'I1': return 'SMALLINT';
case 'I2': return 'SMALLINT';
case 'I4': return 'INTEGER';
case 'I8': return 'DECIMAL(20)';
-
+
case 'F': return 'FLOAT';
case 'N': return 'DECIMAL';
default:
@@ -123,4 +123,4 @@ function ActualType($meta)
}
}
*/
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/datadict/datadict-ibase.inc.php b/src/adodb5/datadict/datadict-ibase.inc.php
deleted file mode 100644
index 6bbd334f..00000000
--- a/src/adodb5/datadict/datadict-ibase.inc.php
+++ /dev/null
@@ -1,68 +0,0 @@
-debug) ADOConnection::outp("AlterColumnSQL not supported");
- return array();
- }
-
-
- function DropColumnSQL($tabname, $flds)
- {
- if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
- return array();
- }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/datadict/datadict-informix.inc.php b/src/adodb5/datadict/datadict-informix.inc.php
deleted file mode 100644
index a0d96672..00000000
--- a/src/adodb5/datadict/datadict-informix.inc.php
+++ /dev/null
@@ -1,81 +0,0 @@
-debug) ADOConnection::outp("AlterColumnSQL not supported");
- return array();
- }
-
-
- function DropColumnSQL($tabname, $flds)
- {
- if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
- return array();
- }
-
- // return string must begin with space
- function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
- {
- if ($fautoinc) {
- $ftype = 'SERIAL';
- return '';
- }
- $suffix = '';
- if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
- if ($fnotnull) $suffix .= ' NOT NULL';
- if ($fconstraint) $suffix .= ' '.$fconstraint;
- return $suffix;
- }
-
-}
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/datadict/datadict-mssql.inc.php b/src/adodb5/datadict/datadict-mssql.inc.php
deleted file mode 100644
index b4c9f861..00000000
--- a/src/adodb5/datadict/datadict-mssql.inc.php
+++ /dev/null
@@ -1,284 +0,0 @@
-type;
- $len = $fieldobj->max_length;
- }
-
- $len = -1; // mysql max_length is not accurate
- switch (strtoupper($t)) {
- case 'R':
- case 'INT':
- case 'INTEGER': return 'I';
- case 'BIT':
- case 'TINYINT': return 'I1';
- case 'SMALLINT': return 'I2';
- case 'BIGINT': return 'I8';
- case 'SMALLDATETIME': return 'T';
- case 'REAL':
- case 'FLOAT': return 'F';
- default: return parent::MetaType($t,$len,$fieldobj);
- }
- }
-
- function ActualType($meta)
- {
- switch(strtoupper($meta)) {
-
- case 'C': return 'VARCHAR';
- case 'XL': return (isset($this)) ? $this->typeXL : 'TEXT';
- case 'X': return (isset($this)) ? $this->typeX : 'TEXT'; ## could be varchar(8000), but we want compat with oracle
- case 'C2': return 'NVARCHAR';
- case 'X2': return 'NTEXT';
-
- case 'B': return 'IMAGE';
-
- case 'D': return 'DATETIME';
-
- case 'TS':
- case 'T': return 'DATETIME';
- case 'L': return 'BIT';
-
- case 'R':
- case 'I': return 'INT';
- case 'I1': return 'TINYINT';
- case 'I2': return 'SMALLINT';
- case 'I4': return 'INT';
- case 'I8': return 'BIGINT';
-
- case 'F': return 'REAL';
- case 'N': return 'NUMERIC';
- default:
- return $meta;
- }
- }
-
-
- function AddColumnSQL($tabname, $flds)
- {
- $tabname = $this->TableName ($tabname);
- $f = array();
- list($lines,$pkey) = $this->_GenFields($flds);
- $s = "ALTER TABLE $tabname $this->addCol";
- foreach($lines as $v) {
- $f[] = "\n $v";
- }
- $s .= implode(', ',$f);
- $sql[] = $s;
- return $sql;
- }
-
- /*
- function AlterColumnSQL($tabname, $flds)
- {
- $tabname = $this->TableName ($tabname);
- $sql = array();
- list($lines,$pkey) = $this->_GenFields($flds);
- foreach($lines as $v) {
- $sql[] = "ALTER TABLE $tabname $this->alterCol $v";
- }
-
- return $sql;
- }
- */
-
- function DropColumnSQL($tabname, $flds)
- {
- $tabname = $this->TableName ($tabname);
- if (!is_array($flds))
- $flds = explode(',',$flds);
- $f = array();
- $s = 'ALTER TABLE ' . $tabname;
- foreach($flds as $v) {
- $f[] = "\n$this->dropCol ".$this->NameQuote($v);
- }
- $s .= implode(', ',$f);
- $sql[] = $s;
- return $sql;
- }
-
- // return string must begin with space
- function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
- {
- $suffix = '';
- if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
- if ($fautoinc) $suffix .= ' IDENTITY(1,1)';
- if ($fnotnull) $suffix .= ' NOT NULL';
- else if ($suffix == '') $suffix .= ' NULL';
- if ($fconstraint) $suffix .= ' '.$fconstraint;
- return $suffix;
- }
-
- /*
-CREATE TABLE
- [ database_name.[ owner ] . | owner. ] table_name
- ( { < column_definition >
- | column_name AS computed_column_expression
- | < table_constraint > ::= [ CONSTRAINT constraint_name ] }
-
- | [ { PRIMARY KEY | UNIQUE } [ ,...n ]
- )
-
-[ ON { filegroup | DEFAULT } ]
-[ TEXTIMAGE_ON { filegroup | DEFAULT } ]
-
-< column_definition > ::= { column_name data_type }
- [ COLLATE < collation_name > ]
- [ [ DEFAULT constant_expression ]
- | [ IDENTITY [ ( seed , increment ) [ NOT FOR REPLICATION ] ] ]
- ]
- [ ROWGUIDCOL]
- [ < column_constraint > ] [ ...n ]
-
-< column_constraint > ::= [ CONSTRAINT constraint_name ]
- { [ NULL | NOT NULL ]
- | [ { PRIMARY KEY | UNIQUE }
- [ CLUSTERED | NONCLUSTERED ]
- [ WITH FILLFACTOR = fillfactor ]
- [ON {filegroup | DEFAULT} ] ]
- ]
- | [ [ FOREIGN KEY ]
- REFERENCES ref_table [ ( ref_column ) ]
- [ ON DELETE { CASCADE | NO ACTION } ]
- [ ON UPDATE { CASCADE | NO ACTION } ]
- [ NOT FOR REPLICATION ]
- ]
- | CHECK [ NOT FOR REPLICATION ]
- ( logical_expression )
- }
-
-< table_constraint > ::= [ CONSTRAINT constraint_name ]
- { [ { PRIMARY KEY | UNIQUE }
- [ CLUSTERED | NONCLUSTERED ]
- { ( column [ ASC | DESC ] [ ,...n ] ) }
- [ WITH FILLFACTOR = fillfactor ]
- [ ON { filegroup | DEFAULT } ]
- ]
- | FOREIGN KEY
- [ ( column [ ,...n ] ) ]
- REFERENCES ref_table [ ( ref_column [ ,...n ] ) ]
- [ ON DELETE { CASCADE | NO ACTION } ]
- [ ON UPDATE { CASCADE | NO ACTION } ]
- [ NOT FOR REPLICATION ]
- | CHECK [ NOT FOR REPLICATION ]
- ( search_conditions )
- }
-
-
- */
-
- /*
- CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name
- ON { table | view } ( column [ ASC | DESC ] [ ,...n ] )
- [ WITH < index_option > [ ,...n] ]
- [ ON filegroup ]
- < index_option > :: =
- { PAD_INDEX |
- FILLFACTOR = fillfactor |
- IGNORE_DUP_KEY |
- DROP_EXISTING |
- STATISTICS_NORECOMPUTE |
- SORT_IN_TEMPDB
- }
-*/
- function _IndexSQL($idxname, $tabname, $flds, $idxoptions)
- {
- $sql = array();
-
- if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) {
- $sql[] = sprintf ($this->dropIndex, $idxname, $tabname);
- if ( isset($idxoptions['DROP']) )
- return $sql;
- }
-
- if ( empty ($flds) ) {
- return $sql;
- }
-
- $unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : '';
- $clustered = isset($idxoptions['CLUSTERED']) ? ' CLUSTERED' : '';
-
- if ( is_array($flds) )
- $flds = implode(', ',$flds);
- $s = 'CREATE' . $unique . $clustered . ' INDEX ' . $idxname . ' ON ' . $tabname . ' (' . $flds . ')';
-
- if ( isset($idxoptions[$this->upperName]) )
- $s .= $idxoptions[$this->upperName];
-
-
- $sql[] = $s;
-
- return $sql;
- }
-
-
- function _GetSize($ftype, $ty, $fsize, $fprec)
- {
- switch ($ftype) {
- case 'INT':
- case 'SMALLINT':
- case 'TINYINT':
- case 'BIGINT':
- return $ftype;
- }
- if ($ty == 'T') return $ftype;
- return parent::_GetSize($ftype, $ty, $fsize, $fprec);
-
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/datadict/datadict-mssqlnative.inc.php b/src/adodb5/datadict/datadict-mssqlnative.inc.php
deleted file mode 100644
index 08f41331..00000000
--- a/src/adodb5/datadict/datadict-mssqlnative.inc.php
+++ /dev/null
@@ -1,282 +0,0 @@
-type;
- $len = $fieldobj->max_length;
- }
-
- $len = -1; // mysql max_length is not accurate
- switch (strtoupper($t)) {
- case 'R':
- case 'INT':
- case 'INTEGER': return 'I';
- case 'BIT':
- case 'TINYINT': return 'I1';
- case 'SMALLINT': return 'I2';
- case 'BIGINT': return 'I8';
-
- case 'REAL':
- case 'FLOAT': return 'F';
- default: return parent::MetaType($t,$len,$fieldobj);
- }
- }
-
- function ActualType($meta)
- {
- switch(strtoupper($meta)) {
-
- case 'C': return 'VARCHAR';
- case 'XL': return (isset($this)) ? $this->typeXL : 'TEXT';
- case 'X': return (isset($this)) ? $this->typeX : 'TEXT'; ## could be varchar(8000), but we want compat with oracle
- case 'C2': return 'NVARCHAR';
- case 'X2': return 'NTEXT';
-
- case 'B': return 'IMAGE';
-
- case 'D': return 'DATETIME';
- case 'T': return 'DATETIME';
- case 'L': return 'BIT';
-
- case 'R':
- case 'I': return 'INT';
- case 'I1': return 'TINYINT';
- case 'I2': return 'SMALLINT';
- case 'I4': return 'INT';
- case 'I8': return 'BIGINT';
-
- case 'F': return 'REAL';
- case 'N': return 'NUMERIC';
- default:
- return $meta;
- }
- }
-
-
- function AddColumnSQL($tabname, $flds)
- {
- $tabname = $this->TableName ($tabname);
- $f = array();
- list($lines,$pkey) = $this->_GenFields($flds);
- $s = "ALTER TABLE $tabname $this->addCol";
- foreach($lines as $v) {
- $f[] = "\n $v";
- }
- $s .= implode(', ',$f);
- $sql[] = $s;
- return $sql;
- }
-
- /*
- function AlterColumnSQL($tabname, $flds)
- {
- $tabname = $this->TableName ($tabname);
- $sql = array();
- list($lines,$pkey) = $this->_GenFields($flds);
- foreach($lines as $v) {
- $sql[] = "ALTER TABLE $tabname $this->alterCol $v";
- }
-
- return $sql;
- }
- */
-
- function DropColumnSQL($tabname, $flds)
- {
- $tabname = $this->TableName ($tabname);
- if (!is_array($flds))
- $flds = explode(',',$flds);
- $f = array();
- $s = 'ALTER TABLE ' . $tabname;
- foreach($flds as $v) {
- $f[] = "\n$this->dropCol ".$this->NameQuote($v);
- }
- $s .= implode(', ',$f);
- $sql[] = $s;
- return $sql;
- }
-
- // return string must begin with space
- function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
- {
- $suffix = '';
- if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
- if ($fautoinc) $suffix .= ' IDENTITY(1,1)';
- if ($fnotnull) $suffix .= ' NOT NULL';
- else if ($suffix == '') $suffix .= ' NULL';
- if ($fconstraint) $suffix .= ' '.$fconstraint;
- return $suffix;
- }
-
- /*
-CREATE TABLE
- [ database_name.[ owner ] . | owner. ] table_name
- ( { < column_definition >
- | column_name AS computed_column_expression
- | < table_constraint > ::= [ CONSTRAINT constraint_name ] }
-
- | [ { PRIMARY KEY | UNIQUE } [ ,...n ]
- )
-
-[ ON { filegroup | DEFAULT } ]
-[ TEXTIMAGE_ON { filegroup | DEFAULT } ]
-
-< column_definition > ::= { column_name data_type }
- [ COLLATE < collation_name > ]
- [ [ DEFAULT constant_expression ]
- | [ IDENTITY [ ( seed , increment ) [ NOT FOR REPLICATION ] ] ]
- ]
- [ ROWGUIDCOL]
- [ < column_constraint > ] [ ...n ]
-
-< column_constraint > ::= [ CONSTRAINT constraint_name ]
- { [ NULL | NOT NULL ]
- | [ { PRIMARY KEY | UNIQUE }
- [ CLUSTERED | NONCLUSTERED ]
- [ WITH FILLFACTOR = fillfactor ]
- [ON {filegroup | DEFAULT} ] ]
- ]
- | [ [ FOREIGN KEY ]
- REFERENCES ref_table [ ( ref_column ) ]
- [ ON DELETE { CASCADE | NO ACTION } ]
- [ ON UPDATE { CASCADE | NO ACTION } ]
- [ NOT FOR REPLICATION ]
- ]
- | CHECK [ NOT FOR REPLICATION ]
- ( logical_expression )
- }
-
-< table_constraint > ::= [ CONSTRAINT constraint_name ]
- { [ { PRIMARY KEY | UNIQUE }
- [ CLUSTERED | NONCLUSTERED ]
- { ( column [ ASC | DESC ] [ ,...n ] ) }
- [ WITH FILLFACTOR = fillfactor ]
- [ ON { filegroup | DEFAULT } ]
- ]
- | FOREIGN KEY
- [ ( column [ ,...n ] ) ]
- REFERENCES ref_table [ ( ref_column [ ,...n ] ) ]
- [ ON DELETE { CASCADE | NO ACTION } ]
- [ ON UPDATE { CASCADE | NO ACTION } ]
- [ NOT FOR REPLICATION ]
- | CHECK [ NOT FOR REPLICATION ]
- ( search_conditions )
- }
-
-
- */
-
- /*
- CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name
- ON { table | view } ( column [ ASC | DESC ] [ ,...n ] )
- [ WITH < index_option > [ ,...n] ]
- [ ON filegroup ]
- < index_option > :: =
- { PAD_INDEX |
- FILLFACTOR = fillfactor |
- IGNORE_DUP_KEY |
- DROP_EXISTING |
- STATISTICS_NORECOMPUTE |
- SORT_IN_TEMPDB
- }
-*/
- function _IndexSQL($idxname, $tabname, $flds, $idxoptions)
- {
- $sql = array();
-
- if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) {
- $sql[] = sprintf ($this->dropIndex, $idxname, $tabname);
- if ( isset($idxoptions['DROP']) )
- return $sql;
- }
-
- if ( empty ($flds) ) {
- return $sql;
- }
-
- $unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : '';
- $clustered = isset($idxoptions['CLUSTERED']) ? ' CLUSTERED' : '';
-
- if ( is_array($flds) )
- $flds = implode(', ',$flds);
- $s = 'CREATE' . $unique . $clustered . ' INDEX ' . $idxname . ' ON ' . $tabname . ' (' . $flds . ')';
-
- if ( isset($idxoptions[$this->upperName]) )
- $s .= $idxoptions[$this->upperName];
-
-
- $sql[] = $s;
-
- return $sql;
- }
-
-
- function _GetSize($ftype, $ty, $fsize, $fprec)
- {
- switch ($ftype) {
- case 'INT':
- case 'SMALLINT':
- case 'TINYINT':
- case 'BIGINT':
- return $ftype;
- }
- if ($ty == 'T') return $ftype;
- return parent::_GetSize($ftype, $ty, $fsize, $fprec);
-
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/datadict/datadict-oci8.inc.php b/src/adodb5/datadict/datadict-oci8.inc.php
deleted file mode 100644
index 0b7ce05a..00000000
--- a/src/adodb5/datadict/datadict-oci8.inc.php
+++ /dev/null
@@ -1,297 +0,0 @@
-type;
- $len = $fieldobj->max_length;
- }
- switch (strtoupper($t)) {
- case 'VARCHAR':
- case 'VARCHAR2':
- case 'CHAR':
- case 'VARBINARY':
- case 'BINARY':
- if (isset($this) && $len <= $this->blobSize) return 'C';
- return 'X';
-
- case 'NCHAR':
- case 'NVARCHAR2':
- case 'NVARCHAR':
- if (isset($this) && $len <= $this->blobSize) return 'C2';
- return 'X2';
-
- case 'NCLOB':
- case 'CLOB':
- return 'XL';
-
- case 'LONG RAW':
- case 'LONG VARBINARY':
- case 'BLOB':
- return 'B';
-
- case 'TIMESTAMP':
- return 'TS';
-
- case 'DATE':
- return 'T';
-
- case 'INT':
- case 'SMALLINT':
- case 'INTEGER':
- return 'I';
-
- default:
- return 'N';
- }
- }
-
- function ActualType($meta)
- {
- switch($meta) {
- case 'C': return 'VARCHAR';
- case 'X': return $this->typeX;
- case 'XL': return $this->typeXL;
-
- case 'C2': return 'NVARCHAR2';
- case 'X2': return 'NVARCHAR2(4000)';
-
- case 'B': return 'BLOB';
-
- case 'TS':
- return 'TIMESTAMP';
-
- case 'D':
- case 'T': return 'DATE';
- case 'L': return 'NUMBER(1)';
- case 'I1': return 'NUMBER(3)';
- case 'I2': return 'NUMBER(5)';
- case 'I':
- case 'I4': return 'NUMBER(10)';
-
- case 'I8': return 'NUMBER(20)';
- case 'F': return 'NUMBER';
- case 'N': return 'NUMBER';
- case 'R': return 'NUMBER(20)';
- default:
- return $meta;
- }
- }
-
- function CreateDatabase($dbname, $options=false)
- {
- $options = $this->_Options($options);
- $password = isset($options['PASSWORD']) ? $options['PASSWORD'] : 'tiger';
- $tablespace = isset($options["TABLESPACE"]) ? " DEFAULT TABLESPACE ".$options["TABLESPACE"] : '';
- $sql[] = "CREATE USER ".$dbname." IDENTIFIED BY ".$password.$tablespace;
- $sql[] = "GRANT CREATE SESSION, CREATE TABLE,UNLIMITED TABLESPACE,CREATE SEQUENCE TO $dbname";
-
- return $sql;
- }
-
- function AddColumnSQL($tabname, $flds)
- {
- $f = array();
- list($lines,$pkey) = $this->_GenFields($flds);
- $s = "ALTER TABLE $tabname ADD (";
- foreach($lines as $v) {
- $f[] = "\n $v";
- }
-
- $s .= implode(', ',$f).')';
- $sql[] = $s;
- return $sql;
- }
-
- function AlterColumnSQL($tabname, $flds)
- {
- $f = array();
- list($lines,$pkey) = $this->_GenFields($flds);
- $s = "ALTER TABLE $tabname MODIFY(";
- foreach($lines as $v) {
- $f[] = "\n $v";
- }
- $s .= implode(', ',$f).')';
- $sql[] = $s;
- return $sql;
- }
-
- function DropColumnSQL($tabname, $flds)
- {
- if (!is_array($flds)) $flds = explode(',',$flds);
- foreach ($flds as $k => $v) $flds[$k] = $this->NameQuote($v);
-
- $sql = array();
- $s = "ALTER TABLE $tabname DROP(";
- $s .= implode(', ',$flds).') CASCADE CONSTRAINTS';
- $sql[] = $s;
- return $sql;
- }
-
- function _DropAutoIncrement($t)
- {
- if (strpos($t,'.') !== false) {
- $tarr = explode('.',$t);
- return "drop sequence ".$tarr[0].".seq_".$tarr[1];
- }
- return "drop sequence seq_".$t;
- }
-
- // return string must begin with space
- function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
- {
- $suffix = '';
-
- if ($fdefault == "''" && $fnotnull) {// this is null in oracle
- $fnotnull = false;
- if ($this->debug) ADOConnection::outp("NOT NULL and DEFAULT='' illegal in Oracle");
- }
-
- if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
- if ($fnotnull) $suffix .= ' NOT NULL';
-
- if ($fautoinc) $this->seqField = $fname;
- if ($fconstraint) $suffix .= ' '.$fconstraint;
-
- return $suffix;
- }
-
-/*
-CREATE or replace TRIGGER jaddress_insert
-before insert on jaddress
-for each row
-begin
-select seqaddress.nextval into :new.A_ID from dual;
-end;
-*/
- function _Triggers($tabname,$tableoptions)
- {
- if (!$this->seqField) return array();
-
- if ($this->schema) {
- $t = strpos($tabname,'.');
- if ($t !== false) $tab = substr($tabname,$t+1);
- else $tab = $tabname;
- $seqname = $this->schema.'.'.$this->seqPrefix.$tab;
- $trigname = $this->schema.'.'.$this->trigPrefix.$this->seqPrefix.$tab;
- } else {
- $seqname = $this->seqPrefix.$tabname;
- $trigname = $this->trigPrefix.$seqname;
- }
-
- if (strlen($seqname) > 30) {
- $seqname = $this->seqPrefix.uniqid('');
- } // end if
- if (strlen($trigname) > 30) {
- $trigname = $this->trigPrefix.uniqid('');
- } // end if
-
- if (isset($tableoptions['REPLACE'])) $sql[] = "DROP SEQUENCE $seqname";
- $seqCache = '';
- if (isset($tableoptions['SEQUENCE_CACHE'])){$seqCache = $tableoptions['SEQUENCE_CACHE'];}
- $seqIncr = '';
- if (isset($tableoptions['SEQUENCE_INCREMENT'])){$seqIncr = ' INCREMENT BY '.$tableoptions['SEQUENCE_INCREMENT'];}
- $seqStart = '';
- if (isset($tableoptions['SEQUENCE_START'])){$seqIncr = ' START WITH '.$tableoptions['SEQUENCE_START'];}
- $sql[] = "CREATE SEQUENCE $seqname $seqStart $seqIncr $seqCache";
- $sql[] = "CREATE OR REPLACE TRIGGER $trigname BEFORE insert ON $tabname FOR EACH ROW WHEN (NEW.$this->seqField IS NULL OR NEW.$this->seqField = 0) BEGIN select $seqname.nextval into :new.$this->seqField from dual; END;";
-
- $this->seqField = false;
- return $sql;
- }
-
- /*
- CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)]
- [table_options] [select_statement]
- create_definition:
- col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT]
- [PRIMARY KEY] [reference_definition]
- or PRIMARY KEY (index_col_name,...)
- or KEY [index_name] (index_col_name,...)
- or INDEX [index_name] (index_col_name,...)
- or UNIQUE [INDEX] [index_name] (index_col_name,...)
- or FULLTEXT [INDEX] [index_name] (index_col_name,...)
- or [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...)
- [reference_definition]
- or CHECK (expr)
- */
-
-
-
- function _IndexSQL($idxname, $tabname, $flds,$idxoptions)
- {
- $sql = array();
-
- if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) {
- $sql[] = sprintf ($this->dropIndex, $idxname, $tabname);
- if ( isset($idxoptions['DROP']) )
- return $sql;
- }
-
- if ( empty ($flds) ) {
- return $sql;
- }
-
- if (isset($idxoptions['BITMAP'])) {
- $unique = ' BITMAP';
- } elseif (isset($idxoptions['UNIQUE'])) {
- $unique = ' UNIQUE';
- } else {
- $unique = '';
- }
-
- if ( is_array($flds) )
- $flds = implode(', ',$flds);
- $s = 'CREATE' . $unique . ' INDEX ' . $idxname . ' ON ' . $tabname . ' (' . $flds . ')';
-
- if ( isset($idxoptions[$this->upperName]) )
- $s .= $idxoptions[$this->upperName];
-
- if (isset($idxoptions['oci8']))
- $s .= $idxoptions['oci8'];
-
-
- $sql[] = $s;
-
- return $sql;
- }
-
- function GetCommentSQL($table,$col)
- {
- $table = $this->connection->qstr($table);
- $col = $this->connection->qstr($col);
- return "select comments from USER_COL_COMMENTS where TABLE_NAME=$table and COLUMN_NAME=$col";
- }
-
- function SetCommentSQL($table,$col,$cmt)
- {
- $cmt = $this->connection->qstr($cmt);
- return "COMMENT ON COLUMN $table.$col IS $cmt";
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/datadict/datadict-postgres.inc.php b/src/adodb5/datadict/datadict-postgres.inc.php
deleted file mode 100644
index f31bdd75..00000000
--- a/src/adodb5/datadict/datadict-postgres.inc.php
+++ /dev/null
@@ -1,448 +0,0 @@
-type;
- $len = $fieldobj->max_length;
- }
- $is_serial = is_object($fieldobj) && $fieldobj->primary_key && $fieldobj->unique &&
- $fieldobj->has_default && substr($fieldobj->default_value,0,8) == 'nextval(';
-
- switch (strtoupper($t)) {
- case 'INTERVAL':
- case 'CHAR':
- case 'CHARACTER':
- case 'VARCHAR':
- case 'NAME':
- case 'BPCHAR':
- if ($len <= $this->blobSize) return 'C';
-
- case 'TEXT':
- return 'X';
-
- case 'IMAGE': // user defined type
- case 'BLOB': // user defined type
- case 'BIT': // This is a bit string, not a single bit, so don't return 'L'
- case 'VARBIT':
- case 'BYTEA':
- return 'B';
-
- case 'BOOL':
- case 'BOOLEAN':
- return 'L';
-
- case 'DATE':
- return 'D';
-
- case 'TIME':
- case 'DATETIME':
- case 'TIMESTAMP':
- case 'TIMESTAMPTZ':
- return 'T';
-
- case 'INTEGER': return !$is_serial ? 'I' : 'R';
- case 'SMALLINT':
- case 'INT2': return !$is_serial ? 'I2' : 'R';
- case 'INT4': return !$is_serial ? 'I4' : 'R';
- case 'BIGINT':
- case 'INT8': return !$is_serial ? 'I8' : 'R';
-
- case 'OID':
- case 'SERIAL':
- return 'R';
-
- case 'FLOAT4':
- case 'FLOAT8':
- case 'DOUBLE PRECISION':
- case 'REAL':
- return 'F';
-
- default:
- return 'N';
- }
- }
-
- function ActualType($meta)
- {
- switch($meta) {
- case 'C': return 'VARCHAR';
- case 'XL':
- case 'X': return 'TEXT';
-
- case 'C2': return 'VARCHAR';
- case 'X2': return 'TEXT';
-
- case 'B': return 'BYTEA';
-
- case 'D': return 'DATE';
- case 'TS':
- case 'T': return 'TIMESTAMP';
-
- case 'L': return 'BOOLEAN';
- case 'I': return 'INTEGER';
- case 'I1': return 'SMALLINT';
- case 'I2': return 'INT2';
- case 'I4': return 'INT4';
- case 'I8': return 'INT8';
-
- case 'F': return 'FLOAT8';
- case 'N': return 'NUMERIC';
- default:
- return $meta;
- }
- }
-
- /**
- * Adding a new Column
- *
- * reimplementation of the default function as postgres does NOT allow to set the default in the same statement
- *
- * @param string $tabname table-name
- * @param string $flds column-names and types for the changed columns
- * @return array with SQL strings
- */
- function AddColumnSQL($tabname, $flds)
- {
- $tabname = $this->TableName ($tabname);
- $sql = array();
- list($lines,$pkey) = $this->_GenFields($flds);
- $alter = 'ALTER TABLE ' . $tabname . $this->addCol . ' ';
- foreach($lines as $v) {
- if (($not_null = preg_match('/NOT NULL/i',$v))) {
- $v = preg_replace('/NOT NULL/i','',$v);
- }
- if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) {
- list(,$colname,$default) = $matches;
- $sql[] = $alter . str_replace('DEFAULT '.$default,'',$v);
- $sql[] = 'UPDATE '.$tabname.' SET '.$colname.'='.$default;
- $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET DEFAULT ' . $default;
- } else {
- $sql[] = $alter . $v;
- }
- if ($not_null) {
- list($colname) = explode(' ',$v);
- $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET NOT NULL';
- }
- }
- return $sql;
- }
-
-
- function DropIndexSQL ($idxname, $tabname = NULL)
- {
- return array(sprintf($this->dropIndex, $this->TableName($idxname), $this->TableName($tabname)));
- }
-
- /**
- * Change the definition of one column
- *
- * Postgres can't do that on it's 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/ $tableoptions options for the new table see CreateTableSQL, default ''
- * @return array with SQL strings
- */
- /*
- function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
- {
- if (!$tableflds) {
- if ($this->debug) ADOConnection::outp("AlterColumnSQL needs a complete table-definiton for PostgreSQL");
- return array();
- }
- return $this->_recreate_copy_table($tabname,False,$tableflds,$tableoptions);
- }*/
-
- function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
- {
- // Check if alter single column datatype available - works with 8.0+
- $has_alter_column = 8.0 <= (float) @$this->serverInfo['version'];
-
- if ($has_alter_column) {
- $tabname = $this->TableName($tabname);
- $sql = array();
- list($lines,$pkey) = $this->_GenFields($flds);
- $alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' ';
- foreach($lines as $v) {
- if ($not_null = preg_match('/NOT NULL/i',$v)) {
- $v = preg_replace('/NOT NULL/i','',$v);
- }
- // this next block doesn't work - there is no way that I can see to
- // explicitly ask a column to be null using $flds
- else if ($set_null = preg_match('/NULL/i',$v)) {
- // if they didn't specify not null, see if they explicitely asked for null
- $v = preg_replace('/\sNULL/i','',$v);
- }
-
- if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) {
- list(,$colname,$default) = $matches;
- $v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v);
- $sql[] = $alter . $colname . ' TYPE ' . str_replace('DEFAULT '.$default,'',$v);
- $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET DEFAULT ' . $default;
- }
- else {
- // drop default?
- preg_match ('/^\s*(\S+)\s+(.*)$/',$v,$matches);
- list (,$colname,$rest) = $matches;
- $sql[] = $alter . $colname . ' TYPE ' . $rest;
- }
-
- list($colname) = explode(' ',$v);
- if ($not_null) {
- // this does not error out if the column is already not null
- $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET NOT NULL';
- }
- if ($set_null) {
- // this does not error out if the column is already null
- $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' DROP NOT NULL';
- }
- }
- return $sql;
- }
-
- // does not have alter column
- if (!$tableflds) {
- if ($this->debug) ADOConnection::outp("AlterColumnSQL needs a complete table-definiton for PostgreSQL");
- return array();
- }
- return $this->_recreate_copy_table($tabname,False,$tableflds,$tableoptions);
- }
-
- /**
- * Drop one column
- *
- * Postgres < 7.3 can't do that on it's 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/ $tableoptions options for the new table see CreateTableSQL, default ''
- * @return array with SQL strings
- */
- function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
- {
- $has_drop_column = 7.3 <= (float) @$this->serverInfo['version'];
- if (!$has_drop_column && !$tableflds) {
- if ($this->debug) ADOConnection::outp("DropColumnSQL needs complete table-definiton for PostgreSQL < 7.3");
- return array();
- }
- if ($has_drop_column) {
- return ADODB_DataDict::DropColumnSQL($tabname, $flds);
- }
- return $this->_recreate_copy_table($tabname,$flds,$tableflds,$tableoptions);
- }
-
- /**
- * Save the content into a temp. table, drop and recreate the original table and copy the content back in
- *
- * We also take care to set the values of the sequenz and recreate the indexes.
- * All this is done in a transaction, to not loose the content of the table, if something went wrong!
- * @internal
- * @param string $tabname table-name
- * @param string $dropflds column-names to drop
- * @param string $tableflds complete defintion of the new table, eg. for postgres
- * @param array/string $tableoptions options for the new table see CreateTableSQL, default ''
- * @return array with SQL strings
- */
- function _recreate_copy_table($tabname,$dropflds,$tableflds,$tableoptions='')
- {
- if ($dropflds && !is_array($dropflds)) $dropflds = explode(',',$dropflds);
- $copyflds = array();
- foreach($this->MetaColumns($tabname) as $fld) {
- if (!$dropflds || !in_array($fld->name,$dropflds)) {
- // we need to explicit convert varchar to a number to be able to do an AlterColumn of a char column to a nummeric one
- if (preg_match('/'.$fld->name.' (I|I2|I4|I8|N|F)/i',$tableflds,$matches) &&
- in_array($fld->type,array('varchar','char','text','bytea'))) {
- $copyflds[] = "to_number($fld->name,'S9999999999999D99')";
- } else {
- $copyflds[] = $fld->name;
- }
- // identify the sequence name and the fld its on
- if ($fld->primary_key && $fld->has_default &&
- preg_match("/nextval\('([^']+)'::text\)/",$fld->default_value,$matches)) {
- $seq_name = $matches[1];
- $seq_fld = $fld->name;
- }
- }
- }
- $copyflds = implode(', ',$copyflds);
-
- $tempname = $tabname.'_tmp';
- $aSql[] = 'BEGIN'; // we use a transaction, to make sure not to loose the content of the table
- $aSql[] = "SELECT * INTO TEMPORARY TABLE $tempname FROM $tabname";
- $aSql = array_merge($aSql,$this->DropTableSQL($tabname));
- $aSql = array_merge($aSql,$this->CreateTableSQL($tabname,$tableflds,$tableoptions));
- $aSql[] = "INSERT INTO $tabname SELECT $copyflds FROM $tempname";
- if ($seq_name && $seq_fld) { // if we have a sequence we need to set it again
- $seq_name = $tabname.'_'.$seq_fld.'_seq'; // has to be the name of the new implicit sequence
- $aSql[] = "SELECT setval('$seq_name',MAX($seq_fld)) FROM $tabname";
- }
- $aSql[] = "DROP TABLE $tempname";
- // recreate the indexes, if they not contain one of the droped columns
- foreach($this->MetaIndexes($tabname) as $idx_name => $idx_data)
- {
- if (substr($idx_name,-5) != '_pkey' && (!$dropflds || !count(array_intersect($dropflds,$idx_data['columns'])))) {
- $aSql = array_merge($aSql,$this->CreateIndexSQL($idx_name,$tabname,$idx_data['columns'],
- $idx_data['unique'] ? array('UNIQUE') : False));
- }
- }
- $aSql[] = 'COMMIT';
- return $aSql;
- }
-
- function DropTableSQL($tabname)
- {
- $sql = ADODB_DataDict::DropTableSQL($tabname);
-
- $drop_seq = $this->_DropAutoIncrement($tabname);
- if ($drop_seq) $sql[] = $drop_seq;
-
- return $sql;
- }
-
- // return string must begin with space
- function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
- {
- if ($fautoinc) {
- $ftype = 'SERIAL';
- return '';
- }
- $suffix = '';
- if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
- if ($fnotnull) $suffix .= ' NOT NULL';
- if ($fconstraint) $suffix .= ' '.$fconstraint;
- return $suffix;
- }
-
- // search for a sequece for the given table (asumes the seqence-name contains the table-name!)
- // if yes return sql to drop it
- // this is still necessary if postgres < 7.3 or the SERIAL was created on an earlier version!!!
- function _DropAutoIncrement($tabname)
- {
- $tabname = $this->connection->quote('%'.$tabname.'%');
-
- $seq = $this->connection->GetOne("SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relname LIKE $tabname AND relkind='S'");
-
- // check if a tables depends on the sequenz and it therefor cant and dont need to be droped separatly
- if (!$seq || $this->connection->GetOne("SELECT relname FROM pg_class JOIN pg_depend ON pg_class.relfilenode=pg_depend.objid WHERE relname='$seq' AND relkind='S' AND deptype='i'")) {
- return False;
- }
- return "DROP SEQUENCE ".$seq;
- }
-
- function RenameTableSQL($tabname,$newname)
- {
- if (!empty($this->schema)) {
- $rename_from = $this->TableName($tabname);
- $schema_save = $this->schema;
- $this->schema = false;
- $rename_to = $this->TableName($newname);
- $this->schema = $schema_save;
- return array (sprintf($this->renameTable, $rename_from, $rename_to));
- }
-
- return array (sprintf($this->renameTable, $this->TableName($tabname),$this->TableName($newname)));
- }
-
- /*
- CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name (
- { column_name data_type [ DEFAULT default_expr ] [ column_constraint [, ... ] ]
- | table_constraint } [, ... ]
- )
- [ INHERITS ( parent_table [, ... ] ) ]
- [ WITH OIDS | WITHOUT OIDS ]
- where column_constraint is:
- [ CONSTRAINT constraint_name ]
- { NOT NULL | NULL | UNIQUE | PRIMARY KEY |
- CHECK (expression) |
- REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL ]
- [ ON DELETE action ] [ ON UPDATE action ] }
- [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
- and table_constraint is:
- [ CONSTRAINT constraint_name ]
- { UNIQUE ( column_name [, ... ] ) |
- PRIMARY KEY ( column_name [, ... ] ) |
- CHECK ( expression ) |
- FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ]
- [ MATCH FULL | MATCH PARTIAL ] [ ON DELETE action ] [ ON UPDATE action ] }
- [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
- */
-
-
- /*
- CREATE [ UNIQUE ] INDEX index_name ON table
-[ USING acc_method ] ( column [ ops_name ] [, ...] )
-[ WHERE predicate ]
-CREATE [ UNIQUE ] INDEX index_name ON table
-[ USING acc_method ] ( func_name( column [, ... ]) [ ops_name ] )
-[ WHERE predicate ]
- */
- function _IndexSQL($idxname, $tabname, $flds, $idxoptions)
- {
- $sql = array();
-
- if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) {
- $sql[] = sprintf ($this->dropIndex, $idxname, $tabname);
- 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['HASH']))
- $s .= 'USING HASH ';
-
- if ( isset($idxoptions[$this->upperName]) )
- $s .= $idxoptions[$this->upperName];
-
- if ( is_array($flds) )
- $flds = implode(', ',$flds);
- $s .= '(' . $flds . ')';
- $sql[] = $s;
-
- return $sql;
- }
-
- function _GetSize($ftype, $ty, $fsize, $fprec)
- {
- if (strlen($fsize) && $ty != 'X' && $ty != 'B' && $ty != 'I' && strpos($ftype,'(') === false) {
- $ftype .= "(".$fsize;
- if (strlen($fprec)) $ftype .= ",".$fprec;
- $ftype .= ')';
- }
- return $ftype;
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/datadict/datadict-sapdb.inc.php b/src/adodb5/datadict/datadict-sapdb.inc.php
deleted file mode 100644
index d4143d10..00000000
--- a/src/adodb5/datadict/datadict-sapdb.inc.php
+++ /dev/null
@@ -1,122 +0,0 @@
-type;
- $len = $fieldobj->max_length;
- }
- static $maxdb_type2adodb = array(
- 'VARCHAR' => 'C',
- 'CHARACTER' => 'C',
- 'LONG' => 'X', // no way to differ between 'X' and 'B' :-(
- 'DATE' => 'D',
- 'TIMESTAMP' => 'T',
- 'BOOLEAN' => 'L',
- 'INTEGER' => 'I4',
- 'SMALLINT' => 'I2',
- 'FLOAT' => 'F',
- 'FIXED' => 'N',
- );
- $type = isset($maxdb_type2adodb[$t]) ? $maxdb_type2adodb[$t] : 'C';
-
- // convert integer-types simulated with fixed back to integer
- if ($t == 'FIXED' && !$fieldobj->scale && ($len == 20 || $len == 3)) {
- $type = $len == 20 ? 'I8' : 'I1';
- }
- if ($fieldobj->auto_increment) $type = 'R';
-
- return $type;
- }
-
- // return string must begin with space
- function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
- {
- $suffix = '';
- if ($funsigned) $suffix .= ' UNSIGNED';
- if ($fnotnull) $suffix .= ' NOT NULL';
- if ($fautoinc) $suffix .= ' DEFAULT SERIAL';
- elseif (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
- if ($fconstraint) $suffix .= ' '.$fconstraint;
- return $suffix;
- }
-
- function AddColumnSQL($tabname, $flds)
- {
- $tabname = $this->TableName ($tabname);
- $sql = array();
- list($lines,$pkey) = $this->_GenFields($flds);
- return array( 'ALTER TABLE ' . $tabname . ' ADD (' . implode(', ',$lines) . ')' );
- }
-
- function AlterColumnSQL($tabname, $flds)
- {
- $tabname = $this->TableName ($tabname);
- $sql = array();
- list($lines,$pkey) = $this->_GenFields($flds);
- return array( 'ALTER TABLE ' . $tabname . ' MODIFY (' . implode(', ',$lines) . ')' );
- }
-
- function DropColumnSQL($tabname, $flds)
- {
- $tabname = $this->TableName ($tabname);
- if (!is_array($flds)) $flds = explode(',',$flds);
- foreach($flds as $k => $v) {
- $flds[$k] = $this->NameQuote($v);
- }
- return array( 'ALTER TABLE ' . $tabname . ' DROP (' . implode(', ',$flds) . ')' );
- }
-}
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-access.inc.php b/src/adodb5/drivers/adodb-access.inc.php
deleted file mode 100644
index f6eddb18..00000000
--- a/src/adodb5/drivers/adodb-access.inc.php
+++ /dev/null
@@ -1,87 +0,0 @@
-ADODB_odbc();
- }
-
- function Time()
- {
- return time();
- }
-
- function BeginTrans() { return false;}
-
- function IfNull( $field, $ifNull )
- {
- return " IIF(IsNull($field), $ifNull, $field) "; // if Access
- }
-/*
- function MetaTables()
- {
- global $ADODB_FETCH_MODE;
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $qid = odbc_tables($this->_connectionID);
- $rs = new ADORecordSet_odbc($qid);
- $ADODB_FETCH_MODE = $savem;
- if (!$rs) return false;
-
- $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
-
- $arr = $rs->GetArray();
- //print_pre($arr);
- $arr2 = array();
- for ($i=0; $i < sizeof($arr); $i++) {
- if ($arr[$i][2] && $arr[$i][3] != 'SYSTEM TABLE')
- $arr2[] = $arr[$i][2];
- }
- return $arr2;
- }*/
-}
-
-
-class ADORecordSet_access extends ADORecordSet_odbc {
-
- var $databaseType = "access";
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_odbc($id,$mode);
- }
-}// class
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-ado.inc.php b/src/adodb5/drivers/adodb-ado.inc.php
deleted file mode 100644
index feb1bc06..00000000
--- a/src/adodb5/drivers/adodb-ado.inc.php
+++ /dev/null
@@ -1,660 +0,0 @@
-_affectedRows = new VARIANT;
- }
-
- function ServerInfo()
- {
- if (!empty($this->_connectionID)) $desc = $this->_connectionID->provider;
- return array('description' => $desc, 'version' => '');
- }
-
- function _affectedrows()
- {
- if (PHP_VERSION >= 5) return $this->_affectedRows;
-
- return $this->_affectedRows->value;
- }
-
- // you can also pass a connection string like this:
- //
- // $DB->Connect('USER ID=sa;PASSWORD=pwd;SERVER=mangrove;DATABASE=ai',false,false,'SQLOLEDB');
- function _connect($argHostname, $argUsername, $argPassword, $argProvider= 'MSDASQL')
- {
- $u = 'UID';
- $p = 'PWD';
-
- if (!empty($this->charPage))
- $dbc = new COM('ADODB.Connection',null,$this->charPage);
- else
- $dbc = new COM('ADODB.Connection');
-
- if (! $dbc) return false;
-
- /* special support if provider is mssql or access */
- if ($argProvider=='mssql') {
- $u = 'User Id'; //User parameter name for OLEDB
- $p = 'Password';
- $argProvider = "SQLOLEDB"; // SQL Server Provider
-
- // not yet
- //if ($argDatabasename) $argHostname .= ";Initial Catalog=$argDatabasename";
-
- //use trusted conection for SQL if username not specified
- if (!$argUsername) $argHostname .= ";Trusted_Connection=Yes";
- } else if ($argProvider=='access')
- $argProvider = "Microsoft.Jet.OLEDB.4.0"; // Microsoft Jet Provider
-
- if ($argProvider) $dbc->Provider = $argProvider;
-
- if ($argUsername) $argHostname .= ";$u=$argUsername";
- if ($argPassword)$argHostname .= ";$p=$argPassword";
-
- if ($this->debug) ADOConnection::outp( "Host=".$argHostname."
\n version=$dbc->version");
- // @ added below for php 4.0.1 and earlier
- @$dbc->Open((string) $argHostname);
-
- $this->_connectionID = $dbc;
-
- $dbc->CursorLocation = $this->_cursor_location;
- return $dbc->State > 0;
- }
-
- // returns true or false
- function _pconnect($argHostname, $argUsername, $argPassword, $argProvider='MSDASQL')
- {
- return $this->_connect($argHostname,$argUsername,$argPassword,$argProvider);
- }
-
-/*
- adSchemaCatalogs = 1,
- adSchemaCharacterSets = 2,
- adSchemaCollations = 3,
- adSchemaColumns = 4,
- adSchemaCheckConstraints = 5,
- adSchemaConstraintColumnUsage = 6,
- adSchemaConstraintTableUsage = 7,
- adSchemaKeyColumnUsage = 8,
- adSchemaReferentialContraints = 9,
- adSchemaTableConstraints = 10,
- adSchemaColumnsDomainUsage = 11,
- adSchemaIndexes = 12,
- adSchemaColumnPrivileges = 13,
- adSchemaTablePrivileges = 14,
- adSchemaUsagePrivileges = 15,
- adSchemaProcedures = 16,
- adSchemaSchemata = 17,
- adSchemaSQLLanguages = 18,
- adSchemaStatistics = 19,
- adSchemaTables = 20,
- adSchemaTranslations = 21,
- adSchemaProviderTypes = 22,
- adSchemaViews = 23,
- adSchemaViewColumnUsage = 24,
- adSchemaViewTableUsage = 25,
- adSchemaProcedureParameters = 26,
- adSchemaForeignKeys = 27,
- adSchemaPrimaryKeys = 28,
- adSchemaProcedureColumns = 29,
- adSchemaDBInfoKeywords = 30,
- adSchemaDBInfoLiterals = 31,
- adSchemaCubes = 32,
- adSchemaDimensions = 33,
- adSchemaHierarchies = 34,
- adSchemaLevels = 35,
- adSchemaMeasures = 36,
- adSchemaProperties = 37,
- adSchemaMembers = 38
-
-*/
-
- function MetaTables()
- {
- $arr= array();
- $dbc = $this->_connectionID;
-
- $adors=@$dbc->OpenSchema(20);//tables
- if ($adors){
- $f = $adors->Fields(2);//table/view name
- $t = $adors->Fields(3);//table type
- while (!$adors->EOF){
- $tt=substr($t->value,0,6);
- if ($tt!='SYSTEM' && $tt !='ACCESS')
- $arr[]=$f->value;
- //print $f->value . ' ' . $t->value.'
';
- $adors->MoveNext();
- }
- $adors->Close();
- }
-
- return $arr;
- }
-
- function MetaColumns($table, $normalize=true)
- {
- $table = strtoupper($table);
- $arr = array();
- $dbc = $this->_connectionID;
-
- $adors=@$dbc->OpenSchema(4);//tables
-
- if ($adors){
- $t = $adors->Fields(2);//table/view name
- while (!$adors->EOF){
-
-
- if (strtoupper($t->Value) == $table) {
-
- $fld = new ADOFieldObject();
- $c = $adors->Fields(3);
- $fld->name = $c->Value;
- $fld->type = 'CHAR'; // cannot discover type in ADO!
- $fld->max_length = -1;
- $arr[strtoupper($fld->name)]=$fld;
- }
-
- $adors->MoveNext();
- }
- $adors->Close();
- }
- $false = false;
- return empty($arr) ? $false : $arr;
- }
-
-
-
-
- /* returns queryID or false */
- function _query($sql,$inputarr=false)
- {
-
- $dbc = $this->_connectionID;
- $false = false;
-
- // return rs
- if ($inputarr) {
-
- if (!empty($this->charPage))
- $oCmd = new COM('ADODB.Command',null,$this->charPage);
- else
- $oCmd = new COM('ADODB.Command');
- $oCmd->ActiveConnection = $dbc;
- $oCmd->CommandText = $sql;
- $oCmd->CommandType = 1;
-
- // Map by http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthcreateparam.asp
- // Check issue http://bugs.php.net/bug.php?id=40664 !!!
- foreach ($inputarr as $val) {
- $type = gettype($val);
- $len=strlen($val);
- if ($type == 'boolean')
- $this->adoParameterType = 11;
- else if ($type == 'integer')
- $this->adoParameterType = 3;
- else if ($type == 'double')
- $this->adoParameterType = 5;
- elseif ($type == 'string')
- $this->adoParameterType = 202;
- else if (($val === null) || (!defined($val)))
- $len=1;
- else
- $this->adoParameterType = 130;
-
- // name, type, direction 1 = input, len,
- $p = $oCmd->CreateParameter('name',$this->adoParameterType,1,$len,$val);
-
- $oCmd->Parameters->Append($p);
- }
- $p = false;
- $rs = $oCmd->Execute();
- $e = $dbc->Errors;
- if ($dbc->Errors->Count > 0) return $false;
- return $rs;
- }
-
- $rs = @$dbc->Execute($sql,$this->_affectedRows, $this->_execute_option);
-
- if ($dbc->Errors->Count > 0) return $false;
- if (! $rs) return $false;
-
- if ($rs->State == 0) {
- $true = true;
- return $true; // 0 = adStateClosed means no records returned
- }
- return $rs;
- }
-
-
- function BeginTrans()
- {
- if ($this->transOff) return true;
-
- if (isset($this->_thisTransactions))
- if (!$this->_thisTransactions) return false;
- else {
- $o = $this->_connectionID->Properties("Transaction DDL");
- $this->_thisTransactions = $o ? true : false;
- if (!$o) return false;
- }
- @$this->_connectionID->BeginTrans();
- $this->transCnt += 1;
- return true;
- }
-
- function CommitTrans($ok=true)
- {
- if (!$ok) return $this->RollbackTrans();
- if ($this->transOff) return true;
-
- @$this->_connectionID->CommitTrans();
- if ($this->transCnt) @$this->transCnt -= 1;
- return true;
- }
- function RollbackTrans() {
- if ($this->transOff) return true;
- @$this->_connectionID->RollbackTrans();
- if ($this->transCnt) @$this->transCnt -= 1;
- return true;
- }
-
- /* Returns: the last error message from previous database operation */
-
- function ErrorMsg()
- {
- if (!$this->_connectionID) return "No connection established";
- $errc = $this->_connectionID->Errors;
- if (!$errc) return "No Errors object found";
- if ($errc->Count == 0) return '';
- $err = $errc->Item($errc->Count-1);
- return $err->Description;
- }
-
- function ErrorNo()
- {
- $errc = $this->_connectionID->Errors;
- if ($errc->Count == 0) return 0;
- $err = $errc->Item($errc->Count-1);
- return $err->NativeError;
- }
-
- // returns true or false
- function _close()
- {
- if ($this->_connectionID) $this->_connectionID->Close();
- $this->_connectionID = false;
- return true;
- }
-
-
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordSet_ado extends ADORecordSet {
-
- var $bind = false;
- var $databaseType = "ado";
- var $dataProvider = "ado";
- var $_tarr = false; // caches the types
- var $_flds; // and field objects
- var $canSeek = true;
- var $hideErrors = true;
-
- function __construct($id,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- $this->fetchMode = $mode;
- $this->ADORecordSet($id,$mode);
- }
-
-
- // returns the field object
- function FetchField($fieldOffset = -1) {
- $off=$fieldOffset+1; // offsets begin at 1
-
- $o= new ADOFieldObject();
- $rs = $this->_queryID;
- $f = $rs->Fields($fieldOffset);
- $o->name = $f->Name;
- $t = $f->Type;
- $o->type = $this->MetaType($t);
- $o->max_length = $f->DefinedSize;
- $o->ado_type = $t;
-
- //print "off=$off name=$o->name type=$o->type len=$o->max_length
";
- return $o;
- }
-
- /* Use associative array to get fields array */
- function Fields($colname)
- {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) return $this->fields[$colname];
- if (!$this->bind) {
- $this->bind = array();
- for ($i=0; $i < $this->_numOfFields; $i++) {
- $o = $this->FetchField($i);
- $this->bind[strtoupper($o->name)] = $i;
- }
- }
-
- return $this->fields[$this->bind[strtoupper($colname)]];
- }
-
-
- function _initrs()
- {
- $rs = $this->_queryID;
- $this->_numOfRows = $rs->RecordCount;
-
- $f = $rs->Fields;
- $this->_numOfFields = $f->Count;
- }
-
-
- // should only be used to move forward as we normally use forward-only cursors
- function _seek($row)
- {
- $rs = $this->_queryID;
- // absoluteposition doesn't work -- my maths is wrong ?
- // $rs->AbsolutePosition->$row-2;
- // return true;
- if ($this->_currentRow > $row) return false;
- @$rs->Move((integer)$row - $this->_currentRow-1); //adBookmarkFirst
- return true;
- }
-
-/*
- OLEDB types
-
- enum DBTYPEENUM
- { DBTYPE_EMPTY = 0,
- DBTYPE_NULL = 1,
- DBTYPE_I2 = 2,
- DBTYPE_I4 = 3,
- DBTYPE_R4 = 4,
- DBTYPE_R8 = 5,
- DBTYPE_CY = 6,
- DBTYPE_DATE = 7,
- DBTYPE_BSTR = 8,
- DBTYPE_IDISPATCH = 9,
- DBTYPE_ERROR = 10,
- DBTYPE_BOOL = 11,
- DBTYPE_VARIANT = 12,
- DBTYPE_IUNKNOWN = 13,
- DBTYPE_DECIMAL = 14,
- DBTYPE_UI1 = 17,
- DBTYPE_ARRAY = 0x2000,
- DBTYPE_BYREF = 0x4000,
- DBTYPE_I1 = 16,
- DBTYPE_UI2 = 18,
- DBTYPE_UI4 = 19,
- DBTYPE_I8 = 20,
- DBTYPE_UI8 = 21,
- DBTYPE_GUID = 72,
- DBTYPE_VECTOR = 0x1000,
- DBTYPE_RESERVED = 0x8000,
- DBTYPE_BYTES = 128,
- DBTYPE_STR = 129,
- DBTYPE_WSTR = 130,
- DBTYPE_NUMERIC = 131,
- DBTYPE_UDT = 132,
- DBTYPE_DBDATE = 133,
- DBTYPE_DBTIME = 134,
- DBTYPE_DBTIMESTAMP = 135
-
- ADO Types
-
- adEmpty = 0,
- adTinyInt = 16,
- adSmallInt = 2,
- adInteger = 3,
- adBigInt = 20,
- adUnsignedTinyInt = 17,
- adUnsignedSmallInt = 18,
- adUnsignedInt = 19,
- adUnsignedBigInt = 21,
- adSingle = 4,
- adDouble = 5,
- adCurrency = 6,
- adDecimal = 14,
- adNumeric = 131,
- adBoolean = 11,
- adError = 10,
- adUserDefined = 132,
- adVariant = 12,
- adIDispatch = 9,
- adIUnknown = 13,
- adGUID = 72,
- adDate = 7,
- adDBDate = 133,
- adDBTime = 134,
- adDBTimeStamp = 135,
- adBSTR = 8,
- adChar = 129,
- adVarChar = 200,
- adLongVarChar = 201,
- adWChar = 130,
- adVarWChar = 202,
- adLongVarWChar = 203,
- adBinary = 128,
- adVarBinary = 204,
- adLongVarBinary = 205,
- adChapter = 136,
- adFileTime = 64,
- adDBFileTime = 137,
- adPropVariant = 138,
- adVarNumeric = 139
-*/
- function MetaType($t,$len=-1,$fieldobj=false)
- {
- if (is_object($t)) {
- $fieldobj = $t;
- $t = $fieldobj->type;
- $len = $fieldobj->max_length;
- }
-
- if (!is_numeric($t)) return $t;
-
- switch ($t) {
- case 0:
- case 12: // variant
- case 8: // bstr
- case 129: //char
- case 130: //wc
- case 200: // varc
- case 202:// varWC
- case 128: // bin
- case 204: // varBin
- case 72: // guid
- if ($len <= $this->blobSize) return 'C';
-
- case 201:
- case 203:
- return 'X';
- case 128:
- case 204:
- case 205:
- return 'B';
- case 7:
- case 133: return 'D';
-
- case 134:
- case 135: return 'T';
-
- case 11: return 'L';
-
- case 16:// adTinyInt = 16,
- case 2://adSmallInt = 2,
- case 3://adInteger = 3,
- case 4://adBigInt = 20,
- case 17://adUnsignedTinyInt = 17,
- case 18://adUnsignedSmallInt = 18,
- case 19://adUnsignedInt = 19,
- case 20://adUnsignedBigInt = 21,
- return 'I';
- default: return 'N';
- }
- }
-
- // time stamp not supported yet
- function _fetch()
- {
- $rs = $this->_queryID;
- if (!$rs or $rs->EOF) {
- $this->fields = false;
- return false;
- }
- $this->fields = array();
-
- if (!$this->_tarr) {
- $tarr = array();
- $flds = array();
- for ($i=0,$max = $this->_numOfFields; $i < $max; $i++) {
- $f = $rs->Fields($i);
- $flds[] = $f;
- $tarr[] = $f->Type;
- }
- // bind types and flds only once
- $this->_tarr = $tarr;
- $this->_flds = $flds;
- }
- $t = reset($this->_tarr);
- $f = reset($this->_flds);
-
- if ($this->hideErrors) $olde = error_reporting(E_ERROR|E_CORE_ERROR);// sometimes $f->value be null
- for ($i=0,$max = $this->_numOfFields; $i < $max; $i++) {
- //echo "",$t,' ';var_dump($f->value); echo '
';
- switch($t) {
- case 135: // timestamp
- if (!strlen((string)$f->value)) $this->fields[] = false;
- else {
- if (!is_numeric($f->value)) # $val = variant_date_to_timestamp($f->value);
- // VT_DATE stores dates as (float) fractional days since 1899/12/30 00:00:00
- $val=(float) variant_cast($f->value,VT_R8)*3600*24-2209161600;
- else
- $val = $f->value;
- $this->fields[] = adodb_date('Y-m-d H:i:s',$val);
- }
- break;
- case 133:// A date value (yyyymmdd)
- if ($val = $f->value) {
- $this->fields[] = substr($val,0,4).'-'.substr($val,4,2).'-'.substr($val,6,2);
- } else
- $this->fields[] = false;
- break;
- case 7: // adDate
- if (!strlen((string)$f->value)) $this->fields[] = false;
- else {
- if (!is_numeric($f->value)) $val = variant_date_to_timestamp($f->value);
- else $val = $f->value;
-
- if (($val % 86400) == 0) $this->fields[] = adodb_date('Y-m-d',$val);
- else $this->fields[] = adodb_date('Y-m-d H:i:s',$val);
- }
- break;
- case 1: // null
- $this->fields[] = false;
- break;
- case 6: // currency is not supported properly;
- ADOConnection::outp( ''.$f->Name.': currency type not supported by PHP');
- $this->fields[] = (float) $f->value;
- break;
- case 11: //BIT;
- $val = "";
- if(is_bool($f->value)) {
- if($f->value==true) $val = 1;
- else $val = 0;
- }
- if(is_null($f->value)) $val = null;
-
- $this->fields[] = $val;
- break;
- default:
- $this->fields[] = $f->value;
- break;
- }
- //print " $f->value $t, ";
- $f = next($this->_flds);
- $t = next($this->_tarr);
- } // for
- if ($this->hideErrors) error_reporting($olde);
- @$rs->MoveNext(); // @ needed for some versions of PHP!
-
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
- $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
- }
- return true;
- }
-
- function NextRecordSet()
- {
- $rs = $this->_queryID;
- $this->_queryID = $rs->NextRecordSet();
- //$this->_queryID = $this->_QueryId->NextRecordSet();
- if ($this->_queryID == null) return false;
-
- $this->_currentRow = -1;
- $this->_currentPage = -1;
- $this->bind = false;
- $this->fields = false;
- $this->_flds = false;
- $this->_tarr = false;
-
- $this->_inited = false;
- $this->Init();
- return true;
- }
-
- function _close() {
- $this->_flds = false;
- @$this->_queryID->Close();// by Pete Dishman (peterd@telephonetics.co.uk)
- $this->_queryID = false;
- }
-
-}
-
-?>
diff --git a/src/adodb5/drivers/adodb-ado5.inc.php b/src/adodb5/drivers/adodb-ado5.inc.php
deleted file mode 100644
index 1d00451c..00000000
--- a/src/adodb5/drivers/adodb-ado5.inc.php
+++ /dev/null
@@ -1,704 +0,0 @@
-_affectedRows = new VARIANT;
- }
-
- function ServerInfo()
- {
- if (!empty($this->_connectionID)) $desc = $this->_connectionID->provider;
- return array('description' => $desc, 'version' => '');
- }
-
- function _affectedrows()
- {
- if (PHP_VERSION >= 5) return $this->_affectedRows;
-
- return $this->_affectedRows->value;
- }
-
- // you can also pass a connection string like this:
- //
- // $DB->Connect('USER ID=sa;PASSWORD=pwd;SERVER=mangrove;DATABASE=ai',false,false,'SQLOLEDB');
- function _connect($argHostname, $argUsername, $argPassword,$argDBorProvider, $argProvider= '')
- {
- // two modes
- // - if $argProvider is empty, we assume that $argDBorProvider holds provider -- this is for backward compat
- // - if $argProvider is not empty, then $argDBorProvider holds db
-
-
- if ($argProvider) {
- $argDatabasename = $argDBorProvider;
- } else {
- $argDatabasename = '';
- if ($argDBorProvider) $argProvider = $argDBorProvider;
- else if (stripos($argHostname,'PROVIDER') === false) /* full conn string is not in $argHostname */
- $argProvider = 'MSDASQL';
- }
-
-
- try {
- $u = 'UID';
- $p = 'PWD';
-
- if (!empty($this->charPage))
- $dbc = new COM('ADODB.Connection',null,$this->charPage);
- else
- $dbc = new COM('ADODB.Connection');
-
- if (! $dbc) return false;
-
- /* special support if provider is mssql or access */
- if ($argProvider=='mssql') {
- $u = 'User Id'; //User parameter name for OLEDB
- $p = 'Password';
- $argProvider = "SQLOLEDB"; // SQL Server Provider
-
- // not yet
- //if ($argDatabasename) $argHostname .= ";Initial Catalog=$argDatabasename";
-
- //use trusted conection for SQL if username not specified
- if (!$argUsername) $argHostname .= ";Trusted_Connection=Yes";
- } else if ($argProvider=='access')
- $argProvider = "Microsoft.Jet.OLEDB.4.0"; // Microsoft Jet Provider
-
- if ($argProvider) $dbc->Provider = $argProvider;
-
- if ($argProvider) $argHostname = "PROVIDER=$argProvider;DRIVER={SQL Server};SERVER=$argHostname";
-
-
- if ($argDatabasename) $argHostname .= ";DATABASE=$argDatabasename";
- if ($argUsername) $argHostname .= ";$u=$argUsername";
- if ($argPassword)$argHostname .= ";$p=$argPassword";
-
- if ($this->debug) ADOConnection::outp( "Host=".$argHostname."
\n version=$dbc->version");
- // @ added below for php 4.0.1 and earlier
- @$dbc->Open((string) $argHostname);
-
- $this->_connectionID = $dbc;
-
- $dbc->CursorLocation = $this->_cursor_location;
- return $dbc->State > 0;
- } catch (exception $e) {
- if ($this->debug);echo "",$argHostname,"\n",$e,"
\n";
- }
-
- return false;
- }
-
- // returns true or false
- function _pconnect($argHostname, $argUsername, $argPassword, $argProvider='MSDASQL')
- {
- return $this->_connect($argHostname,$argUsername,$argPassword,$argProvider);
- }
-
-/*
- adSchemaCatalogs = 1,
- adSchemaCharacterSets = 2,
- adSchemaCollations = 3,
- adSchemaColumns = 4,
- adSchemaCheckConstraints = 5,
- adSchemaConstraintColumnUsage = 6,
- adSchemaConstraintTableUsage = 7,
- adSchemaKeyColumnUsage = 8,
- adSchemaReferentialContraints = 9,
- adSchemaTableConstraints = 10,
- adSchemaColumnsDomainUsage = 11,
- adSchemaIndexes = 12,
- adSchemaColumnPrivileges = 13,
- adSchemaTablePrivileges = 14,
- adSchemaUsagePrivileges = 15,
- adSchemaProcedures = 16,
- adSchemaSchemata = 17,
- adSchemaSQLLanguages = 18,
- adSchemaStatistics = 19,
- adSchemaTables = 20,
- adSchemaTranslations = 21,
- adSchemaProviderTypes = 22,
- adSchemaViews = 23,
- adSchemaViewColumnUsage = 24,
- adSchemaViewTableUsage = 25,
- adSchemaProcedureParameters = 26,
- adSchemaForeignKeys = 27,
- adSchemaPrimaryKeys = 28,
- adSchemaProcedureColumns = 29,
- adSchemaDBInfoKeywords = 30,
- adSchemaDBInfoLiterals = 31,
- adSchemaCubes = 32,
- adSchemaDimensions = 33,
- adSchemaHierarchies = 34,
- adSchemaLevels = 35,
- adSchemaMeasures = 36,
- adSchemaProperties = 37,
- adSchemaMembers = 38
-
-*/
-
- function MetaTables()
- {
- $arr= array();
- $dbc = $this->_connectionID;
-
- $adors=@$dbc->OpenSchema(20);//tables
- if ($adors){
- $f = $adors->Fields(2);//table/view name
- $t = $adors->Fields(3);//table type
- while (!$adors->EOF){
- $tt=substr($t->value,0,6);
- if ($tt!='SYSTEM' && $tt !='ACCESS')
- $arr[]=$f->value;
- //print $f->value . ' ' . $t->value.'
';
- $adors->MoveNext();
- }
- $adors->Close();
- }
-
- return $arr;
- }
-
- function MetaColumns($table, $normalize=true)
- {
- $table = strtoupper($table);
- $arr= array();
- $dbc = $this->_connectionID;
-
- $adors=@$dbc->OpenSchema(4);//tables
-
- if ($adors){
- $t = $adors->Fields(2);//table/view name
- while (!$adors->EOF){
-
-
- if (strtoupper($t->Value) == $table) {
-
- $fld = new ADOFieldObject();
- $c = $adors->Fields(3);
- $fld->name = $c->Value;
- $fld->type = 'CHAR'; // cannot discover type in ADO!
- $fld->max_length = -1;
- $arr[strtoupper($fld->name)]=$fld;
- }
-
- $adors->MoveNext();
- }
- $adors->Close();
- }
-
- return $arr;
- }
-
- /* returns queryID or false */
- function _query($sql,$inputarr=false)
- {
- try { // In PHP5, all COM errors are exceptions, so to maintain old behaviour...
-
- $dbc = $this->_connectionID;
-
- // return rs
-
- $false = false;
-
- if ($inputarr) {
-
- if (!empty($this->charPage))
- $oCmd = new COM('ADODB.Command',null,$this->charPage);
- else
- $oCmd = new COM('ADODB.Command');
- $oCmd->ActiveConnection = $dbc;
- $oCmd->CommandText = $sql;
- $oCmd->CommandType = 1;
-
- foreach ($inputarr as $val) {
- $type = gettype($val);
- $len=strlen($val);
- if ($type == 'boolean')
- $this->adoParameterType = 11;
- else if ($type == 'integer')
- $this->adoParameterType = 3;
- else if ($type == 'double')
- $this->adoParameterType = 5;
- elseif ($type == 'string')
- $this->adoParameterType = 202;
- else if (($val === null) || (!defined($val)))
- $len=1;
- else
- $this->adoParameterType = 130;
-
- // name, type, direction 1 = input, len,
- $p = $oCmd->CreateParameter('name',$this->adoParameterType,1,$len,$val);
-
- $oCmd->Parameters->Append($p);
- }
-
- $p = false;
- $rs = $oCmd->Execute();
- $e = $dbc->Errors;
- if ($dbc->Errors->Count > 0) return $false;
- return $rs;
- }
-
- $rs = @$dbc->Execute($sql,$this->_affectedRows, $this->_execute_option);
-
- if ($dbc->Errors->Count > 0) return $false;
- if (! $rs) return $false;
-
- if ($rs->State == 0) {
- $true = true;
- return $true; // 0 = adStateClosed means no records returned
- }
- return $rs;
-
- } catch (exception $e) {
-
- }
- return $false;
- }
-
-
- function BeginTrans()
- {
- if ($this->transOff) return true;
-
- if (isset($this->_thisTransactions))
- if (!$this->_thisTransactions) return false;
- else {
- $o = $this->_connectionID->Properties("Transaction DDL");
- $this->_thisTransactions = $o ? true : false;
- if (!$o) return false;
- }
- @$this->_connectionID->BeginTrans();
- $this->transCnt += 1;
- return true;
- }
- function CommitTrans($ok=true)
- {
- if (!$ok) return $this->RollbackTrans();
- if ($this->transOff) return true;
-
- @$this->_connectionID->CommitTrans();
- if ($this->transCnt) @$this->transCnt -= 1;
- return true;
- }
- function RollbackTrans() {
- if ($this->transOff) return true;
- @$this->_connectionID->RollbackTrans();
- if ($this->transCnt) @$this->transCnt -= 1;
- return true;
- }
-
- /* Returns: the last error message from previous database operation */
-
- function ErrorMsg()
- {
- if (!$this->_connectionID) return "No connection established";
- $errmsg = '';
-
- try {
- $errc = $this->_connectionID->Errors;
- if (!$errc) return "No Errors object found";
- if ($errc->Count == 0) return '';
- $err = $errc->Item($errc->Count-1);
- $errmsg = $err->Description;
- }catch(exception $e) {
- }
- return $errmsg;
- }
-
- function ErrorNo()
- {
- $errc = $this->_connectionID->Errors;
- if ($errc->Count == 0) return 0;
- $err = $errc->Item($errc->Count-1);
- return $err->NativeError;
- }
-
- // returns true or false
- function _close()
- {
- if ($this->_connectionID) $this->_connectionID->Close();
- $this->_connectionID = false;
- return true;
- }
-
-
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordSet_ado extends ADORecordSet {
-
- var $bind = false;
- var $databaseType = "ado";
- var $dataProvider = "ado";
- var $_tarr = false; // caches the types
- var $_flds; // and field objects
- var $canSeek = true;
- var $hideErrors = true;
-
- function __construct($id,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- $this->fetchMode = $mode;
- $this->ADORecordSet($id,$mode);
- }
-
-
- // returns the field object
- function FetchField($fieldOffset = -1) {
- $off=$fieldOffset+1; // offsets begin at 1
-
- $o= new ADOFieldObject();
- $rs = $this->_queryID;
- if (!$rs) return false;
-
- $f = $rs->Fields($fieldOffset);
- $o->name = $f->Name;
- $t = $f->Type;
- $o->type = $this->MetaType($t);
- $o->max_length = $f->DefinedSize;
- $o->ado_type = $t;
-
-
- //print "off=$off name=$o->name type=$o->type len=$o->max_length
";
- return $o;
- }
-
- /* Use associative array to get fields array */
- function Fields($colname)
- {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) return $this->fields[$colname];
- if (!$this->bind) {
- $this->bind = array();
- for ($i=0; $i < $this->_numOfFields; $i++) {
- $o = $this->FetchField($i);
- $this->bind[strtoupper($o->name)] = $i;
- }
- }
-
- return $this->fields[$this->bind[strtoupper($colname)]];
- }
-
-
- function _initrs()
- {
- $rs = $this->_queryID;
-
- try {
- $this->_numOfRows = $rs->RecordCount;
- } catch (Exception $e) {
- $this->_numOfRows = -1;
- }
- $f = $rs->Fields;
- $this->_numOfFields = $f->Count;
- }
-
-
- // should only be used to move forward as we normally use forward-only cursors
- function _seek($row)
- {
- $rs = $this->_queryID;
- // absoluteposition doesn't work -- my maths is wrong ?
- // $rs->AbsolutePosition->$row-2;
- // return true;
- if ($this->_currentRow > $row) return false;
- @$rs->Move((integer)$row - $this->_currentRow-1); //adBookmarkFirst
- return true;
- }
-
-/*
- OLEDB types
-
- enum DBTYPEENUM
- { DBTYPE_EMPTY = 0,
- DBTYPE_NULL = 1,
- DBTYPE_I2 = 2,
- DBTYPE_I4 = 3,
- DBTYPE_R4 = 4,
- DBTYPE_R8 = 5,
- DBTYPE_CY = 6,
- DBTYPE_DATE = 7,
- DBTYPE_BSTR = 8,
- DBTYPE_IDISPATCH = 9,
- DBTYPE_ERROR = 10,
- DBTYPE_BOOL = 11,
- DBTYPE_VARIANT = 12,
- DBTYPE_IUNKNOWN = 13,
- DBTYPE_DECIMAL = 14,
- DBTYPE_UI1 = 17,
- DBTYPE_ARRAY = 0x2000,
- DBTYPE_BYREF = 0x4000,
- DBTYPE_I1 = 16,
- DBTYPE_UI2 = 18,
- DBTYPE_UI4 = 19,
- DBTYPE_I8 = 20,
- DBTYPE_UI8 = 21,
- DBTYPE_GUID = 72,
- DBTYPE_VECTOR = 0x1000,
- DBTYPE_RESERVED = 0x8000,
- DBTYPE_BYTES = 128,
- DBTYPE_STR = 129,
- DBTYPE_WSTR = 130,
- DBTYPE_NUMERIC = 131,
- DBTYPE_UDT = 132,
- DBTYPE_DBDATE = 133,
- DBTYPE_DBTIME = 134,
- DBTYPE_DBTIMESTAMP = 135
-
- ADO Types
-
- adEmpty = 0,
- adTinyInt = 16,
- adSmallInt = 2,
- adInteger = 3,
- adBigInt = 20,
- adUnsignedTinyInt = 17,
- adUnsignedSmallInt = 18,
- adUnsignedInt = 19,
- adUnsignedBigInt = 21,
- adSingle = 4,
- adDouble = 5,
- adCurrency = 6,
- adDecimal = 14,
- adNumeric = 131,
- adBoolean = 11,
- adError = 10,
- adUserDefined = 132,
- adVariant = 12,
- adIDispatch = 9,
- adIUnknown = 13,
- adGUID = 72,
- adDate = 7,
- adDBDate = 133,
- adDBTime = 134,
- adDBTimeStamp = 135,
- adBSTR = 8,
- adChar = 129,
- adVarChar = 200,
- adLongVarChar = 201,
- adWChar = 130,
- adVarWChar = 202,
- adLongVarWChar = 203,
- adBinary = 128,
- adVarBinary = 204,
- adLongVarBinary = 205,
- adChapter = 136,
- adFileTime = 64,
- adDBFileTime = 137,
- adPropVariant = 138,
- adVarNumeric = 139
-*/
- function MetaType($t,$len=-1,$fieldobj=false)
- {
- if (is_object($t)) {
- $fieldobj = $t;
- $t = $fieldobj->type;
- $len = $fieldobj->max_length;
- }
-
- if (!is_numeric($t)) return $t;
-
- switch ($t) {
- case 0:
- case 12: // variant
- case 8: // bstr
- case 129: //char
- case 130: //wc
- case 200: // varc
- case 202:// varWC
- case 128: // bin
- case 204: // varBin
- case 72: // guid
- if ($len <= $this->blobSize) return 'C';
-
- case 201:
- case 203:
- return 'X';
- case 128:
- case 204:
- case 205:
- return 'B';
- case 7:
- case 133: return 'D';
-
- case 134:
- case 135: return 'T';
-
- case 11: return 'L';
-
- case 16:// adTinyInt = 16,
- case 2://adSmallInt = 2,
- case 3://adInteger = 3,
- case 4://adBigInt = 20,
- case 17://adUnsignedTinyInt = 17,
- case 18://adUnsignedSmallInt = 18,
- case 19://adUnsignedInt = 19,
- case 20://adUnsignedBigInt = 21,
- return 'I';
- default: return 'N';
- }
- }
-
- // time stamp not supported yet
- function _fetch()
- {
- $rs = $this->_queryID;
- if (!$rs or $rs->EOF) {
- $this->fields = false;
- return false;
- }
- $this->fields = array();
-
- if (!$this->_tarr) {
- $tarr = array();
- $flds = array();
- for ($i=0,$max = $this->_numOfFields; $i < $max; $i++) {
- $f = $rs->Fields($i);
- $flds[] = $f;
- $tarr[] = $f->Type;
- }
- // bind types and flds only once
- $this->_tarr = $tarr;
- $this->_flds = $flds;
- }
- $t = reset($this->_tarr);
- $f = reset($this->_flds);
-
- if ($this->hideErrors) $olde = error_reporting(E_ERROR|E_CORE_ERROR);// sometimes $f->value be null
- for ($i=0,$max = $this->_numOfFields; $i < $max; $i++) {
- //echo "",$t,' ';var_dump($f->value); echo '
';
- switch($t) {
- case 135: // timestamp
- if (!strlen((string)$f->value)) $this->fields[] = false;
- else {
- if (!is_numeric($f->value)) # $val = variant_date_to_timestamp($f->value);
- // VT_DATE stores dates as (float) fractional days since 1899/12/30 00:00:00
- $val= (float) variant_cast($f->value,VT_R8)*3600*24-2209161600;
- else
- $val = $f->value;
- $this->fields[] = adodb_date('Y-m-d H:i:s',$val);
- }
- break;
- case 133:// A date value (yyyymmdd)
- if ($val = $f->value) {
- $this->fields[] = substr($val,0,4).'-'.substr($val,4,2).'-'.substr($val,6,2);
- } else
- $this->fields[] = false;
- break;
- case 7: // adDate
- if (!strlen((string)$f->value)) $this->fields[] = false;
- else {
- if (!is_numeric($f->value)) $val = variant_date_to_timestamp($f->value);
- else $val = $f->value;
-
- if (($val % 86400) == 0) $this->fields[] = adodb_date('Y-m-d',$val);
- else $this->fields[] = adodb_date('Y-m-d H:i:s',$val);
- }
- break;
- case 1: // null
- $this->fields[] = false;
- break;
- case 6: // currency is not supported properly;
- ADOConnection::outp( ''.$f->Name.': currency type not supported by PHP');
- $this->fields[] = (float) $f->value;
- break;
- case 11: //BIT;
- $val = "";
- if(is_bool($f->value)) {
- if($f->value==true) $val = 1;
- else $val = 0;
- }
- if(is_null($f->value)) $val = null;
-
- $this->fields[] = $val;
- break;
- default:
- $this->fields[] = $f->value;
- break;
- }
- //print " $f->value $t, ";
- $f = next($this->_flds);
- $t = next($this->_tarr);
- } // for
- if ($this->hideErrors) error_reporting($olde);
- @$rs->MoveNext(); // @ needed for some versions of PHP!
-
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
- $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
- }
- return true;
- }
-
- function NextRecordSet()
- {
- $rs = $this->_queryID;
- $this->_queryID = $rs->NextRecordSet();
- //$this->_queryID = $this->_QueryId->NextRecordSet();
- if ($this->_queryID == null) return false;
-
- $this->_currentRow = -1;
- $this->_currentPage = -1;
- $this->bind = false;
- $this->fields = false;
- $this->_flds = false;
- $this->_tarr = false;
-
- $this->_inited = false;
- $this->Init();
- return true;
- }
-
- function _close() {
- $this->_flds = false;
- try {
- @$this->_queryID->Close();// by Pete Dishman (peterd@telephonetics.co.uk)
- } catch (Exception $e) {
- }
- $this->_queryID = false;
- }
-
-}
-
-?>
diff --git a/src/adodb5/drivers/adodb-ado_access.inc.php b/src/adodb5/drivers/adodb-ado_access.inc.php
deleted file mode 100644
index bb449f70..00000000
--- a/src/adodb5/drivers/adodb-ado_access.inc.php
+++ /dev/null
@@ -1,54 +0,0 @@
-= 5) include(ADODB_DIR."/drivers/adodb-ado5.inc.php");
- else include(ADODB_DIR."/drivers/adodb-ado.inc.php");
-}
-
-class ADODB_ado_access extends ADODB_ado {
- var $databaseType = 'ado_access';
- var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE
- var $fmtDate = "#Y-m-d#";
- var $fmtTimeStamp = "#Y-m-d h:i:sA#";// note no comma
- var $sysDate = "FORMAT(NOW,'yyyy-mm-dd')";
- var $sysTimeStamp = 'NOW';
- var $upperCase = 'ucase';
-
- function __construct()
- {
- $this->ADODB_ado();
- }
-
- /*function BeginTrans() { return false;}
-
- function CommitTrans() { return false;}
-
- function RollbackTrans() { return false;}*/
-
-}
-
-
-class ADORecordSet_ado_access extends ADORecordSet_ado {
-
- var $databaseType = "ado_access";
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_ado($id,$mode);
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-ado_mssql.inc.php b/src/adodb5/drivers/adodb-ado_mssql.inc.php
deleted file mode 100644
index 532e8e70..00000000
--- a/src/adodb5/drivers/adodb-ado_mssql.inc.php
+++ /dev/null
@@ -1,154 +0,0 @@
-= 5) include(ADODB_DIR."/drivers/adodb-ado5.inc.php");
- else include(ADODB_DIR."/drivers/adodb-ado.inc.php");
-}
-
-
-class ADODB_ado_mssql extends ADODB_ado {
- var $databaseType = 'ado_mssql';
- var $hasTop = 'top';
- var $hasInsertID = true;
- var $sysDate = 'convert(datetime,convert(char,GetDate(),102),102)';
- var $sysTimeStamp = 'GetDate()';
- var $leftOuter = '*=';
- var $rightOuter = '=*';
- var $ansiOuter = true; // for mssql7 or later
- var $substr = "substring";
- var $length = 'len';
- var $_dropSeqSQL = "drop table %s";
-
- //var $_inTransaction = 1; // always open recordsets, so no transaction problems.
-
- function __construct()
- {
- $this->ADODB_ado();
- }
-
- function _insertid()
- {
- return $this->GetOne('select SCOPE_IDENTITY()');
- }
-
- function _affectedrows()
- {
- return $this->GetOne('select @@rowcount');
- }
-
- function SetTransactionMode( $transaction_mode )
- {
- $this->_transmode = $transaction_mode;
- if (empty($transaction_mode)) {
- $this->Execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
- return;
- }
- if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
- $this->Execute("SET TRANSACTION ".$transaction_mode);
- }
-
- function qstr($s,$magic_quotes=false)
- {
- $s = ADOConnection::qstr($s, $magic_quotes);
- return str_replace("\0", "\\\\000", $s);
- }
-
- function MetaColumns($table, $normalize=true)
- {
- $table = strtoupper($table);
- $arr= array();
- $dbc = $this->_connectionID;
-
- $osoptions = array();
- $osoptions[0] = null;
- $osoptions[1] = null;
- $osoptions[2] = $table;
- $osoptions[3] = null;
-
- $adors=@$dbc->OpenSchema(4, $osoptions);//tables
-
- if ($adors){
- while (!$adors->EOF){
- $fld = new ADOFieldObject();
- $c = $adors->Fields(3);
- $fld->name = $c->Value;
- $fld->type = 'CHAR'; // cannot discover type in ADO!
- $fld->max_length = -1;
- $arr[strtoupper($fld->name)]=$fld;
-
- $adors->MoveNext();
- }
- $adors->Close();
- }
- $false = false;
- return empty($arr) ? $false : $arr;
- }
-
- function CreateSequence($seq='adodbseq',$start=1)
- {
-
- $this->Execute('BEGIN TRANSACTION adodbseq');
- $start -= 1;
- $this->Execute("create table $seq (id float(53))");
- $ok = $this->Execute("insert into $seq with (tablock,holdlock) values($start)");
- if (!$ok) {
- $this->Execute('ROLLBACK TRANSACTION adodbseq');
- return false;
- }
- $this->Execute('COMMIT TRANSACTION adodbseq');
- return true;
- }
-
- function GenID($seq='adodbseq',$start=1)
- {
- //$this->debug=1;
- $this->Execute('BEGIN TRANSACTION adodbseq');
- $ok = $this->Execute("update $seq with (tablock,holdlock) set id = id + 1");
- if (!$ok) {
- $this->Execute("create table $seq (id float(53))");
- $ok = $this->Execute("insert into $seq with (tablock,holdlock) values($start)");
- if (!$ok) {
- $this->Execute('ROLLBACK TRANSACTION adodbseq');
- return false;
- }
- $this->Execute('COMMIT TRANSACTION adodbseq');
- return $start;
- }
- $num = $this->GetOne("select id from $seq");
- $this->Execute('COMMIT TRANSACTION adodbseq');
- return $num;
-
- // in old implementation, pre 1.90, we returned GUID...
- //return $this->GetOne("SELECT CONVERT(varchar(255), NEWID()) AS 'Char'");
- }
-
- } // end class
-
- class ADORecordSet_ado_mssql extends ADORecordSet_ado {
-
- var $databaseType = 'ado_mssql';
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_ado($id,$mode);
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-ads.inc.php b/src/adodb5/drivers/adodb-ads.inc.php
deleted file mode 100644
index c59e6e4d..00000000
--- a/src/adodb5/drivers/adodb-ads.inc.php
+++ /dev/null
@@ -1,788 +0,0 @@
-_haserrorfunctions = ADODB_PHPVER >= 0x4050;
- $this->_has_stupid_odbc_fetch_api_change = ADODB_PHPVER >= 0x4200;
- }
-
- // returns true or false
- function _connect($argDSN, $argUsername, $argPassword, $argDatabasename)
- {
- if (!function_exists('ads_connect')) return null;
-
- if ($this->debug && $argDatabasename && $this->databaseType != 'vfp') {
- ADOConnection::outp("For Advantage Connect(), $argDatabasename is not used. Place dsn in 1st parameter.");
- }
- if ($this->curmode === false) $this->_connectionID = ads_connect($argDSN,$argUsername,$argPassword);
- else $this->_connectionID = ads_connect($argDSN,$argUsername,$argPassword,$this->curmode);
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- if (isset($this->connectStmt)) $this->Execute($this->connectStmt);
-
- return $this->_connectionID != false;
- }
-
- // returns true or false
- function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
- {
- if (!function_exists('ads_connect')) return null;
-
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- if ($this->debug && $argDatabasename) {
- ADOConnection::outp("For PConnect(), $argDatabasename is not used. Place dsn in 1st parameter.");
- }
- // print "dsn=$argDSN u=$argUsername p=$argPassword
"; flush();
- if ($this->curmode === false) $this->_connectionID = ads_connect($argDSN,$argUsername,$argPassword);
- else $this->_connectionID = ads_pconnect($argDSN,$argUsername,$argPassword,$this->curmode);
-
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- if ($this->_connectionID && $this->autoRollback) @ads_rollback($this->_connectionID);
- if (isset($this->connectStmt)) $this->Execute($this->connectStmt);
-
- return $this->_connectionID != false;
- }
-
- // returns the Server version and Description
- function ServerInfo()
- {
-
- if (!empty($this->host) && ADODB_PHPVER >= 0x4300) {
- $stmt = $this->Prepare('EXECUTE PROCEDURE sp_mgGetInstallInfo()');
- $res = $this->Execute($stmt);
- if(!$res)
- print $this->ErrorMsg();
- else{
- $ret["version"]= $res->fields[3];
- $ret["description"]="Advantage Database Server";
- return $ret;
- }
- }
- else {
- return ADOConnection::ServerInfo();
- }
- }
-
-
- // returns true or false
- function CreateSequence( $seqname,$start=1)
- {
- $res = $this->Execute("CREATE TABLE $seqname ( ID autoinc( 1 ) ) IN DATABASE");
- if(!$res){
- print $this->ErrorMsg();
- return false;
- }
- else
- return true;
-
- }
-
- // returns true or false
- function DropSequence($seqname)
- {
- $res = $this->Execute("DROP TABLE $seqname");
- if(!$res){
- print $this->ErrorMsg();
- return false;
- }
- else
- return true;
- }
-
-
- // returns the generated ID or false
- // checks if the table already exists, else creates the table and inserts a record into the table
- // and gets the ID number of the last inserted record.
- function GenID($seqname,$start=1)
- {
- $go = $this->Execute("select * from $seqname");
- if (!$go){
- $res = $this->Execute("CREATE TABLE $seqname ( ID autoinc( 1 ) ) IN DATABASE");
- if(!res){
- print $this->ErrorMsg();
- return false;
- }
- }
- $res = $this->Execute("INSERT INTO $seqname VALUES( DEFAULT )");
- if(!$res){
- print $this->ErrorMsg();
- return false;
- }
- else{
- $gen = $this->Execute("SELECT LastAutoInc( STATEMENT ) FROM system.iota");
- $ret = $gen->fields[0];
- return $ret;
- }
-
- }
-
-
-
-
- function ErrorMsg()
- {
- if ($this->_haserrorfunctions) {
- if ($this->_errorMsg !== false) return $this->_errorMsg;
- if (empty($this->_connectionID)) return @ads_errormsg();
- return @ads_errormsg($this->_connectionID);
- } else return ADOConnection::ErrorMsg();
- }
-
-
- function ErrorNo()
- {
-
- if ($this->_haserrorfunctions) {
- if ($this->_errorCode !== false) {
- // bug in 4.0.6, error number can be corrupted string (should be 6 digits)
- return (strlen($this->_errorCode)<=2) ? 0 : $this->_errorCode;
- }
-
- if (empty($this->_connectionID)) $e = @ads_error();
- else $e = @ads_error($this->_connectionID);
-
- // bug in 4.0.6, error number can be corrupted string (should be 6 digits)
- // so we check and patch
- if (strlen($e)<=2) return 0;
- return $e;
- } else return ADOConnection::ErrorNo();
- }
-
-
-
- function BeginTrans()
- {
- if (!$this->hasTransactions) return false;
- if ($this->transOff) return true;
- $this->transCnt += 1;
- $this->_autocommit = false;
- return ads_autocommit($this->_connectionID,false);
- }
-
- function CommitTrans($ok=true)
- {
- if ($this->transOff) return true;
- if (!$ok) return $this->RollbackTrans();
- if ($this->transCnt) $this->transCnt -= 1;
- $this->_autocommit = true;
- $ret = ads_commit($this->_connectionID);
- ads_autocommit($this->_connectionID,true);
- return $ret;
- }
-
- function RollbackTrans()
- {
- if ($this->transOff) return true;
- if ($this->transCnt) $this->transCnt -= 1;
- $this->_autocommit = true;
- $ret = ads_rollback($this->_connectionID);
- ads_autocommit($this->_connectionID,true);
- return $ret;
- }
-
-
- // Returns tables,Views or both on succesfull execution. Returns
- // tables by default on succesfull execustion.
- function &MetaTables($ttype)
- {
- $recordSet1 = $this->Execute("select * from system.tables");
- if(!$recordSet1){
- print $this->ErrorMsg();
- return false;
- }
- $recordSet2 = $this->Execute("select * from system.views");
- if(!$recordSet2){
- print $this->ErrorMsg();
- return false;
- }
- $i=0;
- while (!$recordSet1->EOF){
- $arr["$i"] = $recordSet1->fields[0];
- $recordSet1->MoveNext();
- $i=$i+1;
- }
- if($ttype=='FALSE'){
- while (!$recordSet2->EOF){
- $arr["$i"] = $recordSet2->fields[0];
- $recordSet2->MoveNext();
- $i=$i+1;
- }
- return $arr;
- }
- elseif($ttype=='VIEWS'){
- while (!$recordSet2->EOF){
- $arrV["$i"] = $recordSet2->fields[0];
- $recordSet2->MoveNext();
- $i=$i+1;
- }
- return $arrV;
- }
- else{
- return $arr;
- }
-
- }
-
- function &MetaPrimaryKeys($table)
- {
- $recordSet = $this->Execute("select table_primary_key from system.tables where name='$table'");
- if(!$recordSet){
- print $this->ErrorMsg();
- return false;
- }
- $i=0;
- while (!$recordSet->EOF){
- $arr["$i"] = $recordSet->fields[0];
- $recordSet->MoveNext();
- $i=$i+1;
- }
- return $arr;
- }
-
-/*
-See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcdatetime_data_type_changes.asp
-/ SQL data type codes /
-#define SQL_UNKNOWN_TYPE 0
-#define SQL_CHAR 1
-#define SQL_NUMERIC 2
-#define SQL_DECIMAL 3
-#define SQL_INTEGER 4
-#define SQL_SMALLINT 5
-#define SQL_FLOAT 6
-#define SQL_REAL 7
-#define SQL_DOUBLE 8
-#if (ODBCVER >= 0x0300)
-#define SQL_DATETIME 9
-#endif
-#define SQL_VARCHAR 12
-
-
-/ One-parameter shortcuts for date/time data types /
-#if (ODBCVER >= 0x0300)
-#define SQL_TYPE_DATE 91
-#define SQL_TYPE_TIME 92
-#define SQL_TYPE_TIMESTAMP 93
-
-#define SQL_UNICODE (-95)
-#define SQL_UNICODE_VARCHAR (-96)
-#define SQL_UNICODE_LONGVARCHAR (-97)
-*/
- function ODBCTypes($t)
- {
- switch ((integer)$t) {
- case 1:
- case 12:
- case 0:
- case -95:
- case -96:
- return 'C';
- case -97:
- case -1: //text
- return 'X';
- case -4: //image
- return 'B';
-
- case 9:
- case 91:
- return 'D';
-
- case 10:
- case 11:
- case 92:
- case 93:
- return 'T';
-
- case 4:
- case 5:
- case -6:
- return 'I';
-
- case -11: // uniqidentifier
- return 'R';
- case -7: //bit
- return 'L';
-
- default:
- return 'N';
- }
- }
-
- function &MetaColumns($table)
- {
- global $ADODB_FETCH_MODE;
-
- $false = false;
- if ($this->uCaseTables) $table = strtoupper($table);
- $schema = '';
- $this->_findschema($table,$schema);
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
-
- /*if (false) { // after testing, confirmed that the following does not work becoz of a bug
- $qid2 = ads_tables($this->_connectionID);
- $rs = new ADORecordSet_ads($qid2);
- $ADODB_FETCH_MODE = $savem;
- if (!$rs) return false;
- $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
- $rs->_fetch();
-
- while (!$rs->EOF) {
- if ($table == strtoupper($rs->fields[2])) {
- $q = $rs->fields[0];
- $o = $rs->fields[1];
- break;
- }
- $rs->MoveNext();
- }
- $rs->Close();
-
- $qid = ads_columns($this->_connectionID,$q,$o,strtoupper($table),'%');
- } */
-
- switch ($this->databaseType) {
- case 'access':
- case 'vfp':
- $qid = ads_columns($this->_connectionID);#,'%','',strtoupper($table),'%');
- break;
-
-
- case 'db2':
- $colname = "%";
- $qid = ads_columns($this->_connectionID, "", $schema, $table, $colname);
- break;
-
- default:
- $qid = @ads_columns($this->_connectionID,'%','%',strtoupper($table),'%');
- if (empty($qid)) $qid = ads_columns($this->_connectionID);
- break;
- }
- if (empty($qid)) return $false;
-
- $rs = new ADORecordSet_ads($qid);
- $ADODB_FETCH_MODE = $savem;
-
- if (!$rs) return $false;
- $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
- $rs->_fetch();
-
- $retarr = array();
-
- /*
- $rs->fields indices
- 0 TABLE_QUALIFIER
- 1 TABLE_SCHEM
- 2 TABLE_NAME
- 3 COLUMN_NAME
- 4 DATA_TYPE
- 5 TYPE_NAME
- 6 PRECISION
- 7 LENGTH
- 8 SCALE
- 9 RADIX
- 10 NULLABLE
- 11 REMARKS
- */
- while (!$rs->EOF) {
- // adodb_pr($rs->fields);
- if (strtoupper(trim($rs->fields[2])) == $table && (!$schema || strtoupper($rs->fields[1]) == $schema)) {
- $fld = new ADOFieldObject();
- $fld->name = $rs->fields[3];
- $fld->type = $this->ODBCTypes($rs->fields[4]);
-
- // ref: http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnaraccgen/html/msdn_odk.asp
- // access uses precision to store length for char/varchar
- if ($fld->type == 'C' or $fld->type == 'X') {
- if ($this->databaseType == 'access')
- $fld->max_length = $rs->fields[6];
- else if ($rs->fields[4] <= -95) // UNICODE
- $fld->max_length = $rs->fields[7]/2;
- else
- $fld->max_length = $rs->fields[7];
- } else
- $fld->max_length = $rs->fields[7];
- $fld->not_null = !empty($rs->fields[10]);
- $fld->scale = $rs->fields[8];
- $retarr[strtoupper($fld->name)] = $fld;
- } else if (sizeof($retarr)>0)
- break;
- $rs->MoveNext();
- }
- $rs->Close(); //-- crashes 4.03pl1 -- why?
-
- if (empty($retarr)) $retarr = false;
- return $retarr;
- }
-
- // Returns an array of columns names for a given table
- function &MetaColumnNames($table)
- {
- $recordSet = $this->Execute("select name from system.columns where parent='$table'");
- if(!$recordSet){
- print $this->ErrorMsg();
- return false;
- }
- else{
- $i=0;
- while (!$recordSet->EOF){
- $arr["FIELD$i"] = $recordSet->fields[0];
- $recordSet->MoveNext();
- $i=$i+1;
- }
- return $arr;
- }
- }
-
-
- function Prepare($sql)
- {
- if (! $this->_bindInputArray) return $sql; // no binding
- $stmt = ads_prepare($this->_connectionID,$sql);
- if (!$stmt) {
- // we don't know whether odbc driver is parsing prepared stmts, so just return sql
- return $sql;
- }
- return array($sql,$stmt,false);
- }
-
- /* returns queryID or false */
- function _query($sql,$inputarr=false)
- {
- $this->_error = '';
-
- if ($inputarr) {
- if (is_array($sql)) {
- $stmtid = $sql[1];
- } else {
- $stmtid = ads_prepare($this->_connectionID,$sql);
-
- if ($stmtid == false) {
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- return false;
- }
- }
-
- if (! ads_execute($stmtid,$inputarr)) {
- //@ads_free_result($stmtid);
- if ($this->_haserrorfunctions) {
- $this->_errorMsg = ads_errormsg();
- $this->_errorCode = ads_error();
- }
- return false;
- }
-
- } else if (is_array($sql)) {
- $stmtid = $sql[1];
- if (!ads_execute($stmtid)) {
- //@ads_free_result($stmtid);
- if ($this->_haserrorfunctions) {
- $this->_errorMsg = ads_errormsg();
- $this->_errorCode = ads_error();
- }
- return false;
- }
- } else
- {
-
- $stmtid = ads_exec($this->_connectionID,$sql);
-
- }
-
- $this->_lastAffectedRows = 0;
-
- if ($stmtid)
- {
-
- if (@ads_num_fields($stmtid) == 0) {
- $this->_lastAffectedRows = ads_num_rows($stmtid);
- $stmtid = true;
-
- } else {
-
- $this->_lastAffectedRows = 0;
- ads_binmode($stmtid,$this->binmode);
- ads_longreadlen($stmtid,$this->maxblobsize);
-
- }
-
- if ($this->_haserrorfunctions)
- {
-
- $this->_errorMsg = '';
- $this->_errorCode = 0;
- }
- else
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- }
- else
- {
- if ($this->_haserrorfunctions) {
- $this->_errorMsg = ads_errormsg();
- $this->_errorCode = ads_error();
- } else
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- }
-
- return $stmtid;
-
- }
-
- /*
- Insert a null into the blob field of the table first.
- Then use UpdateBlob to store the blob.
-
- Usage:
-
- $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
- $conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');
- */
- function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
- {
- $sql = "UPDATE $table SET $column=? WHERE $where";
- $stmtid = ads_prepare($this->_connectionID,$sql);
- if ($stmtid == false){
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- return false;
- }
- if (! ads_execute($stmtid,array($val),array(SQL_BINARY) )){
- if ($this->_haserrorfunctions){
- $this->_errorMsg = ads_errormsg();
- $this->_errorCode = ads_error();
- }
- return false;
- }
- return TRUE;
- }
-
- // returns true or false
- function _close()
- {
- $ret = @ads_close($this->_connectionID);
- $this->_connectionID = false;
- return $ret;
- }
-
- function _affectedrows()
- {
- return $this->_lastAffectedRows;
- }
-
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordSet_ads extends ADORecordSet {
-
- var $bind = false;
- var $databaseType = "ads";
- var $dataProvider = "ads";
- var $useFetchArray;
- var $_has_stupid_odbc_fetch_api_change;
-
- function __construct($id,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- $this->fetchMode = $mode;
-
- $this->_queryID = $id;
-
- // the following is required for mysql odbc driver in 4.3.1 -- why?
- $this->EOF = false;
- $this->_currentRow = -1;
- //$this->ADORecordSet($id);
- }
-
-
- // returns the field object
- function &FetchField($fieldOffset = -1)
- {
-
- $off=$fieldOffset+1; // offsets begin at 1
-
- $o= new ADOFieldObject();
- $o->name = @ads_field_name($this->_queryID,$off);
- $o->type = @ads_field_type($this->_queryID,$off);
- $o->max_length = @ads_field_len($this->_queryID,$off);
- if (ADODB_ASSOC_CASE == 0) $o->name = strtolower($o->name);
- else if (ADODB_ASSOC_CASE == 1) $o->name = strtoupper($o->name);
- return $o;
- }
-
- /* Use associative array to get fields array */
- function Fields($colname)
- {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) return $this->fields[$colname];
- if (!$this->bind) {
- $this->bind = array();
- for ($i=0; $i < $this->_numOfFields; $i++) {
- $o = $this->FetchField($i);
- $this->bind[strtoupper($o->name)] = $i;
- }
- }
-
- return $this->fields[$this->bind[strtoupper($colname)]];
- }
-
-
- function _initrs()
- {
- global $ADODB_COUNTRECS;
- $this->_numOfRows = ($ADODB_COUNTRECS) ? @ads_num_rows($this->_queryID) : -1;
- $this->_numOfFields = @ads_num_fields($this->_queryID);
- // some silly drivers such as db2 as/400 and intersystems cache return _numOfRows = 0
- if ($this->_numOfRows == 0) $this->_numOfRows = -1;
- //$this->useFetchArray = $this->connection->useFetchArray;
- $this->_has_stupid_odbc_fetch_api_change = ADODB_PHPVER >= 0x4200;
- }
-
- function _seek($row)
- {
- return false;
- }
-
- // speed up SelectLimit() by switching to ADODB_FETCH_NUM as ADODB_FETCH_ASSOC is emulated
- function &GetArrayLimit($nrows,$offset=-1)
- {
- if ($offset <= 0) {
- $rs =& $this->GetArray($nrows);
- return $rs;
- }
- $savem = $this->fetchMode;
- $this->fetchMode = ADODB_FETCH_NUM;
- $this->Move($offset);
- $this->fetchMode = $savem;
-
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
- $this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE);
- }
-
- $results = array();
- $cnt = 0;
- while (!$this->EOF && $nrows != $cnt) {
- $results[$cnt++] = $this->fields;
- $this->MoveNext();
- }
-
- return $results;
- }
-
-
- function MoveNext()
- {
- if ($this->_numOfRows != 0 && !$this->EOF) {
- $this->_currentRow++;
-
- if ($this->_has_stupid_odbc_fetch_api_change)
- $rez = @ads_fetch_into($this->_queryID,$this->fields);
- else {
- $row = 0;
- $rez = @ads_fetch_into($this->_queryID,$row,$this->fields);
- }
- if ($rez) {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
- $this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE);
- }
- return true;
- }
- }
- $this->fields = false;
- $this->EOF = true;
- return false;
- }
-
- function _fetch()
- {
-
- if ($this->_has_stupid_odbc_fetch_api_change)
- $rez = @ads_fetch_into($this->_queryID,$this->fields);
- else {
- $row = 0;
- $rez = @ads_fetch_into($this->_queryID,$row,$this->fields);
- }
- if ($rez) {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
- $this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE);
- }
- return true;
- }
- $this->fields = false;
- return false;
- }
-
- function _close()
- {
- return @ads_free_result($this->_queryID);
- }
-
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-csv.inc.php b/src/adodb5/drivers/adodb-csv.inc.php
deleted file mode 100644
index 95cb238b..00000000
--- a/src/adodb5/drivers/adodb-csv.inc.php
+++ /dev/null
@@ -1,207 +0,0 @@
-_insertid;
- }
-
- function _affectedrows()
- {
- return $this->_affectedrows;
- }
-
- function MetaDatabases()
- {
- return false;
- }
-
-
- // returns true or false
- function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
- {
- if (strtolower(substr($argHostname,0,7)) !== 'http://') return false;
- $this->_url = $argHostname;
- return true;
- }
-
- // returns true or false
- function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
- {
- if (strtolower(substr($argHostname,0,7)) !== 'http://') return false;
- $this->_url = $argHostname;
- return true;
- }
-
- function MetaColumns($table, $normalize=true)
- {
- return false;
- }
-
-
- // parameters use PostgreSQL convention, not MySQL
- function SelectLimit($sql,$nrows=-1,$offset=-1)
- {
- global $ADODB_FETCH_MODE;
-
- $url = $this->_url.'?sql='.urlencode($sql)."&nrows=$nrows&fetch=".
- (($this->fetchMode !== false)?$this->fetchMode : $ADODB_FETCH_MODE).
- "&offset=$offset";
- $err = false;
- $rs = csv2rs($url,$err,false);
-
- if ($this->debug) print "$url
$err
";
-
- $at = strpos($err,'::::');
- if ($at === false) {
- $this->_errorMsg = $err;
- $this->_errorNo = (integer)$err;
- } else {
- $this->_errorMsg = substr($err,$at+4,1024);
- $this->_errorNo = -9999;
- }
- if ($this->_errorNo)
- if ($fn = $this->raiseErrorFn) {
- $fn($this->databaseType,'EXECUTE',$this->ErrorNo(),$this->ErrorMsg(),$sql,'');
- }
-
- if (is_object($rs)) {
-
- $rs->databaseType='csv';
- $rs->fetchMode = ($this->fetchMode !== false) ? $this->fetchMode : $ADODB_FETCH_MODE;
- $rs->connection = $this;
- }
- return $rs;
- }
-
- // returns queryID or false
- function _Execute($sql,$inputarr=false)
- {
- global $ADODB_FETCH_MODE;
-
- if (!$this->_bindInputArray && $inputarr) {
- $sqlarr = explode('?',$sql);
- $sql = '';
- $i = 0;
- foreach($inputarr as $v) {
-
- $sql .= $sqlarr[$i];
- if (gettype($v) == 'string')
- $sql .= $this->qstr($v);
- else if ($v === null)
- $sql .= 'NULL';
- else
- $sql .= $v;
- $i += 1;
-
- }
- $sql .= $sqlarr[$i];
- if ($i+1 != sizeof($sqlarr))
- print "Input Array does not match ?: ".htmlspecialchars($sql);
- $inputarr = false;
- }
-
- $url = $this->_url.'?sql='.urlencode($sql)."&fetch=".
- (($this->fetchMode !== false)?$this->fetchMode : $ADODB_FETCH_MODE);
- $err = false;
-
-
- $rs = csv2rs($url,$err,false);
- if ($this->debug) print urldecode($url)."
$err
";
- $at = strpos($err,'::::');
- if ($at === false) {
- $this->_errorMsg = $err;
- $this->_errorNo = (integer)$err;
- } else {
- $this->_errorMsg = substr($err,$at+4,1024);
- $this->_errorNo = -9999;
- }
-
- if ($this->_errorNo)
- if ($fn = $this->raiseErrorFn) {
- $fn($this->databaseType,'EXECUTE',$this->ErrorNo(),$this->ErrorMsg(),$sql,$inputarr);
- }
- if (is_object($rs)) {
- $rs->fetchMode = ($this->fetchMode !== false) ? $this->fetchMode : $ADODB_FETCH_MODE;
-
- $this->_affectedrows = $rs->affectedrows;
- $this->_insertid = $rs->insertid;
- $rs->databaseType='csv';
- $rs->connection = $this;
- }
- return $rs;
- }
-
- /* Returns: the last error message from previous database operation */
- function ErrorMsg()
- {
- return $this->_errorMsg;
- }
-
- /* Returns: the last error number from previous database operation */
- function ErrorNo()
- {
- return $this->_errorNo;
- }
-
- // returns true or false
- function _close()
- {
- return true;
- }
-} // class
-
-class ADORecordset_csv extends ADORecordset {
- function __construct($id,$mode=false)
- {
- $this->ADORecordset($id,$mode);
- }
-
- function _close()
- {
- return true;
- }
-}
-
-} // define
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-db2.inc.php b/src/adodb5/drivers/adodb-db2.inc.php
deleted file mode 100644
index fbda7a97..00000000
--- a/src/adodb5/drivers/adodb-db2.inc.php
+++ /dev/null
@@ -1,819 +0,0 @@
-_haserrorfunctions = ADODB_PHPVER >= 0x4050;
- }
-
- // returns true or false
- function _connect($argDSN, $argUsername, $argPassword, $argDatabasename)
- {
- if (!function_exists('db2_connect')) {
- ADOConnection::outp("Warning: The old ODBC based DB2 driver has been renamed 'odbc_db2'. This ADOdb driver calls PHP's native db2 extension which is not installed.");
- return null;
- }
- // This needs to be set before the connect().
- // Replaces the odbc_binmode() call that was in Execute()
- ini_set('ibm_db2.binmode', $this->binmode);
-
- if ($argDatabasename) {
- $this->_connectionID = db2_connect($argDatabasename,$argUsername,$argPassword);
- } else {
- $this->_connectionID = db2_connect($argDSN,$argUsername,$argPassword);
- }
-
- // For db2_connect(), there is an optional 4th arg. If present, it must be
- // an array of valid options. So far, we don't use them.
-
- $this->_errorMsg = @db2_conn_errormsg();
-
- if (isset($this->connectStmt)) $this->Execute($this->connectStmt);
-
- return $this->_connectionID != false;
- }
-
- // returns true or false
- function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
- {
-
- if (!function_exists('db2_connect')) return null;
-
- // This needs to be set before the connect().
- // Replaces the odbc_binmode() call that was in Execute()
- ini_set('ibm_db2.binmode', $this->binmode);
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
-
- if ($argDatabasename) {
- $this->_connectionID = db2_pconnect($argDatabasename,$argUsername,$argPassword);
- } else {
- $this->_connectionID = db2_pconnect($argDSN,$argUsername,$argPassword);
- }
-
- $this->_errorMsg = @db2_conn_errormsg();
- if ($this->_connectionID && $this->autoRollback) @db2_rollback($this->_connectionID);
- if (isset($this->connectStmt)) $this->Execute($this->connectStmt);
-
- return $this->_connectionID != false;
- }
-
- // format and return date string in database timestamp format
- function DBTimeStamp($ts)
- {
- if (empty($ts) && $ts !== 0) return 'null';
- if (is_string($ts)) $ts = ADORecordSet::UnixTimeStamp($ts);
- return 'TO_DATE('.adodb_date($this->fmtTimeStamp,$ts).",'YYYY-MM-DD HH24:MI:SS')";
- }
-
- // Format date column in sql string given an input format that understands Y M D
- function SQLDate($fmt, $col=false)
- {
- // use right() and replace() ?
- if (!$col) $col = $this->sysDate;
-
- /* use TO_CHAR() if $fmt is TO_CHAR() allowed fmt */
- if ($fmt== 'Y-m-d H:i:s')
- return 'TO_CHAR('.$col.", 'YYYY-MM-DD HH24:MI:SS')";
-
- $s = '';
-
- $len = strlen($fmt);
- for ($i=0; $i < $len; $i++) {
- if ($s) $s .= $this->concat_operator;
- $ch = $fmt[$i];
- switch($ch) {
- case 'Y':
- case 'y':
- if ($len==1) return "year($col)";
- $s .= "char(year($col))";
- break;
- case 'M':
- if ($len==1) return "monthname($col)";
- $s .= "substr(monthname($col),1,3)";
- break;
- case 'm':
- if ($len==1) return "month($col)";
- $s .= "right(digits(month($col)),2)";
- break;
- case 'D':
- case 'd':
- if ($len==1) return "day($col)";
- $s .= "right(digits(day($col)),2)";
- break;
- case 'H':
- case 'h':
- if ($len==1) return "hour($col)";
- if ($col != $this->sysDate) $s .= "right(digits(hour($col)),2)";
- else $s .= "''";
- break;
- case 'i':
- case 'I':
- if ($len==1) return "minute($col)";
- if ($col != $this->sysDate)
- $s .= "right(digits(minute($col)),2)";
- else $s .= "''";
- break;
- case 'S':
- case 's':
- if ($len==1) return "second($col)";
- if ($col != $this->sysDate)
- $s .= "right(digits(second($col)),2)";
- else $s .= "''";
- break;
- default:
- if ($ch == '\\') {
- $i++;
- $ch = substr($fmt,$i,1);
- }
- $s .= $this->qstr($ch);
- }
- }
- return $s;
- }
-
-
- function ServerInfo()
- {
-
- if (!empty($this->host) && ADODB_PHPVER >= 0x4300) {
- $dsn = strtoupper($this->host);
- $first = true;
- $found = false;
-
- if (!function_exists('db2_data_source')) return false;
-
- while(true) {
-
- $rez = @db2_data_source($this->_connectionID,
- $first ? SQL_FETCH_FIRST : SQL_FETCH_NEXT);
- $first = false;
- if (!is_array($rez)) break;
- if (strtoupper($rez['server']) == $dsn) {
- $found = true;
- break;
- }
- }
- if (!$found) return ADOConnection::ServerInfo();
- if (!isset($rez['version'])) $rez['version'] = '';
- return $rez;
- } else {
- return ADOConnection::ServerInfo();
- }
- }
-
-
- function CreateSequence($seqname='adodbseq',$start=1)
- {
- if (empty($this->_genSeqSQL)) return false;
- $ok = $this->Execute(sprintf($this->_genSeqSQL,$seqname,$start));
- if (!$ok) return false;
- return true;
- }
-
- function DropSequence($seqname)
- {
- if (empty($this->_dropSeqSQL)) return false;
- return $this->Execute(sprintf($this->_dropSeqSQL,$seqname));
- }
-
- /*
- This algorithm is not very efficient, but works even if table locking
- is not available.
-
- Will return false if unable to generate an ID after $MAXLOOPS attempts.
- */
- function GenID($seq='adodbseq',$start=1)
- {
- // if you have to modify the parameter below, your database is overloaded,
- // or you need to implement generation of id's yourself!
- $num = $this->GetOne("VALUES NEXTVAL FOR $seq");
- return $num;
- }
-
-
- function ErrorMsg()
- {
- if ($this->_haserrorfunctions) {
- if ($this->_errorMsg !== false) return $this->_errorMsg;
- if (empty($this->_connectionID)) return @db2_conn_errormsg();
- return @db2_conn_errormsg($this->_connectionID);
- } else return ADOConnection::ErrorMsg();
- }
-
- function ErrorNo()
- {
-
- if ($this->_haserrorfunctions) {
- if ($this->_errorCode !== false) {
- // bug in 4.0.6, error number can be corrupted string (should be 6 digits)
- return (strlen($this->_errorCode)<=2) ? 0 : $this->_errorCode;
- }
-
- if (empty($this->_connectionID)) $e = @db2_conn_error();
- else $e = @db2_conn_error($this->_connectionID);
-
- // bug in 4.0.6, error number can be corrupted string (should be 6 digits)
- // so we check and patch
- if (strlen($e)<=2) return 0;
- return $e;
- } else return ADOConnection::ErrorNo();
- }
-
-
-
- function BeginTrans()
- {
- if (!$this->hasTransactions) return false;
- if ($this->transOff) return true;
- $this->transCnt += 1;
- $this->_autocommit = false;
- return db2_autocommit($this->_connectionID,false);
- }
-
- function CommitTrans($ok=true)
- {
- if ($this->transOff) return true;
- if (!$ok) return $this->RollbackTrans();
- if ($this->transCnt) $this->transCnt -= 1;
- $this->_autocommit = true;
- $ret = db2_commit($this->_connectionID);
- db2_autocommit($this->_connectionID,true);
- return $ret;
- }
-
- function RollbackTrans()
- {
- if ($this->transOff) return true;
- if ($this->transCnt) $this->transCnt -= 1;
- $this->_autocommit = true;
- $ret = db2_rollback($this->_connectionID);
- db2_autocommit($this->_connectionID,true);
- return $ret;
- }
-
- function MetaPrimaryKeys($table)
- {
- global $ADODB_FETCH_MODE;
-
- if ($this->uCaseTables) $table = strtoupper($table);
- $schema = '';
- $this->_findschema($table,$schema);
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $qid = @db2_primarykeys($this->_connectionID,'',$schema,$table);
-
- if (!$qid) {
- $ADODB_FETCH_MODE = $savem;
- return false;
- }
- $rs = new ADORecordSet_db2($qid);
- $ADODB_FETCH_MODE = $savem;
-
- if (!$rs) return false;
-
- $arr = $rs->GetArray();
- $rs->Close();
- $arr2 = array();
- for ($i=0; $i < sizeof($arr); $i++) {
- if ($arr[$i][3]) $arr2[] = $arr[$i][3];
- }
- return $arr2;
- }
-
- function MetaForeignKeys($table, $owner = FALSE, $upper = FALSE, $asociative = FALSE )
- {
- global $ADODB_FETCH_MODE;
-
- if ($this->uCaseTables) $table = strtoupper($table);
- $schema = '';
- $this->_findschema($table,$schema);
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $qid = @db2_foreign_keys($this->_connectionID,'',$schema,$table);
- if (!$qid) {
- $ADODB_FETCH_MODE = $savem;
- return false;
- }
- $rs = new ADORecordSet_db2($qid);
-
- $ADODB_FETCH_MODE = $savem;
- /*
- $rs->fields indices
- 0 PKTABLE_CAT
- 1 PKTABLE_SCHEM
- 2 PKTABLE_NAME
- 3 PKCOLUMN_NAME
- 4 FKTABLE_CAT
- 5 FKTABLE_SCHEM
- 6 FKTABLE_NAME
- 7 FKCOLUMN_NAME
- */
- if (!$rs) return false;
-
- $foreign_keys = array();
- while (!$rs->EOF) {
- if (strtoupper(trim($rs->fields[2])) == $table && (!$schema || strtoupper($rs->fields[1]) == $schema)) {
- if (!is_array($foreign_keys[$rs->fields[5].'.'.$rs->fields[6]]))
- $foreign_keys[$rs->fields[5].'.'.$rs->fields[6]] = array();
- $foreign_keys[$rs->fields[5].'.'.$rs->fields[6]][$rs->fields[7]] = $rs->fields[3];
- }
- $rs->MoveNext();
- }
-
- $rs->Close();
- return $foreign_key;
- }
-
-
- function MetaTables($ttype=false,$schema=false)
- {
- global $ADODB_FETCH_MODE;
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $qid = db2_tables($this->_connectionID);
-
- $rs = new ADORecordSet_db2($qid);
-
- $ADODB_FETCH_MODE = $savem;
- if (!$rs) {
- $false = false;
- return $false;
- }
-
- $arr = $rs->GetArray();
-
- $rs->Close();
- $arr2 = array();
-
- if ($ttype) {
- $isview = strncmp($ttype,'V',1) === 0;
- }
- for ($i=0; $i < sizeof($arr); $i++) {
- if (!$arr[$i][2]) continue;
- $type = $arr[$i][3];
- $schemaval = ($schema) ? $arr[$i][1].'.' : '';
- if ($ttype) {
- if ($isview) {
- if (strncmp($type,'V',1) === 0) $arr2[] = $schemaval.$arr[$i][2];
- } else if (strncmp($type,'SYS',3) !== 0) $arr2[] = $schemaval.$arr[$i][2];
- } else if (strncmp($type,'SYS',3) !== 0) $arr2[] = $schemaval.$arr[$i][2];
- }
- return $arr2;
- }
-
-/*
-See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2datetime_data_type_changes.asp
-/ SQL data type codes /
-#define SQL_UNKNOWN_TYPE 0
-#define SQL_CHAR 1
-#define SQL_NUMERIC 2
-#define SQL_DECIMAL 3
-#define SQL_INTEGER 4
-#define SQL_SMALLINT 5
-#define SQL_FLOAT 6
-#define SQL_REAL 7
-#define SQL_DOUBLE 8
-#if (DB2VER >= 0x0300)
-#define SQL_DATETIME 9
-#endif
-#define SQL_VARCHAR 12
-
-
-/ One-parameter shortcuts for date/time data types /
-#if (DB2VER >= 0x0300)
-#define SQL_TYPE_DATE 91
-#define SQL_TYPE_TIME 92
-#define SQL_TYPE_TIMESTAMP 93
-
-#define SQL_UNICODE (-95)
-#define SQL_UNICODE_VARCHAR (-96)
-#define SQL_UNICODE_LONGVARCHAR (-97)
-*/
- function DB2Types($t)
- {
- switch ((integer)$t) {
- case 1:
- case 12:
- case 0:
- case -95:
- case -96:
- return 'C';
- case -97:
- case -1: //text
- return 'X';
- case -4: //image
- return 'B';
-
- case 9:
- case 91:
- return 'D';
-
- case 10:
- case 11:
- case 92:
- case 93:
- return 'T';
-
- case 4:
- case 5:
- case -6:
- return 'I';
-
- case -11: // uniqidentifier
- return 'R';
- case -7: //bit
- return 'L';
-
- default:
- return 'N';
- }
- }
-
- function MetaColumns($table, $normalize=true)
- {
- global $ADODB_FETCH_MODE;
-
- $false = false;
- if ($this->uCaseTables) $table = strtoupper($table);
- $schema = '';
- $this->_findschema($table,$schema);
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
-
- $colname = "%";
- $qid = db2_columns($this->_connectionID, "", $schema, $table, $colname);
- if (empty($qid)) return $false;
-
- $rs = new ADORecordSet_db2($qid);
- $ADODB_FETCH_MODE = $savem;
-
- if (!$rs) return $false;
- $rs->_fetch();
-
- $retarr = array();
-
- /*
- $rs->fields indices
- 0 TABLE_QUALIFIER
- 1 TABLE_SCHEM
- 2 TABLE_NAME
- 3 COLUMN_NAME
- 4 DATA_TYPE
- 5 TYPE_NAME
- 6 PRECISION
- 7 LENGTH
- 8 SCALE
- 9 RADIX
- 10 NULLABLE
- 11 REMARKS
- */
- while (!$rs->EOF) {
- if (strtoupper(trim($rs->fields[2])) == $table && (!$schema || strtoupper($rs->fields[1]) == $schema)) {
- $fld = new ADOFieldObject();
- $fld->name = $rs->fields[3];
- $fld->type = $this->DB2Types($rs->fields[4]);
-
- // ref: http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnaraccgen/html/msdn_odk.asp
- // access uses precision to store length for char/varchar
- if ($fld->type == 'C' or $fld->type == 'X') {
- if ($rs->fields[4] <= -95) // UNICODE
- $fld->max_length = $rs->fields[7]/2;
- else
- $fld->max_length = $rs->fields[7];
- } else
- $fld->max_length = $rs->fields[7];
- $fld->not_null = !empty($rs->fields[10]);
- $fld->scale = $rs->fields[8];
- $fld->primary_key = false;
- $retarr[strtoupper($fld->name)] = $fld;
- } else if (sizeof($retarr)>0)
- break;
- $rs->MoveNext();
- }
- $rs->Close();
- if (empty($retarr)) $retarr = false;
-
- $qid = db2_primary_keys($this->_connectionID, "", $schema, $table);
- if (empty($qid)) return $false;
-
- $rs = new ADORecordSet_db2($qid);
- $ADODB_FETCH_MODE = $savem;
-
- if (!$rs) return $retarr;
- $rs->_fetch();
-
- /*
- $rs->fields indices
- 0 TABLE_CAT
- 1 TABLE_SCHEM
- 2 TABLE_NAME
- 3 COLUMN_NAME
- 4 KEY_SEQ
- 5 PK_NAME
- */
- while (!$rs->EOF) {
- if (strtoupper(trim($rs->fields[2])) == $table && (!$schema || strtoupper($rs->fields[1]) == $schema)) {
- $retarr[strtoupper($rs->fields[3])]->primary_key = true;
- } else if (sizeof($retarr)>0)
- break;
- $rs->MoveNext();
- }
- $rs->Close();
-
- if (empty($retarr)) $retarr = false;
- return $retarr;
- }
-
- function Prepare($sql)
- {
- if (! $this->_bindInputArray) return $sql; // no binding
- $stmt = db2_prepare($this->_connectionID,$sql);
- if (!$stmt) {
- // we don't know whether db2 driver is parsing prepared stmts, so just return sql
- return $sql;
- }
- return array($sql,$stmt,false);
- }
-
- /* returns queryID or false */
- function _query($sql,$inputarr=false)
- {
- $this->_error = '';
-
- if ($inputarr) {
- if (is_array($sql)) {
- $stmtid = $sql[1];
- } else {
- $stmtid = db2_prepare($this->_connectionID,$sql);
-
- if ($stmtid == false) {
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- return false;
- }
- }
-
- if (! db2_execute($stmtid,$inputarr)) {
- if ($this->_haserrorfunctions) {
- $this->_errorMsg = db2_stmt_errormsg();
- $this->_errorCode = db2_stmt_error();
- }
- return false;
- }
-
- } else if (is_array($sql)) {
- $stmtid = $sql[1];
- if (!db2_execute($stmtid)) {
- if ($this->_haserrorfunctions) {
- $this->_errorMsg = db2_stmt_errormsg();
- $this->_errorCode = db2_stmt_error();
- }
- return false;
- }
- } else
- $stmtid = @db2_exec($this->_connectionID,$sql);
-
- $this->_lastAffectedRows = 0;
- if ($stmtid) {
- if (@db2_num_fields($stmtid) == 0) {
- $this->_lastAffectedRows = db2_num_rows($stmtid);
- $stmtid = true;
- } else {
- $this->_lastAffectedRows = 0;
- }
-
- if ($this->_haserrorfunctions) {
- $this->_errorMsg = '';
- $this->_errorCode = 0;
- } else
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- } else {
- if ($this->_haserrorfunctions) {
- $this->_errorMsg = db2_stmt_errormsg();
- $this->_errorCode = db2_stmt_error();
- } else
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
-
- }
- return $stmtid;
- }
-
- /*
- Insert a null into the blob field of the table first.
- Then use UpdateBlob to store the blob.
-
- Usage:
-
- $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
- $conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');
- */
- function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
- {
- return $this->Execute("UPDATE $table SET $column=? WHERE $where",array($val)) != false;
- }
-
- // returns true or false
- function _close()
- {
- $ret = @db2_close($this->_connectionID);
- $this->_connectionID = false;
- return $ret;
- }
-
- function _affectedrows()
- {
- return $this->_lastAffectedRows;
- }
-
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordSet_db2 extends ADORecordSet {
-
- var $bind = false;
- var $databaseType = "db2";
- var $dataProvider = "db2";
- var $useFetchArray;
-
- function __construct($id,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- $this->fetchMode = $mode;
-
- $this->_queryID = $id;
- }
-
-
- // returns the field object
- function FetchField($offset = -1)
- {
- $o= new ADOFieldObject();
- $o->name = @db2_field_name($this->_queryID,$offset);
- $o->type = @db2_field_type($this->_queryID,$offset);
- $o->max_length = db2_field_width($this->_queryID,$offset);
- if (ADODB_ASSOC_CASE == 0) $o->name = strtolower($o->name);
- else if (ADODB_ASSOC_CASE == 1) $o->name = strtoupper($o->name);
- return $o;
- }
-
- /* Use associative array to get fields array */
- function Fields($colname)
- {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) return $this->fields[$colname];
- if (!$this->bind) {
- $this->bind = array();
- for ($i=0; $i < $this->_numOfFields; $i++) {
- $o = $this->FetchField($i);
- $this->bind[strtoupper($o->name)] = $i;
- }
- }
-
- return $this->fields[$this->bind[strtoupper($colname)]];
- }
-
-
- function _initrs()
- {
- global $ADODB_COUNTRECS;
- $this->_numOfRows = ($ADODB_COUNTRECS) ? @db2_num_rows($this->_queryID) : -1;
- $this->_numOfFields = @db2_num_fields($this->_queryID);
- // some silly drivers such as db2 as/400 and intersystems cache return _numOfRows = 0
- if ($this->_numOfRows == 0) $this->_numOfRows = -1;
- }
-
- function _seek($row)
- {
- return false;
- }
-
- // speed up SelectLimit() by switching to ADODB_FETCH_NUM as ADODB_FETCH_ASSOC is emulated
- function GetArrayLimit($nrows,$offset=-1)
- {
- if ($offset <= 0) {
- $rs = $this->GetArray($nrows);
- return $rs;
- }
- $savem = $this->fetchMode;
- $this->fetchMode = ADODB_FETCH_NUM;
- $this->Move($offset);
- $this->fetchMode = $savem;
-
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
- $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
- }
-
- $results = array();
- $cnt = 0;
- while (!$this->EOF && $nrows != $cnt) {
- $results[$cnt++] = $this->fields;
- $this->MoveNext();
- }
-
- return $results;
- }
-
-
- function MoveNext()
- {
- if ($this->_numOfRows != 0 && !$this->EOF) {
- $this->_currentRow++;
-
- $this->fields = @db2_fetch_array($this->_queryID);
- if ($this->fields) {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
- $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
- }
- return true;
- }
- }
- $this->fields = false;
- $this->EOF = true;
- return false;
- }
-
- function _fetch()
- {
-
- $this->fields = db2_fetch_array($this->_queryID);
- if ($this->fields) {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
- $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
- }
- return true;
- }
- $this->fields = false;
- return false;
- }
-
- function _close()
- {
- return @db2_free_result($this->_queryID);
- }
-
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-informix.inc.php b/src/adodb5/drivers/adodb-informix.inc.php
deleted file mode 100644
index e46d6eb5..00000000
--- a/src/adodb5/drivers/adodb-informix.inc.php
+++ /dev/null
@@ -1,40 +0,0 @@
-ADORecordset_informix72($id,$mode);
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-informix72.inc.php b/src/adodb5/drivers/adodb-informix72.inc.php
deleted file mode 100644
index 56662135..00000000
--- a/src/adodb5/drivers/adodb-informix72.inc.php
+++ /dev/null
@@ -1,475 +0,0 @@
-
-
-*/
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-if (!defined('IFX_SCROLL')) define('IFX_SCROLL',1);
-
-class ADODB_informix72 extends ADOConnection {
- var $databaseType = "informix72";
- var $dataProvider = "informix";
- var $replaceQuote = "''"; // string to use to replace quotes
- var $fmtDate = "'Y-m-d'";
- var $fmtTimeStamp = "'Y-m-d H:i:s'";
- var $hasInsertID = true;
- var $hasAffectedRows = true;
- var $substr = 'substr';
- var $metaTablesSQL="select tabname,tabtype from systables where tabtype in ('T','V') and owner!='informix'"; //Don't get informix tables and pseudo-tables
-
-
- var $metaColumnsSQL =
- "select c.colname, c.coltype, c.collength, d.default,c.colno
- from syscolumns c, systables t,outer sysdefaults d
- where c.tabid=t.tabid and d.tabid=t.tabid and d.colno=c.colno
- and tabname='%s' order by c.colno";
-
- var $metaPrimaryKeySQL =
- "select part1,part2,part3,part4,part5,part6,part7,part8 from
- systables t,sysconstraints s,sysindexes i where t.tabname='%s'
- and s.tabid=t.tabid and s.constrtype='P'
- and i.idxname=s.idxname";
-
- var $concat_operator = '||';
-
- var $lastQuery = false;
- var $has_insertid = true;
-
- var $_autocommit = true;
- var $_bindInputArray = true; // set to true if ADOConnection.Execute() permits binding of array parameters.
- var $sysDate = 'TODAY';
- var $sysTimeStamp = 'CURRENT';
- var $cursorType = IFX_SCROLL; // IFX_SCROLL or IFX_HOLD or 0
-
- function __construct()
- {
- // alternatively, use older method:
- //putenv("DBDATE=Y4MD-");
-
- // force ISO date format
- putenv('GL_DATE=%Y-%m-%d');
-
- if (function_exists('ifx_byteasvarchar')) {
- ifx_byteasvarchar(1); // Mode "0" will return a blob id, and mode "1" will return a varchar with text content.
- ifx_textasvarchar(1); // Mode "0" will return a blob id, and mode "1" will return a varchar with text content.
- ifx_blobinfile_mode(0); // Mode "0" means save Byte-Blobs in memory, and mode "1" means save Byte-Blobs in a file.
- }
- }
-
- function ServerInfo()
- {
- if (isset($this->version)) return $this->version;
-
- $arr['description'] = $this->GetOne("select DBINFO('version','full') from systables where tabid = 1");
- $arr['version'] = $this->GetOne("select DBINFO('version','major') || DBINFO('version','minor') from systables where tabid = 1");
- $this->version = $arr;
- return $arr;
- }
-
-
-
- function _insertid()
- {
- $sqlca =ifx_getsqlca($this->lastQuery);
- return @$sqlca["sqlerrd1"];
- }
-
- function _affectedrows()
- {
- if ($this->lastQuery) {
- return @ifx_affected_rows ($this->lastQuery);
- }
- return 0;
- }
-
- function BeginTrans()
- {
- if ($this->transOff) return true;
- $this->transCnt += 1;
- $this->Execute('BEGIN');
- $this->_autocommit = false;
- return true;
- }
-
- function CommitTrans($ok=true)
- {
- if (!$ok) return $this->RollbackTrans();
- if ($this->transOff) return true;
- if ($this->transCnt) $this->transCnt -= 1;
- $this->Execute('COMMIT');
- $this->_autocommit = true;
- return true;
- }
-
- function RollbackTrans()
- {
- if ($this->transOff) return true;
- if ($this->transCnt) $this->transCnt -= 1;
- $this->Execute('ROLLBACK');
- $this->_autocommit = true;
- return true;
- }
-
- function RowLock($tables,$where,$flds='1 as ignore')
- {
- if ($this->_autocommit) $this->BeginTrans();
- return $this->GetOne("select $flds from $tables where $where for update");
- }
-
- /* Returns: the last error message from previous database operation
- Note: This function is NOT available for Microsoft SQL Server. */
-
- function ErrorMsg()
- {
- if (!empty($this->_logsql)) return $this->_errorMsg;
- $this->_errorMsg = ifx_errormsg();
- return $this->_errorMsg;
- }
-
- function ErrorNo()
- {
- preg_match("/.*SQLCODE=([^\]]*)/",ifx_error(),$parse);
- if (is_array($parse) && isset($parse[1])) return (int)$parse[1];
- return 0;
- }
-
-
- function MetaColumns($table, $normalize=true)
- {
- global $ADODB_FETCH_MODE;
-
- $false = false;
- if (!empty($this->metaColumnsSQL)) {
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
- $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
- if (isset($savem)) $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
- if ($rs === false) return $false;
- $rspkey = $this->Execute(sprintf($this->metaPrimaryKeySQL,$table)); //Added to get primary key colno items
-
- $retarr = array();
- while (!$rs->EOF) { //print_r($rs->fields);
- $fld = new ADOFieldObject();
- $fld->name = $rs->fields[0];
-/* //!eos.
- $rs->fields[1] is not the correct adodb type
- $rs->fields[2] is not correct max_length, because can include not-null bit
-
- $fld->type = $rs->fields[1];
- $fld->primary_key=$rspkey->fields && array_search($rs->fields[4],$rspkey->fields); //Added to set primary key flag
- $fld->max_length = $rs->fields[2];*/
- $pr=ifx_props($rs->fields[1],$rs->fields[2]); //!eos
- $fld->type = $pr[0] ;//!eos
- $fld->primary_key=$rspkey->fields && array_search($rs->fields[4],$rspkey->fields);
- $fld->max_length = $pr[1]; //!eos
- $fld->precision = $pr[2] ;//!eos
- $fld->not_null = $pr[3]=="N"; //!eos
-
- if (trim($rs->fields[3]) != "AAAAAA 0") {
- $fld->has_default = 1;
- $fld->default_value = $rs->fields[3];
- } else {
- $fld->has_default = 0;
- }
-
- $retarr[strtolower($fld->name)] = $fld;
- $rs->MoveNext();
- }
-
- $rs->Close();
- $rspkey->Close(); //!eos
- return $retarr;
- }
-
- return $false;
- }
-
- function xMetaColumns($table)
- {
- return ADOConnection::MetaColumns($table,false);
- }
-
- function MetaForeignKeys($table, $owner=false, $upper=false) //!Eos
- {
- $sql = "
- select tr.tabname,updrule,delrule,
- i.part1 o1,i2.part1 d1,i.part2 o2,i2.part2 d2,i.part3 o3,i2.part3 d3,i.part4 o4,i2.part4 d4,
- i.part5 o5,i2.part5 d5,i.part6 o6,i2.part6 d6,i.part7 o7,i2.part7 d7,i.part8 o8,i2.part8 d8
- from systables t,sysconstraints s,sysindexes i,
- sysreferences r,systables tr,sysconstraints s2,sysindexes i2
- where t.tabname='$table'
- and s.tabid=t.tabid and s.constrtype='R' and r.constrid=s.constrid
- and i.idxname=s.idxname and tr.tabid=r.ptabid
- and s2.constrid=r.primary and i2.idxname=s2.idxname";
-
- $rs = $this->Execute($sql);
- if (!$rs || $rs->EOF) return false;
- $arr = $rs->GetArray();
- $a = array();
- foreach($arr as $v) {
- $coldest=$this->metaColumnNames($v["tabname"]);
- $colorig=$this->metaColumnNames($table);
- $colnames=array();
- for($i=1;$i<=8 && $v["o$i"] ;$i++) {
- $colnames[]=$coldest[$v["d$i"]-1]."=".$colorig[$v["o$i"]-1];
- }
- if($upper)
- $a[strtoupper($v["tabname"])] = $colnames;
- else
- $a[$v["tabname"]] = $colnames;
- }
- return $a;
- }
-
- function UpdateBlob($table, $column, $val, $where, $blobtype = 'BLOB')
- {
- $type = ($blobtype == 'TEXT') ? 1 : 0;
- $blobid = ifx_create_blob($type,0,$val);
- return $this->Execute("UPDATE $table SET $column=(?) WHERE $where",array($blobid));
- }
-
- function BlobDecode($blobid)
- {
- return function_exists('ifx_byteasvarchar') ? $blobid : @ifx_get_blob($blobid);
- }
-
- // returns true or false
- function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
- {
- if (!function_exists('ifx_connect')) return null;
-
- $dbs = $argDatabasename . "@" . $argHostname;
- if ($argHostname) putenv("INFORMIXSERVER=$argHostname");
- putenv("INFORMIXSERVER=".trim($argHostname));
- $this->_connectionID = ifx_connect($dbs,$argUsername,$argPassword);
- if ($this->_connectionID === false) return false;
- #if ($argDatabasename) return $this->SelectDB($argDatabasename);
- return true;
- }
-
- // returns true or false
- function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
- {
- if (!function_exists('ifx_connect')) return null;
-
- $dbs = $argDatabasename . "@" . $argHostname;
- putenv("INFORMIXSERVER=".trim($argHostname));
- $this->_connectionID = ifx_pconnect($dbs,$argUsername,$argPassword);
- if ($this->_connectionID === false) return false;
- #if ($argDatabasename) return $this->SelectDB($argDatabasename);
- return true;
- }
-/*
- // ifx_do does not accept bind parameters - weird ???
- function Prepare($sql)
- {
- $stmt = ifx_prepare($sql);
- if (!$stmt) return $sql;
- else return array($sql,$stmt);
- }
-*/
- // returns query ID if successful, otherwise false
- function _query($sql,$inputarr=false)
- {
- global $ADODB_COUNTRECS;
-
- // String parameters have to be converted using ifx_create_char
- if ($inputarr) {
- foreach($inputarr as $v) {
- if (gettype($v) == 'string') {
- $tab[] = ifx_create_char($v);
- }
- else {
- $tab[] = $v;
- }
- }
- }
-
- // In case of select statement, we use a scroll cursor in order
- // to be able to call "move", or "movefirst" statements
- if (!$ADODB_COUNTRECS && preg_match("/^\s*select/is", $sql)) {
- if ($inputarr) {
- $this->lastQuery = ifx_query($sql,$this->_connectionID, $this->cursorType, $tab);
- }
- else {
- $this->lastQuery = ifx_query($sql,$this->_connectionID, $this->cursorType);
- }
- }
- else {
- if ($inputarr) {
- $this->lastQuery = ifx_query($sql,$this->_connectionID, $tab);
- }
- else {
- $this->lastQuery = ifx_query($sql,$this->_connectionID);
- }
- }
-
- // Following line have been commented because autocommit mode is
- // not supported by informix SE 7.2
-
- //if ($this->_autocommit) ifx_query('COMMIT',$this->_connectionID);
-
- return $this->lastQuery;
- }
-
- // returns true or false
- function _close()
- {
- $this->lastQuery = false;
- return ifx_close($this->_connectionID);
- }
-}
-
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordset_informix72 extends ADORecordSet {
-
- var $databaseType = "informix72";
- var $canSeek = true;
- var $_fieldprops = false;
-
- function __construct($id,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- $this->fetchMode = $mode;
- $this->ADORecordSet($id);
- }
-
-
-
- /* Returns: an object containing field information.
- Get column information in the Recordset object. fetchField() can be used in order to obtain information about
- fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by
- fetchField() is retrieved. */
- function FetchField($fieldOffset = -1)
- {
- if (empty($this->_fieldprops)) {
- $fp = ifx_fieldproperties($this->_queryID);
- foreach($fp as $k => $v) {
- $o = new ADOFieldObject;
- $o->name = $k;
- $arr = explode(';',$v); //"SQLTYPE;length;precision;scale;ISNULLABLE"
- $o->type = $arr[0];
- $o->max_length = $arr[1];
- $this->_fieldprops[] = $o;
- $o->not_null = $arr[4]=="N";
- }
- }
- $ret = $this->_fieldprops[$fieldOffset];
- return $ret;
- }
-
- function _initrs()
- {
- $this->_numOfRows = -1; // ifx_affected_rows not reliable, only returns estimate -- ($ADODB_COUNTRECS)? ifx_affected_rows($this->_queryID):-1;
- $this->_numOfFields = ifx_num_fields($this->_queryID);
- }
-
- function _seek($row)
- {
- return @ifx_fetch_row($this->_queryID, (int) $row);
- }
-
- function MoveLast()
- {
- $this->fields = @ifx_fetch_row($this->_queryID, "LAST");
- if ($this->fields) $this->EOF = false;
- $this->_currentRow = -1;
-
- if ($this->fetchMode == ADODB_FETCH_NUM) {
- foreach($this->fields as $v) {
- $arr[] = $v;
- }
- $this->fields = $arr;
- }
-
- return true;
- }
-
- function MoveFirst()
- {
- $this->fields = @ifx_fetch_row($this->_queryID, "FIRST");
- if ($this->fields) $this->EOF = false;
- $this->_currentRow = 0;
-
- if ($this->fetchMode == ADODB_FETCH_NUM) {
- foreach($this->fields as $v) {
- $arr[] = $v;
- }
- $this->fields = $arr;
- }
-
- return true;
- }
-
- function _fetch($ignore_fields=false)
- {
-
- $this->fields = @ifx_fetch_row($this->_queryID);
-
- if (!is_array($this->fields)) return false;
-
- if ($this->fetchMode == ADODB_FETCH_NUM) {
- foreach($this->fields as $v) {
- $arr[] = $v;
- }
- $this->fields = $arr;
- }
- return true;
- }
-
- /* close() only needs to be called if you are worried about using too much memory while your script
- is running. All associated result memory for the specified result identifier will automatically be freed. */
- function _close()
- {
- return ifx_free_result($this->_queryID);
- }
-
-}
-/** !Eos
-* Auxiliar function to Parse coltype,collength. Used by Metacolumns
-* return: array ($mtype,$length,$precision,$nullable) (similar to ifx_fieldpropierties)
-*/
-function ifx_props($coltype,$collength){
- $itype=fmod($coltype+1,256);
- $nullable=floor(($coltype+1) /256) ?"N":"Y";
- $mtype=substr(" CIIFFNNDN TBXCC ",$itype,1);
- switch ($itype){
- case 2:
- $length=4;
- case 6:
- case 9:
- case 14:
- $length=floor($collength/256);
- $precision=fmod($collength,256);
- break;
- default:
- $precision=0;
- $length=$collength;
- }
- return array($mtype,$length,$precision,$nullable);
-}
-
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-ldap.inc.php b/src/adodb5/drivers/adodb-ldap.inc.php
deleted file mode 100644
index 76b34890..00000000
--- a/src/adodb5/drivers/adodb-ldap.inc.php
+++ /dev/null
@@ -1,423 +0,0 @@
-_connectionID = @ldap_connect($host);
- } else {
- $conn_info = array( $host,$this->port);
-
- if ( strstr( $host, ':' ) ) {
- $conn_info = explode( ':', $host );
- }
-
- $this->_connectionID = @ldap_connect( $conn_info[0], $conn_info[1] );
- }
- if (!$this->_connectionID) {
- $e = 'Could not connect to ' . $conn_info[0];
- $this->_errorMsg = $e;
- if ($this->debug) ADOConnection::outp($e);
- return false;
- }
- if( count( $LDAP_CONNECT_OPTIONS ) > 0 ) {
- $this->_inject_bind_options( $LDAP_CONNECT_OPTIONS );
- }
-
- if ($username) {
- $bind = @ldap_bind( $this->_connectionID, $username, $password );
- } else {
- $username = 'anonymous';
- $bind = @ldap_bind( $this->_connectionID );
- }
-
- if (!$bind) {
- $e = sprintf($this->_bind_errmsg,ldap_error($this->_connectionID));
- $this->_errorMsg = $e;
- if ($this->debug) ADOConnection::outp($e);
- return false;
- }
- $this->_errorMsg = '';
- $this->database = $ldapbase;
- return $this->_connectionID;
- }
-
-/*
- Valid Domain Values for LDAP Options:
-
- LDAP_OPT_DEREF (integer)
- LDAP_OPT_SIZELIMIT (integer)
- LDAP_OPT_TIMELIMIT (integer)
- LDAP_OPT_PROTOCOL_VERSION (integer)
- LDAP_OPT_ERROR_NUMBER (integer)
- LDAP_OPT_REFERRALS (boolean)
- LDAP_OPT_RESTART (boolean)
- LDAP_OPT_HOST_NAME (string)
- LDAP_OPT_ERROR_STRING (string)
- LDAP_OPT_MATCHED_DN (string)
- LDAP_OPT_SERVER_CONTROLS (array)
- LDAP_OPT_CLIENT_CONTROLS (array)
-
- Make sure to set this BEFORE calling Connect()
-
- Example:
-
- $LDAP_CONNECT_OPTIONS = Array(
- Array (
- "OPTION_NAME"=>LDAP_OPT_DEREF,
- "OPTION_VALUE"=>2
- ),
- Array (
- "OPTION_NAME"=>LDAP_OPT_SIZELIMIT,
- "OPTION_VALUE"=>100
- ),
- Array (
- "OPTION_NAME"=>LDAP_OPT_TIMELIMIT,
- "OPTION_VALUE"=>30
- ),
- Array (
- "OPTION_NAME"=>LDAP_OPT_PROTOCOL_VERSION,
- "OPTION_VALUE"=>3
- ),
- Array (
- "OPTION_NAME"=>LDAP_OPT_ERROR_NUMBER,
- "OPTION_VALUE"=>13
- ),
- Array (
- "OPTION_NAME"=>LDAP_OPT_REFERRALS,
- "OPTION_VALUE"=>FALSE
- ),
- Array (
- "OPTION_NAME"=>LDAP_OPT_RESTART,
- "OPTION_VALUE"=>FALSE
- )
- );
-*/
-
- function _inject_bind_options( $options ) {
- foreach( $options as $option ) {
- ldap_set_option( $this->_connectionID, $option["OPTION_NAME"], $option["OPTION_VALUE"] )
- or die( "Unable to set server option: " . $option["OPTION_NAME"] );
- }
- }
-
- /* returns _queryID or false */
- function _query($sql,$inputarr=false)
- {
- $rs = @ldap_search( $this->_connectionID, $this->database, $sql );
- $this->_errorMsg = ($rs) ? '' : 'Search error on '.$sql.': '.ldap_error($this->_connectionID);
- return $rs;
- }
-
- function ErrorMsg()
- {
- return $this->_errorMsg;
- }
-
- function ErrorNo()
- {
- return @ldap_errno($this->_connectionID);
- }
-
- /* closes the LDAP connection */
- function _close()
- {
- @ldap_close( $this->_connectionID );
- $this->_connectionID = false;
- }
-
- function SelectDB($db) {
- $this->database = $db;
- return true;
- } // SelectDB
-
- function ServerInfo()
- {
- if( !empty( $this->version ) ) return $this->version;
- $version = array();
- /*
- Determines how aliases are handled during search.
- LDAP_DEREF_NEVER (0x00)
- LDAP_DEREF_SEARCHING (0x01)
- LDAP_DEREF_FINDING (0x02)
- LDAP_DEREF_ALWAYS (0x03)
- The LDAP_DEREF_SEARCHING value means aliases are dereferenced during the search but
- not when locating the base object of the search. The LDAP_DEREF_FINDING value means
- aliases are dereferenced when locating the base object but not during the search.
- Default: LDAP_DEREF_NEVER
- */
- ldap_get_option( $this->_connectionID, LDAP_OPT_DEREF, $version['LDAP_OPT_DEREF'] ) ;
- switch ( $version['LDAP_OPT_DEREF'] ) {
- case 0:
- $version['LDAP_OPT_DEREF'] = 'LDAP_DEREF_NEVER';
- case 1:
- $version['LDAP_OPT_DEREF'] = 'LDAP_DEREF_SEARCHING';
- case 2:
- $version['LDAP_OPT_DEREF'] = 'LDAP_DEREF_FINDING';
- case 3:
- $version['LDAP_OPT_DEREF'] = 'LDAP_DEREF_ALWAYS';
- }
-
- /*
- A limit on the number of entries to return from a search.
- LDAP_NO_LIMIT (0) means no limit.
- Default: LDAP_NO_LIMIT
- */
- ldap_get_option( $this->_connectionID, LDAP_OPT_SIZELIMIT, $version['LDAP_OPT_SIZELIMIT'] );
- if ( $version['LDAP_OPT_SIZELIMIT'] == 0 ) {
- $version['LDAP_OPT_SIZELIMIT'] = 'LDAP_NO_LIMIT';
- }
-
- /*
- A limit on the number of seconds to spend on a search.
- LDAP_NO_LIMIT (0) means no limit.
- Default: LDAP_NO_LIMIT
- */
- ldap_get_option( $this->_connectionID, LDAP_OPT_TIMELIMIT, $version['LDAP_OPT_TIMELIMIT'] );
- if ( $version['LDAP_OPT_TIMELIMIT'] == 0 ) {
- $version['LDAP_OPT_TIMELIMIT'] = 'LDAP_NO_LIMIT';
- }
-
- /*
- Determines whether the LDAP library automatically follows referrals returned by LDAP servers or not.
- LDAP_OPT_ON
- LDAP_OPT_OFF
- Default: ON
- */
- ldap_get_option( $this->_connectionID, LDAP_OPT_REFERRALS, $version['LDAP_OPT_REFERRALS'] );
- if ( $version['LDAP_OPT_REFERRALS'] == 0 ) {
- $version['LDAP_OPT_REFERRALS'] = 'LDAP_OPT_OFF';
- } else {
- $version['LDAP_OPT_REFERRALS'] = 'LDAP_OPT_ON';
-
- }
- /*
- Determines whether LDAP I/O operations are automatically restarted if they abort prematurely.
- LDAP_OPT_ON
- LDAP_OPT_OFF
- Default: OFF
- */
- ldap_get_option( $this->_connectionID, LDAP_OPT_RESTART, $version['LDAP_OPT_RESTART'] );
- if ( $version['LDAP_OPT_RESTART'] == 0 ) {
- $version['LDAP_OPT_RESTART'] = 'LDAP_OPT_OFF';
- } else {
- $version['LDAP_OPT_RESTART'] = 'LDAP_OPT_ON';
-
- }
- /*
- This option indicates the version of the LDAP protocol used when communicating with the primary LDAP server.
- LDAP_VERSION2 (2)
- LDAP_VERSION3 (3)
- Default: LDAP_VERSION2 (2)
- */
- ldap_get_option( $this->_connectionID, LDAP_OPT_PROTOCOL_VERSION, $version['LDAP_OPT_PROTOCOL_VERSION'] );
- if ( $version['LDAP_OPT_PROTOCOL_VERSION'] == 2 ) {
- $version['LDAP_OPT_PROTOCOL_VERSION'] = 'LDAP_VERSION2';
- } else {
- $version['LDAP_OPT_PROTOCOL_VERSION'] = 'LDAP_VERSION3';
-
- }
- /* The host name (or list of hosts) for the primary LDAP server. */
- ldap_get_option( $this->_connectionID, LDAP_OPT_HOST_NAME, $version['LDAP_OPT_HOST_NAME'] );
- ldap_get_option( $this->_connectionID, LDAP_OPT_ERROR_NUMBER, $version['LDAP_OPT_ERROR_NUMBER'] );
- ldap_get_option( $this->_connectionID, LDAP_OPT_ERROR_STRING, $version['LDAP_OPT_ERROR_STRING'] );
- ldap_get_option( $this->_connectionID, LDAP_OPT_MATCHED_DN, $version['LDAP_OPT_MATCHED_DN'] );
-
- return $this->version = $version;
-
- }
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordSet_ldap extends ADORecordSet{
-
- var $databaseType = "ldap";
- var $canSeek = false;
- var $_entryID; /* keeps track of the entry resource identifier */
-
- function __construct($queryID,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- switch ($mode)
- {
- case ADODB_FETCH_NUM:
- $this->fetchMode = LDAP_NUM;
- break;
- case ADODB_FETCH_ASSOC:
- $this->fetchMode = LDAP_ASSOC;
- break;
- case ADODB_FETCH_DEFAULT:
- case ADODB_FETCH_BOTH:
- default:
- $this->fetchMode = LDAP_BOTH;
- break;
- }
-
- $this->ADORecordSet($queryID);
- }
-
- function _initrs()
- {
- /*
- This could be teaked to respect the $COUNTRECS directive from ADODB
- It's currently being used in the _fetch() function and the
- GetAssoc() function
- */
- $this->_numOfRows = ldap_count_entries( $this->connection->_connectionID, $this->_queryID );
-
- }
-
- /*
- Return whole recordset as a multi-dimensional associative array
- */
- function GetAssoc($force_array = false, $first2cols = false)
- {
- $records = $this->_numOfRows;
- $results = array();
- for ( $i=0; $i < $records; $i++ ) {
- foreach ( $this->fields as $k=>$v ) {
- if ( is_array( $v ) ) {
- if ( $v['count'] == 1 ) {
- $results[$i][$k] = $v[0];
- } else {
- array_shift( $v );
- $results[$i][$k] = $v;
- }
- }
- }
- }
-
- return $results;
- }
-
- function GetRowAssoc()
- {
- $results = array();
- foreach ( $this->fields as $k=>$v ) {
- if ( is_array( $v ) ) {
- if ( $v['count'] == 1 ) {
- $results[$k] = $v[0];
- } else {
- array_shift( $v );
- $results[$k] = $v;
- }
- }
- }
-
- return $results;
- }
-
- function GetRowNums()
- {
- $results = array();
- foreach ( $this->fields as $k=>$v ) {
- static $i = 0;
- if (is_array( $v )) {
- if ( $v['count'] == 1 ) {
- $results[$i] = $v[0];
- } else {
- array_shift( $v );
- $results[$i] = $v;
- }
- $i++;
- }
- }
- return $results;
- }
-
- function _fetch()
- {
- if ( $this->_currentRow >= $this->_numOfRows && $this->_numOfRows >= 0 )
- return false;
-
- if ( $this->_currentRow == 0 ) {
- $this->_entryID = ldap_first_entry( $this->connection->_connectionID, $this->_queryID );
- } else {
- $this->_entryID = ldap_next_entry( $this->connection->_connectionID, $this->_entryID );
- }
-
- $this->fields = ldap_get_attributes( $this->connection->_connectionID, $this->_entryID );
- $this->_numOfFields = $this->fields['count'];
- switch ( $this->fetchMode ) {
-
- case LDAP_ASSOC:
- $this->fields = $this->GetRowAssoc();
- break;
-
- case LDAP_NUM:
- $this->fields = array_merge($this->GetRowNums(),$this->GetRowAssoc());
- break;
-
- case LDAP_BOTH:
- default:
- $this->fields = $this->GetRowNums();
- break;
- }
- return ( is_array( $this->fields ) );
- }
-
- function _close() {
- @ldap_free_result( $this->_queryID );
- $this->_queryID = false;
- }
-
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-mysqli.inc.php b/src/adodb5/drivers/adodb-mysqli.inc.php
index 22ebc5a7..687fb49e 100644
--- a/src/adodb5/drivers/adodb-mysqli.inc.php
+++ b/src/adodb5/drivers/adodb-mysqli.inc.php
@@ -39,7 +39,7 @@
class ADODB_mysqli extends ADOConnection
{
- var $databaseType = 'mysqli';
+ var $databaseType = \mysqli::class;
var $dataProvider = 'native';
var $hasInsertID = true;
var $hasAffectedRows = true;
@@ -99,7 +99,7 @@ function _connect(
$persist = false
)
{
- if (!extension_loaded("mysqli"))
+ if (!extension_loaded(\mysqli::class))
{
return null;
}
@@ -210,6 +210,7 @@ function GetOne($sql, $inputarr = false)
function ServerInfo()
{
+ $arr = [];
$arr['description'] = $this->GetOne("select version()");
$arr['version'] = ADOConnection::_findvers($arr['description']);
@@ -728,7 +729,7 @@ function MetaForeignKeys($table, $owner = false, $upper = false, $associative =
$a_create_table = $this->getRow(sprintf('SHOW CREATE TABLE %s', $table));
if ($associative)
{
- $create_sql = isset($a_create_table["Create Table"]) ? $a_create_table["Create Table"] : $a_create_table["Create View"];
+ $create_sql = $a_create_table["Create Table"] ?? $a_create_table["Create View"];
}
else
{
@@ -742,7 +743,7 @@ function MetaForeignKeys($table, $owner = false, $upper = false, $associative =
return false;
}
$foreign_keys = array();
- $num_keys = count($matches[0]);
+ $num_keys = is_countable($matches[0]) ? count($matches[0]) : 0;
for ($i = 0; $i < $num_keys; $i++)
{
$my_field = explode('`, `', $matches[1][$i]);
@@ -994,7 +995,7 @@ function _query($sql, $inputarr)
{
$rs = ($ADODB_COUNTRECS) ? @mysqli_store_result($this->_connectionID) : @mysqli_use_result($this->_connectionID);
- return $rs ? $rs : true; // mysqli_more_results( $this->_connectionID )
+ return $rs ?: true; // mysqli_more_results( $this->_connectionID )
}
}
else
@@ -1063,7 +1064,7 @@ function CharMax()
*/
function TextMax()
{
- return 4294967295;
+ return 4_294_967_295;
}
@@ -1128,7 +1129,7 @@ function SetCharSet($charset_name)
class ADORecordSet_mysqli extends ADORecordSet
{
- var $databaseType = "mysqli";
+ var $databaseType = \mysqli::class;
var $canSeek = true;
function __construct($queryID, $mode = false)
@@ -1468,7 +1469,7 @@ class ADORecordSet_array_mysqli extends ADORecordSet_array
function __construct($id = -1, $mode = false)
{
- $this->ADORecordSet_array($id, $mode);
+ $this->ADORecordSet_array($id);
}
function MetaType($t, $len = -1, $fieldobj = false)
diff --git a/src/adodb5/drivers/adodb-netezza.inc.php b/src/adodb5/drivers/adodb-netezza.inc.php
deleted file mode 100644
index 0d89b6cc..00000000
--- a/src/adodb5/drivers/adodb-netezza.inc.php
+++ /dev/null
@@ -1,170 +0,0 @@
- 0 ORDER BY attnum";
- var $metaColumnsSQL1 = "SELECT attname, atttype FROM _v_relation_column_def WHERE name = '%s' AND attnum > 0 ORDER BY attnum";
- // netezza doesn't have keys. it does have distributions, so maybe this is
- // something that can be pulled from the system tables
- var $metaKeySQL = "";
- var $hasAffectedRows = true;
- var $hasLimit = true;
- var $true = 't'; // string that represents TRUE for a database
- var $false = 'f'; // string that represents FALSE for a database
- var $fmtDate = "'Y-m-d'"; // used by DBDate() as the default date format used by the database
- var $fmtTimeStamp = "'Y-m-d G:i:s'"; // used by DBTimeStamp as the default timestamp fmt.
- var $ansiOuter = true;
- var $autoRollback = true; // apparently pgsql does not autorollback properly before 4.3.4
- // http://bugs.php.net/bug.php?id=25404
-
-
- function __construct()
- {
-
- }
-
- function MetaColumns($table,$upper=true)
- {
-
- // Changed this function to support Netezza which has no concept of keys
- // could posisbly work on other things from the system table later.
-
- global $ADODB_FETCH_MODE;
-
- $table = strtolower($table);
-
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
-
- $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table,$table));
- if (isset($savem)) $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
-
- if ($rs === false) return false;
-
- $retarr = array();
- while (!$rs->EOF) {
- $fld = new ADOFieldObject();
- $fld->name = $rs->fields[0];
-
- // since we're returning type and length as one string,
- // split them out here.
-
- if ($first = strstr($rs->fields[1], "(")) {
- $fld->max_length = trim($first, "()");
- } else {
- $fld->max_length = -1;
- }
-
- if ($first = strpos($rs->fields[1], "(")) {
- $fld->type = substr($rs->fields[1], 0, $first);
- } else {
- $fld->type = $rs->fields[1];
- }
-
- switch ($fld->type) {
- case "byteint":
- case "boolean":
- $fld->max_length = 1;
- break;
- case "smallint":
- $fld->max_length = 2;
- break;
- case "integer":
- case "numeric":
- case "date":
- $fld->max_length = 4;
- break;
- case "bigint":
- case "time":
- case "timestamp":
- $fld->max_length = 8;
- break;
- case "timetz":
- case "time with time zone":
- $fld->max_length = 12;
- break;
- }
-
- if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
- else $retarr[($upper) ? strtoupper($fld->name) : $fld->name] = $fld;
-
- $rs->MoveNext();
- }
- $rs->Close();
- return $retarr;
-
- }
-
-
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordSet_netezza extends ADORecordSet_postgres64
-{
- var $databaseType = "netezza";
- var $canSeek = true;
-
- function __construct($queryID,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- switch ($mode)
- {
- case ADODB_FETCH_NUM: $this->fetchMode = PGSQL_NUM; break;
- case ADODB_FETCH_ASSOC:$this->fetchMode = PGSQL_ASSOC; break;
-
- case ADODB_FETCH_DEFAULT:
- case ADODB_FETCH_BOTH:
- default: $this->fetchMode = PGSQL_BOTH; break;
- }
- $this->adodbFetchMode = $mode;
- $this->ADORecordSet($queryID);
- }
-
- // _initrs modified to disable blob handling
- function _initrs()
- {
- global $ADODB_COUNTRECS;
- $this->_numOfRows = ($ADODB_COUNTRECS)? @pg_numrows($this->_queryID):-1;
- $this->_numOfFields = @pg_numfields($this->_queryID);
- }
-
-}
-?>
diff --git a/src/adodb5/drivers/adodb-oci8.inc.php b/src/adodb5/drivers/adodb-oci8.inc.php
deleted file mode 100644
index 8cca5539..00000000
--- a/src/adodb5/drivers/adodb-oci8.inc.php
+++ /dev/null
@@ -1,1612 +0,0 @@
-
-
- 13 Nov 2000 jlim - removed all ora_* references.
-*/
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-/*
-NLS_Date_Format
-Allows you to use a date format other than the Oracle Lite default. When a literal
-character string appears where a date value is expected, the Oracle Lite database
-tests the string to see if it matches the formats of Oracle, SQL-92, or the value
-specified for this parameter in the POLITE.INI file. Setting this parameter also
-defines the default format used in the TO_CHAR or TO_DATE functions when no
-other format string is supplied.
-
-For Oracle the default is dd-mon-yy or dd-mon-yyyy, and for SQL-92 the default is
-yy-mm-dd or yyyy-mm-dd.
-
-Using 'RR' in the format forces two-digit years less than or equal to 49 to be
-interpreted as years in the 21st century (2000�2049), and years over 50 as years in
-the 20th century (1950�1999). Setting the RR format as the default for all two-digit
-year entries allows you to become year-2000 compliant. For example:
-NLS_DATE_FORMAT='RR-MM-DD'
-
-You can also modify the date format using the ALTER SESSION command.
-*/
-
-# define the LOB descriptor type for the given type
-# returns false if no LOB descriptor
-function oci_lob_desc($type) {
- switch ($type) {
- case OCI_B_BFILE: $result = OCI_D_FILE; break;
- case OCI_B_CFILEE: $result = OCI_D_FILE; break;
- case OCI_B_CLOB: $result = OCI_D_LOB; break;
- case OCI_B_BLOB: $result = OCI_D_LOB; break;
- case OCI_B_ROWID: $result = OCI_D_ROWID; break;
- default: $result = false; break;
- }
- return $result;
-}
-
-class ADODB_oci8 extends ADOConnection {
- var $databaseType = 'oci8';
- var $dataProvider = 'oci8';
- var $replaceQuote = "''"; // string to use to replace quotes
- var $concat_operator='||';
- var $sysDate = "TRUNC(SYSDATE)";
- var $sysTimeStamp = 'SYSDATE'; // requires oracle 9 or later, otherwise use SYSDATE
- var $metaDatabasesSQL = "SELECT USERNAME FROM ALL_USERS WHERE USERNAME NOT IN ('SYS','SYSTEM','DBSNMP','OUTLN') ORDER BY 1";
- var $_stmt;
- var $_commit = OCI_COMMIT_ON_SUCCESS;
- var $_initdate = true; // init date to YYYY-MM-DD
- var $metaTablesSQL = "select table_name,table_type from cat where table_type in ('TABLE','VIEW') and table_name not like 'BIN\$%'"; // bin$ tables are recycle bin tables
- var $metaColumnsSQL = "select cname,coltype,width, SCALE, PRECISION, NULLS, DEFAULTVAL from col where tname='%s' order by colno"; //changed by smondino@users.sourceforge. net
- var $_bindInputArray = true;
- var $hasGenID = true;
- var $_genIDSQL = "SELECT (%s.nextval) FROM DUAL";
- var $_genSeqSQL = "CREATE SEQUENCE %s START WITH %s";
- var $_dropSeqSQL = "DROP SEQUENCE %s";
- var $hasAffectedRows = true;
- var $random = "abs(mod(DBMS_RANDOM.RANDOM,10000001)/10000000)";
- var $noNullStrings = false;
- var $connectSID = false;
- var $_bind = false;
- var $_nestedSQL = true;
- var $_hasOCIFetchStatement = false;
- var $_getarray = false; // currently not working
- var $leftOuter = ''; // oracle wierdness, $col = $value (+) for LEFT OUTER, $col (+)= $value for RIGHT OUTER
- var $session_sharing_force_blob = false; // alter session on updateblob if set to true
- var $firstrows = true; // enable first rows optimization on SelectLimit()
- var $selectOffsetAlg1 = 1000; // when to use 1st algorithm of selectlimit.
- var $NLS_DATE_FORMAT = 'YYYY-MM-DD'; // To include time, use 'RRRR-MM-DD HH24:MI:SS'
- var $dateformat = 'YYYY-MM-DD'; // DBDate format
- var $useDBDateFormatForTextInput=false;
- var $datetime = false; // MetaType('DATE') returns 'D' (datetime==false) or 'T' (datetime == true)
- var $_refLOBs = array();
-
- // var $ansiOuter = true; // if oracle9
-
- function __construct()
- {
- $this->_hasOCIFetchStatement = ADODB_PHPVER >= 0x4200;
- if (defined('ADODB_EXTENSION')) $this->rsPrefix .= 'ext_';
- }
-
- /* function MetaColumns($table, $normalize=true) added by smondino@users.sourceforge.net*/
- function MetaColumns($table, $normalize=true)
- {
- global $ADODB_FETCH_MODE;
-
- $false = false;
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
-
- $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
-
- if (isset($savem)) $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
- if (!$rs) {
- return $false;
- }
- $retarr = array();
- while (!$rs->EOF) { //print_r($rs->fields);
- $fld = new ADOFieldObject();
- $fld->name = $rs->fields[0];
- $fld->type = $rs->fields[1];
- $fld->max_length = $rs->fields[2];
- $fld->scale = $rs->fields[3];
- if ($rs->fields[1] == 'NUMBER') {
- if ($rs->fields[3] == 0) $fld->type = 'INT';
- $fld->max_length = $rs->fields[4];
- }
- $fld->not_null = (strncmp($rs->fields[5], 'NOT',3) === 0);
- $fld->binary = (strpos($fld->type,'BLOB') !== false);
- $fld->default_value = $rs->fields[6];
-
- if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
- else $retarr[strtoupper($fld->name)] = $fld;
- $rs->MoveNext();
- }
- $rs->Close();
- if (empty($retarr))
- return $false;
- else
- return $retarr;
- }
-
- function Time()
- {
- $rs = $this->Execute("select TO_CHAR($this->sysTimeStamp,'YYYY-MM-DD HH24:MI:SS') from dual");
- if ($rs && !$rs->EOF) return $this->UnixTimeStamp(reset($rs->fields));
-
- return false;
- }
-
-/*
-
- Multiple modes of connection are supported:
-
- a. Local Database
- $conn->Connect(false,'scott','tiger');
-
- b. From tnsnames.ora
- $conn->Connect(false,'scott','tiger',$tnsname);
- $conn->Connect($tnsname,'scott','tiger');
-
- c. Server + service name
- $conn->Connect($serveraddress,'scott,'tiger',$service_name);
-
- d. Server + SID
- $conn->connectSID = true;
- $conn->Connect($serveraddress,'scott,'tiger',$SID);
-
-
-Example TNSName:
----------------
-NATSOFT.DOMAIN =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = kermit)(PORT = 1523))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = natsoft.domain)
- )
- )
-
- There are 3 connection modes, 0 = non-persistent, 1 = persistent, 2 = force new connection
-
-*/
- function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$mode=0)
- {
- if (!function_exists('OCIPLogon')) return null;
- #adodb_backtrace();
-
- $this->_errorMsg = false;
- $this->_errorCode = false;
-
- if($argHostname) { // added by Jorma Tuomainen
- if (empty($argDatabasename)) $argDatabasename = $argHostname;
- else {
- if(strpos($argHostname,":")) {
- $argHostinfo=explode(":",$argHostname);
- $argHostname=$argHostinfo[0];
- $argHostport=$argHostinfo[1];
- } else {
- $argHostport = empty($this->port)? "1521" : $this->port;
- }
-
- if (strncasecmp($argDatabasename,'SID=',4) == 0) {
- $argDatabasename = substr($argDatabasename,4);
- $this->connectSID = true;
- }
-
- if ($this->connectSID) {
- $argDatabasename="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=".$argHostname
- .")(PORT=$argHostport))(CONNECT_DATA=(SID=$argDatabasename)))";
- } else
- $argDatabasename="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=".$argHostname
- .")(PORT=$argHostport))(CONNECT_DATA=(SERVICE_NAME=$argDatabasename)))";
- }
- }
-
- //if ($argHostname) print "Connect: 1st argument should be left blank for $this->databaseType
";
- if ($mode==1) {
- $this->_connectionID = ($this->charSet) ?
- oci_pconnect($argUsername,$argPassword, $argDatabasename,$this->charSet)
- :
- oci_pconnect($argUsername,$argPassword, $argDatabasename)
- ;
- if ($this->_connectionID && $this->autoRollback) oci_rollback($this->_connectionID);
- } else if ($mode==2) {
- $this->_connectionID = ($this->charSet) ?
- oci_new_connect($argUsername,$argPassword, $argDatabasename,$this->charSet)
- :
- oci_new_connect($argUsername,$argPassword, $argDatabasename);
-
- } else {
- $this->_connectionID = ($this->charSet) ?
- oci_connect($argUsername,$argPassword, $argDatabasename,$this->charSet)
- :
- oci_connect($argUsername,$argPassword, $argDatabasename);
- }
- if (!$this->_connectionID) return false;
- if ($this->_initdate) {
- $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='".$this->NLS_DATE_FORMAT."'");
- }
-
- // looks like:
- // Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production With the Partitioning option JServer Release 8.1.7.0.0 - Production
- // $vers = OCIServerVersion($this->_connectionID);
- // if (strpos($vers,'8i') !== false) $this->ansiOuter = true;
- return true;
- }
-
- function ServerInfo()
- {
- $arr['compat'] = $this->GetOne('select value from sys.database_compatible_level');
- $arr['description'] = @oci_server_version($this->_connectionID);
- $arr['version'] = ADOConnection::_findvers($arr['description']);
- return $arr;
- }
- // returns true or false
- function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
- {
- return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename,1);
- }
-
- // returns true or false
- function _nconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
- {
- return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename,2);
- }
-
- function _affectedrows()
- {
- if (is_resource($this->_stmt)) return @oci_num_rows($this->_stmt);
- return 0;
- }
-
- function IfNull( $field, $ifNull )
- {
- return " NVL($field, $ifNull) "; // if Oracle
- }
-
- // format and return date string in database date format
- function DBDate($d,$isfld=false)
- {
- if (empty($d) && $d !== 0) return 'null';
- if ($isfld) return 'TO_DATE('.$d.",'".$this->dateformat."')";
-
- if (is_string($d)) $d = ADORecordSet::UnixDate($d);
-
- if (is_object($d)) $ds = $d->format($this->fmtDate);
- else $ds = adodb_date($this->fmtDate,$d);
-
- return "TO_DATE(".$ds.",'".$this->dateformat."')";
- }
-
- function BindDate($d)
- {
- $d = ADOConnection::DBDate($d);
- if (strncmp($d,"'",1)) return $d;
-
- return substr($d,1,strlen($d)-2);
- }
-
- function BindTimeStamp($ts)
- {
- if (empty($ts) && $ts !== 0) return 'null';
- if (is_string($ts)) $ts = ADORecordSet::UnixTimeStamp($ts);
-
- if (is_object($ts)) $tss = $ts->format("'Y-m-d H:i:s'");
- else $tss = adodb_date("'Y-m-d H:i:s'",$ts);
-
- return $tss;
- }
-
- // format and return date string in database timestamp format
- function DBTimeStamp($ts,$isfld=false)
- {
- if (empty($ts) && $ts !== 0) return 'null';
- if ($isfld) return 'TO_DATE(substr('.$ts.",1,19),'RRRR-MM-DD, HH24:MI:SS')";
- if (is_string($ts)) $ts = ADORecordSet::UnixTimeStamp($ts);
-
- if (is_object($ts)) $tss = $ts->format("'Y-m-d H:i:s'");
- else $tss = adodb_date("'Y-m-d H:i:s'",$ts);
-
- return 'TO_DATE('.$tss.",'RRRR-MM-DD, HH24:MI:SS')";
- }
-
- function RowLock($tables,$where,$flds='1 as ignore')
- {
- if ($this->autoCommit) $this->BeginTrans();
- return $this->GetOne("select $flds from $tables where $where for update");
- }
-
- function MetaTables($ttype=false,$showSchema=false,$mask=false)
- {
- if ($mask) {
- $save = $this->metaTablesSQL;
- $mask = $this->qstr(strtoupper($mask));
- $this->metaTablesSQL .= " AND upper(table_name) like $mask";
- }
- $ret = ADOConnection::MetaTables($ttype,$showSchema);
-
- if ($mask) {
- $this->metaTablesSQL = $save;
- }
- return $ret;
- }
-
- // Mark Newnham
- function MetaIndexes ($table, $primary = FALSE, $owner=false)
- {
- // save old fetch mode
- global $ADODB_FETCH_MODE;
-
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
-
- if ($this->fetchMode !== FALSE) {
- $savem = $this->SetFetchMode(FALSE);
- }
-
- // get index details
- $table = strtoupper($table);
-
- // get Primary index
- $primary_key = '';
-
- $false = false;
- $rs = $this->Execute(sprintf("SELECT * FROM ALL_CONSTRAINTS WHERE UPPER(TABLE_NAME)='%s' AND CONSTRAINT_TYPE='P'",$table));
- if ($row = $rs->FetchRow())
- $primary_key = $row[1]; //constraint_name
-
- if ($primary==TRUE && $primary_key=='') {
- if (isset($savem))
- $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
- return $false; //There is no primary key
- }
-
- $rs = $this->Execute(sprintf("SELECT ALL_INDEXES.INDEX_NAME, ALL_INDEXES.UNIQUENESS, ALL_IND_COLUMNS.COLUMN_POSITION, ALL_IND_COLUMNS.COLUMN_NAME FROM ALL_INDEXES,ALL_IND_COLUMNS WHERE UPPER(ALL_INDEXES.TABLE_NAME)='%s' AND ALL_IND_COLUMNS.INDEX_NAME=ALL_INDEXES.INDEX_NAME",$table));
-
-
- if (!is_object($rs)) {
- if (isset($savem))
- $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
- return $false;
- }
-
- $indexes = array ();
- // parse index data into array
-
- while ($row = $rs->FetchRow()) {
- if ($primary && $row[0] != $primary_key) continue;
- if (!isset($indexes[$row[0]])) {
- $indexes[$row[0]] = array(
- 'unique' => ($row[1] == 'UNIQUE'),
- 'columns' => array()
- );
- }
- $indexes[$row[0]]['columns'][$row[2] - 1] = $row[3];
- }
-
- // sort columns by order in the index
- foreach ( array_keys ($indexes) as $index ) {
- ksort ($indexes[$index]['columns']);
- }
-
- if (isset($savem)) {
- $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
- }
- return $indexes;
- }
-
- function BeginTrans()
- {
- if ($this->transOff) return true;
- $this->transCnt += 1;
- $this->autoCommit = false;
- $this->_commit = OCI_DEFAULT;
-
- if ($this->_transmode) $ok = $this->Execute("SET TRANSACTION ".$this->_transmode);
- else $ok = true;
-
- return $ok ? true : false;
- }
-
- function CommitTrans($ok=true)
- {
- if ($this->transOff) return true;
- if (!$ok) return $this->RollbackTrans();
-
- if ($this->transCnt) $this->transCnt -= 1;
- $ret = oci_commit($this->_connectionID);
- $this->_commit = OCI_COMMIT_ON_SUCCESS;
- $this->autoCommit = true;
- return $ret;
- }
-
- function RollbackTrans()
- {
- if ($this->transOff) return true;
- if ($this->transCnt) $this->transCnt -= 1;
- $ret = oci_rollback($this->_connectionID);
- $this->_commit = OCI_COMMIT_ON_SUCCESS;
- $this->autoCommit = true;
- return $ret;
- }
-
-
- function SelectDB($dbName)
- {
- return false;
- }
-
- function ErrorMsg()
- {
- if ($this->_errorMsg !== false) return $this->_errorMsg;
-
- if (is_resource($this->_stmt)) $arr = @oci_error($this->_stmt);
- if (empty($arr)) {
- if (is_resource($this->_connectionID)) $arr = @oci_error($this->_connectionID);
- else $arr = @oci_error();
- if ($arr === false) return '';
- }
- $this->_errorMsg = $arr['message'];
- $this->_errorCode = $arr['code'];
- return $this->_errorMsg;
- }
-
- function ErrorNo()
- {
- if ($this->_errorCode !== false) return $this->_errorCode;
-
- if (is_resource($this->_stmt)) $arr = @oci_error($this->_stmt);
- if (empty($arr)) {
- $arr = @oci_error($this->_connectionID);
- if ($arr == false) $arr = @oci_error();
- if ($arr == false) return '';
- }
-
- $this->_errorMsg = $arr['message'];
- $this->_errorCode = $arr['code'];
-
- return $arr['code'];
- }
-
- // Format date column in sql string given an input format that understands Y M D
- function SQLDate($fmt, $col=false)
- {
- if (!$col) $col = $this->sysTimeStamp;
- $s = 'TO_CHAR('.$col.",'";
-
- $len = strlen($fmt);
- for ($i=0; $i < $len; $i++) {
- $ch = $fmt[$i];
- switch($ch) {
- case 'Y':
- case 'y':
- $s .= 'YYYY';
- break;
- case 'Q':
- case 'q':
- $s .= 'Q';
- break;
-
- case 'M':
- $s .= 'Mon';
- break;
-
- case 'm':
- $s .= 'MM';
- break;
- case 'D':
- case 'd':
- $s .= 'DD';
- break;
-
- case 'H':
- $s.= 'HH24';
- break;
-
- case 'h':
- $s .= 'HH';
- break;
-
- case 'i':
- $s .= 'MI';
- break;
-
- case 's':
- $s .= 'SS';
- break;
-
- case 'a':
- case 'A':
- $s .= 'AM';
- break;
-
- case 'w':
- $s .= 'D';
- break;
-
- case 'l':
- $s .= 'DAY';
- break;
-
- case 'W':
- $s .= 'WW';
- break;
-
- default:
- // handle escape characters...
- if ($ch == '\\') {
- $i++;
- $ch = substr($fmt,$i,1);
- }
- if (strpos('-/.:;, ',$ch) !== false) $s .= $ch;
- else $s .= '"'.$ch.'"';
-
- }
- }
- return $s. "')";
- }
-
- function GetRandRow($sql, $arr = false)
- {
- $sql = "SELECT * FROM ($sql ORDER BY dbms_random.value) WHERE rownum = 1";
-
- return $this->GetRow($sql,$arr);
- }
-
- /*
- This algorithm makes use of
-
- a. FIRST_ROWS hint
- The FIRST_ROWS hint explicitly chooses the approach to optimize response time,
- that is, minimum resource usage to return the first row. Results will be returned
- as soon as they are identified.
-
- b. Uses rownum tricks to obtain only the required rows from a given offset.
- As this uses complicated sql statements, we only use this if the $offset >= 100.
- This idea by Tomas V V Cox.
-
- This implementation does not appear to work with oracle 8.0.5 or earlier. Comment
- out this function then, and the slower SelectLimit() in the base class will be used.
- */
- function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
- {
- // seems that oracle only supports 1 hint comment in 8i
- if ($this->firstrows) {
- if (strpos($sql,'/*+') !== false)
- $sql = str_replace('/*+ ','/*+FIRST_ROWS ',$sql);
- else
- $sql = preg_replace('/^[ \t\n]*select/i','SELECT /*+FIRST_ROWS*/',$sql);
- }
-
- if ($offset == -1 || ($offset < $this->selectOffsetAlg1 && 0 < $nrows && $nrows < 1000)) {
- if ($nrows > 0) {
- if ($offset > 0) $nrows += $offset;
- //$inputarr['adodb_rownum'] = $nrows;
- if ($this->databaseType == 'oci8po') {
- $sql = "select * from (".$sql.") where rownum <= ?";
- } else {
- $sql = "select * from (".$sql.") where rownum <= :adodb_offset";
- }
- $inputarr['adodb_offset'] = $nrows;
- $nrows = -1;
- }
- // note that $nrows = 0 still has to work ==> no rows returned
-
- $rs = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
- return $rs;
-
- } else {
- // Algorithm by Tomas V V Cox, from PEAR DB oci8.php
-
- // Let Oracle return the name of the columns
- $q_fields = "SELECT * FROM (".$sql.") WHERE NULL = NULL";
-
- $false = false;
- if (! $stmt_arr = $this->Prepare($q_fields)) {
- return $false;
- }
- $stmt = $stmt_arr[1];
-
- if (is_array($inputarr)) {
- foreach($inputarr as $k => $v) {
- if (is_array($v)) {
- if (sizeof($v) == 2) // suggested by g.giunta@libero.
- oci_bind_by_name($stmt,":$k",$inputarr[$k][0],$v[1]);
- else
- oci_bind_by_name($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]);
- } else {
- $len = -1;
- if ($v === ' ') $len = 1;
- if (isset($bindarr)) { // is prepared sql, so no need to ocibindbyname again
- $bindarr[$k] = $v;
- } else { // dynamic sql, so rebind every time
- oci_bind_by_name($stmt,":$k",$inputarr[$k],$len);
-
- }
- }
- }
- }
-
- if (!oci_execute($stmt, OCI_DEFAULT)) {
- oci_free_statement($stmt);
- return $false;
- }
-
- $ncols = oci_num_fields($stmt);
- for ( $i = 1; $i <= $ncols; $i++ ) {
- $cols[] = '"'.oci_field_name($stmt, $i).'"';
- }
- $result = false;
-
- oci_free_statement($stmt);
- $fields = implode(',', $cols);
- if ($nrows <= 0) $nrows = 999999999999;
- else $nrows += $offset;
- $offset += 1; // in Oracle rownum starts at 1
-
- if ($this->databaseType == 'oci8po') {
- $sql = "SELECT /*+ FIRST_ROWS */ $fields FROM".
- "(SELECT rownum as adodb_rownum, $fields FROM".
- " ($sql) WHERE rownum <= ?".
- ") WHERE adodb_rownum >= ?";
- } else {
- $sql = "SELECT /*+ FIRST_ROWS */ $fields FROM".
- "(SELECT rownum as adodb_rownum, $fields FROM".
- " ($sql) WHERE rownum <= :adodb_nrows".
- ") WHERE adodb_rownum >= :adodb_offset";
- }
- $inputarr['adodb_nrows'] = $nrows;
- $inputarr['adodb_offset'] = $offset;
-
- if ($secs2cache>0) $rs = $this->CacheExecute($secs2cache, $sql,$inputarr);
- else $rs = $this->Execute($sql,$inputarr);
- return $rs;
- }
-
- }
-
- /**
- * Usage:
- * Store BLOBs and CLOBs
- *
- * Example: to store $var in a blob
- *
- * $conn->Execute('insert into TABLE (id,ablob) values(12,empty_blob())');
- * $conn->UpdateBlob('TABLE', 'ablob', $varHoldingBlob, 'ID=12', 'BLOB');
- *
- * $blobtype supports 'BLOB' and 'CLOB', but you need to change to 'empty_clob()'.
- *
- * to get length of LOB:
- * select DBMS_LOB.GETLENGTH(ablob) from TABLE
- *
- * If you are using CURSOR_SHARING = force, it appears this will case a segfault
- * under oracle 8.1.7.0. Run:
- * $db->Execute('ALTER SESSION SET CURSOR_SHARING=EXACT');
- * before UpdateBlob() then...
- */
-
- function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
- {
-
- //if (strlen($val) < 4000) return $this->Execute("UPDATE $table SET $column=:blob WHERE $where",array('blob'=>$val)) != false;
-
- switch(strtoupper($blobtype)) {
- default: ADOConnection::outp("UpdateBlob: Unknown blobtype=$blobtype"); return false;
- case 'BLOB': $type = OCI_B_BLOB; break;
- case 'CLOB': $type = OCI_B_CLOB; break;
- }
-
- if ($this->databaseType == 'oci8po')
- $sql = "UPDATE $table set $column=EMPTY_{$blobtype}() WHERE $where RETURNING $column INTO ?";
- else
- $sql = "UPDATE $table set $column=EMPTY_{$blobtype}() WHERE $where RETURNING $column INTO :blob";
-
- $desc = oci_new_descriptor($this->_connectionID, OCI_D_LOB);
- $arr['blob'] = array($desc,-1,$type);
- if ($this->session_sharing_force_blob) $this->Execute('ALTER SESSION SET CURSOR_SHARING=EXACT');
- $commit = $this->autoCommit;
- if ($commit) $this->BeginTrans();
- $rs = $this->_Execute($sql,$arr);
- if ($rez = !empty($rs)) $desc->save($val);
- $desc->free();
- if ($commit) $this->CommitTrans();
- if ($this->session_sharing_force_blob) $this->Execute('ALTER SESSION SET CURSOR_SHARING=FORCE');
-
- if ($rez) $rs->Close();
- return $rez;
- }
-
- /**
- * Usage: store file pointed to by $val in a blob
- */
- function UpdateBlobFile($table,$column,$val,$where,$blobtype='BLOB')
- {
- switch(strtoupper($blobtype)) {
- default: ADOConnection::outp( "UpdateBlob: Unknown blobtype=$blobtype"); return false;
- case 'BLOB': $type = OCI_B_BLOB; break;
- case 'CLOB': $type = OCI_B_CLOB; break;
- }
-
- if ($this->databaseType == 'oci8po')
- $sql = "UPDATE $table set $column=EMPTY_{$blobtype}() WHERE $where RETURNING $column INTO ?";
- else
- $sql = "UPDATE $table set $column=EMPTY_{$blobtype}() WHERE $where RETURNING $column INTO :blob";
-
- $desc = oci_new_descriptor($this->_connectionID, OCI_D_LOB);
- $arr['blob'] = array($desc,-1,$type);
-
- $this->BeginTrans();
- $rs = ADODB_oci8::Execute($sql,$arr);
- if ($rez = !empty($rs)) $desc->savefile($val);
- $desc->free();
- $this->CommitTrans();
-
- if ($rez) $rs->Close();
- return $rez;
- }
-
- /**
- * Execute SQL
- *
- * @param sql SQL statement to execute, or possibly an array holding prepared statement ($sql[0] will hold sql text)
- * @param [inputarr] holds the input data to bind to. Null elements will be set to null.
- * @return RecordSet or false
- */
- function Execute($sql,$inputarr=false)
- {
- if ($this->fnExecute) {
- $fn = $this->fnExecute;
- $ret = $fn($this,$sql,$inputarr);
- if (isset($ret)) return $ret;
- }
- if ($inputarr) {
- #if (!is_array($inputarr)) $inputarr = array($inputarr);
-
- $element0 = reset($inputarr);
-
- if (!$this->_bindInputArray) {
- # is_object check because oci8 descriptors can be passed in
- if (is_array($element0) && !is_object(reset($element0))) {
- if (is_string($sql))
- $stmt = $this->Prepare($sql);
- else
- $stmt = $sql;
-
- foreach($inputarr as $arr) {
- $ret = $this->_Execute($stmt,$arr);
- if (!$ret) return $ret;
- }
- } else {
- $sqlarr = explode(':',$sql);
- $sql = '';
- $lastnomatch = -2;
- #var_dump($sqlarr);echo "
";var_dump($inputarr);echo"
";
- foreach($sqlarr as $k => $str) {
- if ($k == 0) { $sql = $str; continue; }
- // we need $lastnomatch because of the following datetime,
- // eg. '10:10:01', which causes code to think that there is bind param :10 and :1
- $ok = preg_match('/^([0-9]*)/', $str, $arr);
-
- if (!$ok) $sql .= $str;
- else {
- $at = $arr[1];
- if (isset($inputarr[$at]) || is_null($inputarr[$at])) {
- if ((strlen($at) == strlen($str) && $k < sizeof($arr)-1)) {
- $sql .= ':'.$str;
- $lastnomatch = $k;
- } else if ($lastnomatch == $k-1) {
- $sql .= ':'.$str;
- } else {
- if (is_null($inputarr[$at])) $sql .= 'null';
- else $sql .= $this->qstr($inputarr[$at]);
- $sql .= substr($str, strlen($at));
- }
- } else {
- $sql .= ':'.$str;
- }
-
- }
- }
- $inputarr = false;
- }
- }
- $ret = $this->_Execute($sql,$inputarr);
-
-
- } else {
- $ret = $this->_Execute($sql,false);
- }
-
- return $ret;
- }
-
- /*
- Example of usage:
-
- $stmt = $this->Prepare('insert into emp (empno, ename) values (:empno, :ename)');
- */
- function Prepare($sql,$cursor=false)
- {
- static $BINDNUM = 0;
-
- $stmt = oci_parse($this->_connectionID,$sql);
-
- if (!$stmt) {
- $this->_errorMsg = false;
- $this->_errorCode = false;
- $arr = @oci_error($this->_connectionID);
- if ($arr === false) return false;
-
- $this->_errorMsg = $arr['message'];
- $this->_errorCode = $arr['code'];
- return false;
- }
-
- $BINDNUM += 1;
-
- $sttype = @oci_statement_type($stmt);
- if ($sttype == 'BEGIN' || $sttype == 'DECLARE') {
- return array($sql,$stmt,0,$BINDNUM, ($cursor) ? oci_new_cursor($this->_connectionID) : false);
- }
- return array($sql,$stmt,0,$BINDNUM);
- }
-
- /*
- Call an oracle stored procedure and returns a cursor variable as a recordset.
- Concept by Robert Tuttle robert@ud.com
-
- Example:
- Note: we return a cursor variable in :RS2
- $rs = $db->ExecuteCursor("BEGIN adodb.open_tab(:RS2); END;",'RS2');
-
- $rs = $db->ExecuteCursor(
- "BEGIN :RS2 = adodb.getdata(:VAR1); END;",
- 'RS2',
- array('VAR1' => 'Mr Bean'));
-
- */
- function ExecuteCursor($sql,$cursorName='rs',$params=false)
- {
- if (is_array($sql)) $stmt = $sql;
- else $stmt = ADODB_oci8::Prepare($sql,true); # true to allocate OCINewCursor
-
- if (is_array($stmt) && sizeof($stmt) >= 5) {
- $hasref = true;
- $ignoreCur = false;
- $this->Parameter($stmt, $ignoreCur, $cursorName, false, -1, OCI_B_CURSOR);
- if ($params) {
- foreach($params as $k => $v) {
- $this->Parameter($stmt,$params[$k], $k);
- }
- }
- } else
- $hasref = false;
-
- $rs = $this->Execute($stmt);
- if ($rs) {
- if ($rs->databaseType == 'array') oci_free_statement($stmt[4]);
- else if ($hasref) $rs->_refcursor = $stmt[4];
- }
- return $rs;
- }
-
- /*
- Bind a variable -- very, very fast for executing repeated statements in oracle.
- Better than using
- for ($i = 0; $i < $max; $i++) {
- $p1 = ?; $p2 = ?; $p3 = ?;
- $this->Execute("insert into table (col0, col1, col2) values (:0, :1, :2)",
- array($p1,$p2,$p3));
- }
-
- Usage:
- $stmt = $DB->Prepare("insert into table (col0, col1, col2) values (:0, :1, :2)");
- $DB->Bind($stmt, $p1);
- $DB->Bind($stmt, $p2);
- $DB->Bind($stmt, $p3);
- for ($i = 0; $i < $max; $i++) {
- $p1 = ?; $p2 = ?; $p3 = ?;
- $DB->Execute($stmt);
- }
-
- Some timings:
- ** Test table has 3 cols, and 1 index. Test to insert 1000 records
- Time 0.6081s (1644.60 inserts/sec) with direct OCIParse/OCIExecute
- Time 0.6341s (1577.16 inserts/sec) with ADOdb Prepare/Bind/Execute
- Time 1.5533s ( 643.77 inserts/sec) with pure SQL using Execute
-
- Now if PHP only had batch/bulk updating like Java or PL/SQL...
-
- Note that the order of parameters differs from OCIBindByName,
- because we default the names to :0, :1, :2
- */
- function Bind(&$stmt,&$var,$size=4000,$type=false,$name=false,$isOutput=false)
- {
-
- if (!is_array($stmt)) return false;
-
- if (($type == OCI_B_CURSOR) && sizeof($stmt) >= 5) {
- return oci_bind_by_name($stmt[1],":".$name,$stmt[4],$size,$type);
- }
-
- if ($name == false) {
- if ($type !== false) $rez = oci_bind_by_name($stmt[1],":".$stmt[2],$var,$size,$type);
- else $rez = oci_bind_by_name($stmt[1],":".$stmt[2],$var,$size); // +1 byte for null terminator
- $stmt[2] += 1;
- } else if (oci_lob_desc($type)) {
- if ($this->debug) {
- ADOConnection::outp("Bind: name = $name");
- }
- //we have to create a new Descriptor here
- $numlob = count($this->_refLOBs);
- $this->_refLOBs[$numlob]['LOB'] = oci_new_descriptor($this->_connectionID, oci_lob_desc($type));
- $this->_refLOBs[$numlob]['TYPE'] = $isOutput;
-
- $tmp = $this->_refLOBs[$numlob]['LOB'];
- $rez = oci_bind_by_name($stmt[1], ":".$name, $tmp, -1, $type);
- if ($this->debug) {
- ADOConnection::outp("Bind: descriptor has been allocated, var (".$name.") binded");
- }
-
- // if type is input then write data to lob now
- if ($isOutput == false) {
- $var = $this->BlobEncode($var);
- $tmp->WriteTemporary($var);
- $this->_refLOBs[$numlob]['VAR'] = &$var;
- if ($this->debug) {
- ADOConnection::outp("Bind: LOB has been written to temp");
- }
- } else {
- $this->_refLOBs[$numlob]['VAR'] = $var;
- }
- $rez = $tmp;
- } else {
- if ($this->debug)
- ADOConnection::outp("Bind: name = $name");
-
- if ($type !== false) $rez = oci_bind_by_name($stmt[1],":".$name,$var,$size,$type);
- else $rez = oci_bind_by_name($stmt[1],":".$name,$var,$size); // +1 byte for null terminator
- }
-
- return $rez;
- }
-
- function Param($name,$type=false)
- {
- return ':'.$name;
- }
-
- /*
- Usage:
- $stmt = $db->Prepare('select * from table where id =:myid and group=:group');
- $db->Parameter($stmt,$id,'myid');
- $db->Parameter($stmt,$group,'group');
- $db->Execute($stmt);
-
- @param $stmt Statement returned by Prepare() or PrepareSP().
- @param $var PHP variable to bind to
- @param $name Name of stored procedure variable name to bind to.
- @param [$isOutput] Indicates direction of parameter 0/false=IN 1=OUT 2= IN/OUT. This is ignored in oci8.
- @param [$maxLen] Holds an maximum length of the variable.
- @param [$type] The data type of $var. Legal values depend on driver.
-
- See OCIBindByName documentation at php.net.
- */
- function Parameter(&$stmt,&$var,$name,$isOutput=false,$maxLen=4000,$type=false)
- {
- if ($this->debug) {
- $prefix = ($isOutput) ? 'Out' : 'In';
- $ztype = (empty($type)) ? 'false' : $type;
- ADOConnection::outp( "{$prefix}Parameter(\$stmt, \$php_var='$var', \$name='$name', \$maxLen=$maxLen, \$type=$ztype);");
- }
- return $this->Bind($stmt,$var,$maxLen,$type,$name,$isOutput);
- }
-
- /*
- returns query ID if successful, otherwise false
- this version supports:
-
- 1. $db->execute('select * from table');
-
- 2. $db->prepare('insert into table (a,b,c) values (:0,:1,:2)');
- $db->execute($prepared_statement, array(1,2,3));
-
- 3. $db->execute('insert into table (a,b,c) values (:a,:b,:c)',array('a'=>1,'b'=>2,'c'=>3));
-
- 4. $db->prepare('insert into table (a,b,c) values (:0,:1,:2)');
- $db->bind($stmt,1); $db->bind($stmt,2); $db->bind($stmt,3);
- $db->execute($stmt);
- */
- function _query($sql,$inputarr=false)
- {
- if (is_array($sql)) { // is prepared sql
- $stmt = $sql[1];
-
- // we try to bind to permanent array, so that OCIBindByName is persistent
- // and carried out once only - note that max array element size is 4000 chars
- if (is_array($inputarr)) {
- $bindpos = $sql[3];
- if (isset($this->_bind[$bindpos])) {
- // all tied up already
- $bindarr = $this->_bind[$bindpos];
- } else {
- // one statement to bind them all
- $bindarr = array();
- foreach($inputarr as $k => $v) {
- $bindarr[$k] = $v;
- oci_bind_by_name($stmt,":$k",$bindarr[$k],is_string($v) && strlen($v)>4000 ? -1 : 4000);
- }
- $this->_bind[$bindpos] = $bindarr;
- }
- }
- } else {
- $stmt=oci_parse($this->_connectionID,$sql);
- }
-
- $this->_stmt = $stmt;
- if (!$stmt) return false;
-
- if (defined('ADODB_PREFETCH_ROWS')) @oci_set_prefetch($stmt,ADODB_PREFETCH_ROWS);
-
- if (is_array($inputarr)) {
- foreach($inputarr as $k => $v) {
- if (is_array($v)) {
- if (sizeof($v) == 2) // suggested by g.giunta@libero.
- oci_bind_by_name($stmt,":$k",$inputarr[$k][0],$v[1]);
- else
- oci_bind_by_name($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]);
-
- if ($this->debug==99) {
- if (is_object($v[0]))
- echo "name=:$k",' len='.$v[1],' type='.$v[2],'
';
- else
- echo "name=:$k",' var='.$inputarr[$k][0],' len='.$v[1],' type='.$v[2],'
';
-
- }
- } else {
- $len = -1;
- if ($v === ' ') $len = 1;
- if (isset($bindarr)) { // is prepared sql, so no need to ocibindbyname again
- $bindarr[$k] = $v;
- } else { // dynamic sql, so rebind every time
- oci_bind_by_name($stmt,":$k",$inputarr[$k],$len);
- }
- }
- }
- }
-
- $this->_errorMsg = false;
- $this->_errorCode = false;
- if (oci_execute($stmt,$this->_commit)) {
-//OCIInternalDebug(1);
- if (count($this -> _refLOBs) > 0) {
-
- foreach ($this -> _refLOBs as $key => $value) {
- if ($this -> _refLOBs[$key]['TYPE'] == true) {
- $tmp = $this -> _refLOBs[$key]['LOB'] -> load();
- if ($this -> debug) {
- ADOConnection::outp("OUT LOB: LOB has been loaded.
");
- }
- //$_GLOBALS[$this -> _refLOBs[$key]['VAR']] = $tmp;
- $this -> _refLOBs[$key]['VAR'] = $tmp;
- } else {
- $this->_refLOBs[$key]['LOB']->save($this->_refLOBs[$key]['VAR']);
- $this -> _refLOBs[$key]['LOB']->free();
- unset($this -> _refLOBs[$key]);
- if ($this->debug) {
- ADOConnection::outp("IN LOB: LOB has been saved.
");
- }
- }
- }
- }
-
- switch (@oci_statement_type($stmt)) {
- case "SELECT":
- return $stmt;
-
- case 'DECLARE':
- case "BEGIN":
- if (is_array($sql) && !empty($sql[4])) {
- $cursor = $sql[4];
- if (is_resource($cursor)) {
- $ok = oci_execute($cursor);
- return $cursor;
- }
- return $stmt;
- } else {
- if (is_resource($stmt)) {
- oci_free_statement($stmt);
- return true;
- }
- return $stmt;
- }
- break;
- default :
- // ociclose -- no because it could be used in a LOB?
- return true;
- }
- }
- return false;
- }
-
- // From Oracle Whitepaper: PHP Scalability and High Availability
- function IsConnectionError($err)
- {
- switch($err) {
- case 378: /* buffer pool param incorrect */
- case 602: /* core dump */
- case 603: /* fatal error */
- case 609: /* attach failed */
- case 1012: /* not logged in */
- case 1033: /* init or shutdown in progress */
- case 1043: /* Oracle not available */
- case 1089: /* immediate shutdown in progress */
- case 1090: /* shutdown in progress */
- case 1092: /* instance terminated */
- case 3113: /* disconnect */
- case 3114: /* not connected */
- case 3122: /* closing window */
- case 3135: /* lost contact */
- case 12153: /* TNS: not connected */
- case 27146: /* fatal or instance terminated */
- case 28511: /* Lost RPC */
- return true;
- }
- return false;
- }
-
- // returns true or false
- function _close()
- {
- if (!$this->_connectionID) return;
-
- if (!$this->autoCommit) oci_rollback($this->_connectionID);
- if (count($this->_refLOBs) > 0) {
- foreach ($this ->_refLOBs as $key => $value) {
- $this->_refLOBs[$key]['LOB']->free();
- unset($this->_refLOBs[$key]);
- }
- }
- oci_close($this->_connectionID);
-
- $this->_stmt = false;
- $this->_connectionID = false;
- }
-
- function MetaPrimaryKeys($table, $owner=false,$internalKey=false)
- {
- if ($internalKey) return array('ROWID');
-
- // tested with oracle 8.1.7
- $table = strtoupper($table);
- if ($owner) {
- $owner_clause = "AND ((a.OWNER = b.OWNER) AND (a.OWNER = UPPER('$owner')))";
- $ptab = 'ALL_';
- } else {
- $owner_clause = '';
- $ptab = 'USER_';
- }
- $sql = "
-SELECT /*+ RULE */ distinct b.column_name
- FROM {$ptab}CONSTRAINTS a
- , {$ptab}CONS_COLUMNS b
- WHERE ( UPPER(b.table_name) = ('$table'))
- AND (UPPER(a.table_name) = ('$table') and a.constraint_type = 'P')
- $owner_clause
- AND (a.constraint_name = b.constraint_name)";
-
- $rs = $this->Execute($sql);
- if ($rs && !$rs->EOF) {
- $arr = $rs->GetArray();
- $a = array();
- foreach($arr as $v) {
- $a[] = reset($v);
- }
- return $a;
- }
- else return false;
- }
-
- // http://gis.mit.edu/classes/11.521/sqlnotes/referential_integrity.html
- function MetaForeignKeys($table, $owner=false)
- {
- global $ADODB_FETCH_MODE;
-
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $table = $this->qstr(strtoupper($table));
- if (!$owner) {
- $owner = $this->user;
- $tabp = 'user_';
- } else
- $tabp = 'all_';
-
- $owner = ' and owner='.$this->qstr(strtoupper($owner));
-
- $sql =
-"select constraint_name,r_owner,r_constraint_name
- from {$tabp}constraints
- where constraint_type = 'R' and table_name = $table $owner";
-
- $constraints = $this->GetArray($sql);
- $arr = false;
- foreach($constraints as $constr) {
- $cons = $this->qstr($constr[0]);
- $rowner = $this->qstr($constr[1]);
- $rcons = $this->qstr($constr[2]);
- $cols = $this->GetArray("select column_name from {$tabp}cons_columns where constraint_name=$cons $owner order by position");
- $tabcol = $this->GetArray("select table_name,column_name from {$tabp}cons_columns where owner=$rowner and constraint_name=$rcons order by position");
-
- if ($cols && $tabcol)
- for ($i=0, $max=sizeof($cols); $i < $max; $i++) {
- $arr[$tabcol[$i][0]] = $cols[$i][0].'='.$tabcol[$i][1];
- }
- }
- $ADODB_FETCH_MODE = $save;
-
- return $arr;
- }
-
-
- function CharMax()
- {
- return 4000;
- }
-
- function TextMax()
- {
- return 4000;
- }
-
- /**
- * Quotes a string.
- * An example is $db->qstr("Don't bother",magic_quotes_runtime());
- *
- * @param s the string to quote
- * @param [magic_quotes] if $s is GET/POST var, set to get_magic_quotes_gpc().
- * This undoes the stupidity of magic quotes for GPC.
- *
- * @return quoted string to be sent back to database
- */
- function qstr($s,$magic_quotes=false)
- {
- //$nofixquotes=false;
-
- if ($this->noNullStrings && strlen($s)==0)$s = ' ';
- if (!$magic_quotes) {
- if ($this->replaceQuote[0] == '\\'){
- $s = str_replace('\\','\\\\',$s);
- }
- return "'".str_replace("'",$this->replaceQuote,$s)."'";
- }
-
- // undo magic quotes for " unless sybase is on
- $s = str_replace('\\"','"',$s);
- $s = str_replace('\\\\','\\',$s);
- return "'".str_replace("\\'",$this->replaceQuote,$s)."'";
- }
-
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordset_oci8 extends ADORecordSet {
-
- var $databaseType = 'oci8';
- var $bind=false;
- var $_fieldobjs;
-
- //var $_arr = false;
-
- function __construct($queryID,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- switch ($mode)
- {
- case ADODB_FETCH_ASSOC:$this->fetchMode = OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS; break;
- case ADODB_FETCH_DEFAULT:
- case ADODB_FETCH_BOTH:$this->fetchMode = OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS; break;
- case ADODB_FETCH_NUM:
- default:
- $this->fetchMode = OCI_NUM+OCI_RETURN_NULLS+OCI_RETURN_LOBS; break;
- }
-
- $this->adodbFetchMode = $mode;
- $this->_queryID = $queryID;
- }
-
-
- function Init()
- {
- if ($this->_inited) return;
-
- $this->_inited = true;
- if ($this->_queryID) {
-
- $this->_currentRow = 0;
- @$this->_initrs();
- $this->EOF = !$this->_fetch();
-
- /*
- // based on idea by Gaetano Giunta to detect unusual oracle errors
- // see http://phplens.com/lens/lensforum/msgs.php?id=6771
- $err = OCIError($this->_queryID);
- if ($err && $this->connection->debug) ADOConnection::outp($err);
- */
-
- if (!is_array($this->fields)) {
- $this->_numOfRows = 0;
- $this->fields = array();
- }
- } else {
- $this->fields = array();
- $this->_numOfRows = 0;
- $this->_numOfFields = 0;
- $this->EOF = true;
- }
- }
-
- function _initrs()
- {
- $this->_numOfRows = -1;
- $this->_numOfFields = oci_num_fields($this->_queryID);
- if ($this->_numOfFields>0) {
- $this->_fieldobjs = array();
- $max = $this->_numOfFields;
- for ($i=0;$i<$max; $i++) $this->_fieldobjs[] = $this->_FetchField($i);
- }
- }
-
- /* Returns: an object containing field information.
- Get column information in the Recordset object. fetchField() can be used in order to obtain information about
- fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by
- fetchField() is retrieved. */
-
- function _FetchField($fieldOffset = -1)
- {
- $fld = new ADOFieldObject;
- $fieldOffset += 1;
- $fld->name =oci_field_name($this->_queryID, $fieldOffset);
- $fld->type = oci_field_type($this->_queryID, $fieldOffset);
- $fld->max_length = oci_field_size($this->_queryID, $fieldOffset);
- switch($fld->type) {
- case 'NUMBER':
- $p = oci_field_precision($this->_queryID, $fieldOffset);
- $sc = oci_field_scale($this->_queryID, $fieldOffset);
- if ($p != 0 && $sc == 0) $fld->type = 'INT';
- break;
-
- case 'CLOB':
- case 'NCLOB':
- case 'BLOB':
- $fld->max_length = -1;
- break;
- }
- return $fld;
- }
-
- /* For some reason, OCIcolumnname fails when called after _initrs() so we cache it */
- function FetchField($fieldOffset = -1)
- {
- return $this->_fieldobjs[$fieldOffset];
- }
-
-
- /*
- // 10% speedup to move MoveNext to child class
- function _MoveNext()
- {
- //global $ADODB_EXTENSION;if ($ADODB_EXTENSION) return @adodb_movenext($this);
-
- if ($this->EOF) return false;
-
- $this->_currentRow++;
- if(@OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode))
- return true;
- $this->EOF = true;
-
- return false;
- } */
-
-
- function MoveNext()
- {
- if ($this->fields = @oci_fetch_array($this->_queryID, $this->fetchMode)) {
- $this->_currentRow += 1;
- return true;
- }
- if (!$this->EOF) {
- $this->_currentRow += 1;
- $this->EOF = true;
- }
- return false;
- }
-
- /*
- # does not work as first record is retrieved in _initrs(), so is not included in GetArray()
- function GetArray($nRows = -1)
- {
- global $ADODB_OCI8_GETARRAY;
-
- if (true || !empty($ADODB_OCI8_GETARRAY)) {
- # does not support $ADODB_ANSI_PADDING_OFF
-
- //OCI_RETURN_NULLS and OCI_RETURN_LOBS is set by OCIfetchstatement
- switch($this->adodbFetchMode) {
- case ADODB_FETCH_NUM:
-
- $ncols = @OCIfetchstatement($this->_queryID, $results, 0, $nRows, OCI_FETCHSTATEMENT_BY_ROW+OCI_NUM);
- $results = array_merge(array($this->fields),$results);
- return $results;
-
- case ADODB_FETCH_ASSOC:
- if (ADODB_ASSOC_CASE != 2 || $this->databaseType != 'oci8') break;
-
- $ncols = @OCIfetchstatement($this->_queryID, $assoc, 0, $nRows, OCI_FETCHSTATEMENT_BY_ROW);
- $results = array_merge(array($this->fields),$assoc);
- return $results;
-
- default:
- break;
- }
- }
-
- $results = ADORecordSet::GetArray($nRows);
- return $results;
-
- } */
-
- /* Optimize SelectLimit() by using OCIFetch() instead of OCIFetchInto() */
- function GetArrayLimit($nrows,$offset=-1)
- {
- if ($offset <= 0) {
- $arr = $this->GetArray($nrows);
- return $arr;
- }
- $arr = array();
- for ($i=1; $i < $offset; $i++)
- if (!@oci_fetch($this->_queryID)) return $arr;
-
- if (!$this->fields = @oci_fetch_array($this->_queryID, $this->fetchMode)) return $arr;
- $results = array();
- $cnt = 0;
- while (!$this->EOF && $nrows != $cnt) {
- $results[$cnt++] = $this->fields;
- $this->MoveNext();
- }
-
- return $results;
- }
-
-
- /* Use associative array to get fields array */
- function Fields($colname)
- {
- if (!$this->bind) {
- $this->bind = array();
- for ($i=0; $i < $this->_numOfFields; $i++) {
- $o = $this->FetchField($i);
- $this->bind[strtoupper($o->name)] = $i;
- }
- }
-
- return $this->fields[$this->bind[strtoupper($colname)]];
- }
-
-
-
- function _seek($row)
- {
- return false;
- }
-
- function _fetch()
- {
- return $this->fields = @oci_fetch_array($this->_queryID, $this->fetchMode);
- }
-
- /* close() only needs to be called if you are worried about using too much memory while your script
- is running. All associated result memory for the specified result identifier will automatically be freed. */
-
- function _close()
- {
- if ($this->connection->_stmt === $this->_queryID) $this->connection->_stmt = false;
- if (!empty($this->_refcursor)) {
- oci_free_statement($this->_refcursor);
- $this->_refcursor = false;
- }
- @oci_free_statement($this->_queryID);
- $this->_queryID = false;
-
- }
-
- function MetaType($t,$len=-1)
- {
- if (is_object($t)) {
- $fieldobj = $t;
- $t = $fieldobj->type;
- $len = $fieldobj->max_length;
- }
- switch (strtoupper($t)) {
- case 'VARCHAR':
- case 'VARCHAR2':
- case 'CHAR':
- case 'VARBINARY':
- case 'BINARY':
- case 'NCHAR':
- case 'NVARCHAR':
- case 'NVARCHAR2':
- if ($len <= $this->blobSize) return 'C';
-
- case 'NCLOB':
- case 'LONG':
- case 'LONG VARCHAR':
- case 'CLOB':
- return 'X';
-
- case 'LONG RAW':
- case 'LONG VARBINARY':
- case 'BLOB':
- return 'B';
-
- case 'DATE':
- return ($this->connection->datetime) ? 'T' : 'D';
-
-
- case 'TIMESTAMP': return 'T';
-
- case 'INT':
- case 'SMALLINT':
- case 'INTEGER':
- return 'I';
-
- default: return 'N';
- }
- }
-}
-
-class ADORecordSet_ext_oci8 extends ADORecordSet_oci8 {
- function __construct($queryID,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- switch ($mode)
- {
- case ADODB_FETCH_ASSOC:$this->fetchMode = OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS; break;
- case ADODB_FETCH_DEFAULT:
- case ADODB_FETCH_BOTH:$this->fetchMode = OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS; break;
- case ADODB_FETCH_NUM:
- default: $this->fetchMode = OCI_NUM+OCI_RETURN_NULLS+OCI_RETURN_LOBS; break;
- }
- $this->adodbFetchMode = $mode;
- $this->_queryID = $queryID;
- }
-
- function MoveNext()
- {
- return adodb_movenext($this);
- }
-}
-?>
diff --git a/src/adodb5/drivers/adodb-oci805.inc.php b/src/adodb5/drivers/adodb-oci805.inc.php
deleted file mode 100644
index 63528b31..00000000
--- a/src/adodb5/drivers/adodb-oci805.inc.php
+++ /dev/null
@@ -1,59 +0,0 @@
-ADODB_oci8();
- }
-
- function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
- {
- // seems that oracle only supports 1 hint comment in 8i
- if (strpos($sql,'/*+') !== false)
- $sql = str_replace('/*+ ','/*+FIRST_ROWS ',$sql);
- else
- $sql = preg_replace('/^[ \t\n]*select/i','SELECT /*+FIRST_ROWS*/',$sql);
-
- /*
- The following is only available from 8.1.5 because order by in inline views not
- available before then...
- http://www.jlcomp.demon.co.uk/faq/top_sql.html
- if ($nrows > 0) {
- if ($offset > 0) $nrows += $offset;
- $sql = "select * from ($sql) where rownum <= $nrows";
- $nrows = -1;
- }
- */
-
- return ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
- }
-}
-
-class ADORecordset_oci805 extends ADORecordset_oci8 {
- var $databaseType = "oci805";
- function __construct($id,$mode=false)
- {
- $this->ADORecordset_oci8($id,$mode);
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-oci8po.inc.php b/src/adodb5/drivers/adodb-oci8po.inc.php
deleted file mode 100644
index 9436ebfe..00000000
--- a/src/adodb5/drivers/adodb-oci8po.inc.php
+++ /dev/null
@@ -1,218 +0,0 @@
-
-
- Should some emulation of RecordCount() be implemented?
-
-*/
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-include_once(ADODB_DIR.'/drivers/adodb-oci8.inc.php');
-
-class ADODB_oci8po extends ADODB_oci8 {
- var $databaseType = 'oci8po';
- var $dataProvider = 'oci8';
- var $metaColumnsSQL = "select lower(cname),coltype,width, SCALE, PRECISION, NULLS, DEFAULTVAL from col where tname='%s' order by colno"; //changed by smondino@users.sourceforge. net
- var $metaTablesSQL = "select lower(table_name),table_type from cat where table_type in ('TABLE','VIEW')";
-
- function __construct()
- {
- $this->_hasOCIFetchStatement = ADODB_PHPVER >= 0x4200;
- # oci8po does not support adodb extension: adodb_movenext()
- }
-
- function Param($name)
- {
- return '?';
- }
-
- function Prepare($sql,$cursor=false)
- {
- $sqlarr = explode('?',$sql);
- $sql = $sqlarr[0];
- for ($i = 1, $max = sizeof($sqlarr); $i < $max; $i++) {
- $sql .= ':'.($i-1) . $sqlarr[$i];
- }
- return ADODB_oci8::Prepare($sql,$cursor);
- }
-
- // emulate handling of parameters ? ?, replacing with :bind0 :bind1
- function _query($sql,$inputarr=false)
- {
- if (is_array($inputarr)) {
- $i = 0;
- if (is_array($sql)) {
- foreach($inputarr as $v) {
- $arr['bind'.$i++] = $v;
- }
- } else {
- $sqlarr = explode('?',$sql);
- $sql = $sqlarr[0];
- foreach($inputarr as $k => $v) {
- $sql .= ":$k" . $sqlarr[++$i];
- }
- }
- }
- return ADODB_oci8::_query($sql,$inputarr);
- }
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordset_oci8po extends ADORecordset_oci8 {
-
- var $databaseType = 'oci8po';
-
- function __construct($queryID,$mode=false)
- {
- $this->ADORecordset_oci8($queryID,$mode);
- }
-
- function Fields($colname)
- {
- if ($this->fetchMode & OCI_ASSOC) return $this->fields[$colname];
-
- if (!$this->bind) {
- $this->bind = array();
- for ($i=0; $i < $this->_numOfFields; $i++) {
- $o = $this->FetchField($i);
- $this->bind[strtoupper($o->name)] = $i;
- }
- }
- return $this->fields[$this->bind[strtoupper($colname)]];
- }
-
- // lowercase field names...
- function _FetchField($fieldOffset = -1)
- {
- $fld = new ADOFieldObject;
- $fieldOffset += 1;
- $fld->name = oci_field_name($this->_queryID, $fieldOffset);
- if (ADODB_ASSOC_CASE == 0) $fld->name = strtolower($fld->name);
- $fld->type = oci_field_type($this->_queryID, $fieldOffset);
- $fld->max_length = oci_field_size($this->_queryID, $fieldOffset);
- if ($fld->type == 'NUMBER') {
- //$p = OCIColumnPrecision($this->_queryID, $fieldOffset);
- $sc = oci_field_scale($this->_queryID, $fieldOffset);
- if ($sc == 0) $fld->type = 'INT';
- }
- return $fld;
- }
- /*
- function MoveNext()
- {
- if (@OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode)) {
- $this->_currentRow += 1;
- return true;
- }
- if (!$this->EOF) {
- $this->_currentRow += 1;
- $this->EOF = true;
- }
- return false;
- }*/
-
- // 10% speedup to move MoveNext to child class
- function MoveNext()
- {
- if($this->fields = @oci_fetch_array($this->_queryID, $this->fetchMode)) {
- global $ADODB_ANSI_PADDING_OFF;
- $this->_currentRow++;
-
- if ($this->fetchMode & OCI_ASSOC) $this->_updatefields();
- if (!empty($ADODB_ANSI_PADDING_OFF)) {
- foreach($this->fields as $k => $v) {
- if (is_string($v)) $this->fields[$k] = rtrim($v);
- }
- }
- return true;
- }
- if (!$this->EOF) {
- $this->EOF = true;
- $this->_currentRow++;
- }
- return false;
- }
-
- /* Optimize SelectLimit() by using OCIFetch() instead of OCIFetchInto() */
- function GetArrayLimit($nrows,$offset=-1)
- {
- if ($offset <= 0) {
- $arr = $this->GetArray($nrows);
- return $arr;
- }
- for ($i=1; $i < $offset; $i++)
- if (!@oci_fetch($this->_queryID)) {
- $arr = array();
- return $arr;
- }
- if (!$this->fields = @oci_fetch_array($this->_queryID ,$this->fetchMode)) {
- $arr = array();
- return $arr;
- }
- if ($this->fetchMode & OCI_ASSOC) $this->_updatefields();
- $results = array();
- $cnt = 0;
- while (!$this->EOF && $nrows != $cnt) {
- $results[$cnt++] = $this->fields;
- $this->MoveNext();
- }
-
- return $results;
- }
-
- // Create associative array
- function _updatefields()
- {
- if (ADODB_ASSOC_CASE == 2) return; // native
-
- $arr = array();
- $lowercase = (ADODB_ASSOC_CASE == 0);
-
- foreach($this->fields as $k => $v) {
- if (is_integer($k)) $arr[$k] = $v;
- else {
- if ($lowercase)
- $arr[strtolower($k)] = $v;
- else
- $arr[strtoupper($k)] = $v;
- }
- }
- $this->fields = $arr;
- }
-
- function _fetch()
- {
- $this->fields = @oci_fetch_array($this->_queryID ,$this->fetchMode);
- if ($this->fields) {
- global $ADODB_ANSI_PADDING_OFF;
-
- if ($this->fetchMode & OCI_ASSOC) $this->_updatefields();
- if (!empty($ADODB_ANSI_PADDING_OFF)) {
- foreach($this->fields as $k => $v) {
- if (is_string($v)) $this->fields[$k] = rtrim($v);
- }
- }
- }
- return $this->fields;
- }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-odbc.inc.php b/src/adodb5/drivers/adodb-odbc.inc.php
deleted file mode 100644
index 6258ee0d..00000000
--- a/src/adodb5/drivers/adodb-odbc.inc.php
+++ /dev/null
@@ -1,731 +0,0 @@
-_haserrorfunctions = ADODB_PHPVER >= 0x4050;
- $this->_has_stupid_odbc_fetch_api_change = ADODB_PHPVER >= 0x4200;
- }
-
- // returns true or false
- function _connect($argDSN, $argUsername, $argPassword, $argDatabasename)
- {
- if (!function_exists('odbc_connect')) return null;
-
- if ($this->debug && $argDatabasename && $this->databaseType != 'vfp') {
- ADOConnection::outp("For odbc Connect(), $argDatabasename is not used. Place dsn in 1st parameter.");
- }
- if ($this->curmode === false) $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword);
- else $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,$this->curmode);
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- if (isset($this->connectStmt)) $this->Execute($this->connectStmt);
-
- return $this->_connectionID != false;
- }
-
- // returns true or false
- function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
- {
-
- if (!function_exists('odbc_connect')) return null;
-
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- if ($this->debug && $argDatabasename) {
- ADOConnection::outp("For odbc PConnect(), $argDatabasename is not used. Place dsn in 1st parameter.");
- }
- // print "dsn=$argDSN u=$argUsername p=$argPassword
"; flush();
- if ($this->curmode === false) $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword);
- else $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,$this->curmode);
-
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- if ($this->_connectionID && $this->autoRollback) @odbc_rollback($this->_connectionID);
- if (isset($this->connectStmt)) $this->Execute($this->connectStmt);
-
- return $this->_connectionID != false;
- }
-
-
- function ServerInfo()
- {
-
- if (!empty($this->host) && ADODB_PHPVER >= 0x4300) {
- $dsn = strtoupper($this->host);
- $first = true;
- $found = false;
-
- if (!function_exists('odbc_data_source')) return false;
-
- while(true) {
-
- $rez = @odbc_data_source($this->_connectionID,
- $first ? SQL_FETCH_FIRST : SQL_FETCH_NEXT);
- $first = false;
- if (!is_array($rez)) break;
- if (strtoupper($rez['server']) == $dsn) {
- $found = true;
- break;
- }
- }
- if (!$found) return ADOConnection::ServerInfo();
- if (!isset($rez['version'])) $rez['version'] = '';
- return $rez;
- } else {
- return ADOConnection::ServerInfo();
- }
- }
-
-
- function CreateSequence($seqname='adodbseq',$start=1)
- {
- if (empty($this->_genSeqSQL)) return false;
- $ok = $this->Execute(sprintf($this->_genSeqSQL,$seqname));
- if (!$ok) return false;
- $start -= 1;
- return $this->Execute("insert into $seqname values($start)");
- }
-
- var $_dropSeqSQL = 'drop table %s';
- function DropSequence($seqname)
- {
- if (empty($this->_dropSeqSQL)) return false;
- return $this->Execute(sprintf($this->_dropSeqSQL,$seqname));
- }
-
- /*
- This algorithm is not very efficient, but works even if table locking
- is not available.
-
- Will return false if unable to generate an ID after $MAXLOOPS attempts.
- */
- function GenID($seq='adodbseq',$start=1)
- {
- // if you have to modify the parameter below, your database is overloaded,
- // or you need to implement generation of id's yourself!
- $MAXLOOPS = 100;
- //$this->debug=1;
- while (--$MAXLOOPS>=0) {
- $num = $this->GetOne("select id from $seq");
- if ($num === false) {
- $this->Execute(sprintf($this->_genSeqSQL ,$seq));
- $start -= 1;
- $num = '0';
- $ok = $this->Execute("insert into $seq values($start)");
- if (!$ok) return false;
- }
- $this->Execute("update $seq set id=id+1 where id=$num");
-
- if ($this->affected_rows() > 0) {
- $num += 1;
- $this->genID = $num;
- return $num;
- }
- }
- if ($fn = $this->raiseErrorFn) {
- $fn($this->databaseType,'GENID',-32000,"Unable to generate unique id after $MAXLOOPS attempts",$seq,$num);
- }
- return false;
- }
-
-
- function ErrorMsg()
- {
- if ($this->_haserrorfunctions) {
- if ($this->_errorMsg !== false) return $this->_errorMsg;
- if (empty($this->_connectionID)) return @odbc_errormsg();
- return @odbc_errormsg($this->_connectionID);
- } else return ADOConnection::ErrorMsg();
- }
-
- function ErrorNo()
- {
-
- if ($this->_haserrorfunctions) {
- if ($this->_errorCode !== false) {
- // bug in 4.0.6, error number can be corrupted string (should be 6 digits)
- return (strlen($this->_errorCode)<=2) ? 0 : $this->_errorCode;
- }
-
- if (empty($this->_connectionID)) $e = @odbc_error();
- else $e = @odbc_error($this->_connectionID);
-
- // bug in 4.0.6, error number can be corrupted string (should be 6 digits)
- // so we check and patch
- if (strlen($e)<=2) return 0;
- return $e;
- } else return ADOConnection::ErrorNo();
- }
-
-
-
- function BeginTrans()
- {
- if (!$this->hasTransactions) return false;
- if ($this->transOff) return true;
- $this->transCnt += 1;
- $this->_autocommit = false;
- return odbc_autocommit($this->_connectionID,false);
- }
-
- function CommitTrans($ok=true)
- {
- if ($this->transOff) return true;
- if (!$ok) return $this->RollbackTrans();
- if ($this->transCnt) $this->transCnt -= 1;
- $this->_autocommit = true;
- $ret = odbc_commit($this->_connectionID);
- odbc_autocommit($this->_connectionID,true);
- return $ret;
- }
-
- function RollbackTrans()
- {
- if ($this->transOff) return true;
- if ($this->transCnt) $this->transCnt -= 1;
- $this->_autocommit = true;
- $ret = odbc_rollback($this->_connectionID);
- odbc_autocommit($this->_connectionID,true);
- return $ret;
- }
-
- function MetaPrimaryKeys($table)
- {
- global $ADODB_FETCH_MODE;
-
- if ($this->uCaseTables) $table = strtoupper($table);
- $schema = '';
- $this->_findschema($table,$schema);
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $qid = @odbc_primarykeys($this->_connectionID,'',$schema,$table);
-
- if (!$qid) {
- $ADODB_FETCH_MODE = $savem;
- return false;
- }
- $rs = new ADORecordSet_odbc($qid);
- $ADODB_FETCH_MODE = $savem;
-
- if (!$rs) return false;
- $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
-
- $arr = $rs->GetArray();
- $rs->Close();
- //print_r($arr);
- $arr2 = array();
- for ($i=0; $i < sizeof($arr); $i++) {
- if ($arr[$i][3]) $arr2[] = $arr[$i][3];
- }
- return $arr2;
- }
-
-
-
- function MetaTables($ttype=false)
- {
- global $ADODB_FETCH_MODE;
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $qid = odbc_tables($this->_connectionID);
-
- $rs = new ADORecordSet_odbc($qid);
-
- $ADODB_FETCH_MODE = $savem;
- if (!$rs) {
- $false = false;
- return $false;
- }
- $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
-
- $arr = $rs->GetArray();
- //print_r($arr);
-
- $rs->Close();
- $arr2 = array();
-
- if ($ttype) {
- $isview = strncmp($ttype,'V',1) === 0;
- }
- for ($i=0; $i < sizeof($arr); $i++) {
- if (!$arr[$i][2]) continue;
- $type = $arr[$i][3];
- if ($ttype) {
- if ($isview) {
- if (strncmp($type,'V',1) === 0) $arr2[] = $arr[$i][2];
- } else if (strncmp($type,'SYS',3) !== 0) $arr2[] = $arr[$i][2];
- } else if (strncmp($type,'SYS',3) !== 0) $arr2[] = $arr[$i][2];
- }
- return $arr2;
- }
-
-/*
-See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcdatetime_data_type_changes.asp
-/ SQL data type codes /
-#define SQL_UNKNOWN_TYPE 0
-#define SQL_CHAR 1
-#define SQL_NUMERIC 2
-#define SQL_DECIMAL 3
-#define SQL_INTEGER 4
-#define SQL_SMALLINT 5
-#define SQL_FLOAT 6
-#define SQL_REAL 7
-#define SQL_DOUBLE 8
-#if (ODBCVER >= 0x0300)
-#define SQL_DATETIME 9
-#endif
-#define SQL_VARCHAR 12
-
-
-/ One-parameter shortcuts for date/time data types /
-#if (ODBCVER >= 0x0300)
-#define SQL_TYPE_DATE 91
-#define SQL_TYPE_TIME 92
-#define SQL_TYPE_TIMESTAMP 93
-
-#define SQL_UNICODE (-95)
-#define SQL_UNICODE_VARCHAR (-96)
-#define SQL_UNICODE_LONGVARCHAR (-97)
-*/
- function ODBCTypes($t)
- {
- switch ((integer)$t) {
- case 1:
- case 12:
- case 0:
- case -95:
- case -96:
- return 'C';
- case -97:
- case -1: //text
- return 'X';
- case -4: //image
- return 'B';
-
- case 9:
- case 91:
- return 'D';
-
- case 10:
- case 11:
- case 92:
- case 93:
- return 'T';
-
- case 4:
- case 5:
- case -6:
- return 'I';
-
- case -11: // uniqidentifier
- return 'R';
- case -7: //bit
- return 'L';
-
- default:
- return 'N';
- }
- }
-
- function MetaColumns($table, $normalize=true)
- {
- global $ADODB_FETCH_MODE;
-
- $false = false;
- if ($this->uCaseTables) $table = strtoupper($table);
- $schema = '';
- $this->_findschema($table,$schema);
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
-
- /*if (false) { // after testing, confirmed that the following does not work becoz of a bug
- $qid2 = odbc_tables($this->_connectionID);
- $rs = new ADORecordSet_odbc($qid2);
- $ADODB_FETCH_MODE = $savem;
- if (!$rs) return false;
- $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
- $rs->_fetch();
-
- while (!$rs->EOF) {
- if ($table == strtoupper($rs->fields[2])) {
- $q = $rs->fields[0];
- $o = $rs->fields[1];
- break;
- }
- $rs->MoveNext();
- }
- $rs->Close();
-
- $qid = odbc_columns($this->_connectionID,$q,$o,strtoupper($table),'%');
- } */
-
- switch ($this->databaseType) {
- case 'access':
- case 'vfp':
- $qid = odbc_columns($this->_connectionID);#,'%','',strtoupper($table),'%');
- break;
-
-
- case 'db2':
- $colname = "%";
- $qid = odbc_columns($this->_connectionID, "", $schema, $table, $colname);
- break;
-
- default:
- $qid = @odbc_columns($this->_connectionID,'%','%',strtoupper($table),'%');
- if (empty($qid)) $qid = odbc_columns($this->_connectionID);
- break;
- }
- if (empty($qid)) return $false;
-
- $rs = new ADORecordSet_odbc($qid);
- $ADODB_FETCH_MODE = $savem;
-
- if (!$rs) return $false;
- $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
- $rs->_fetch();
-
- $retarr = array();
-
- /*
- $rs->fields indices
- 0 TABLE_QUALIFIER
- 1 TABLE_SCHEM
- 2 TABLE_NAME
- 3 COLUMN_NAME
- 4 DATA_TYPE
- 5 TYPE_NAME
- 6 PRECISION
- 7 LENGTH
- 8 SCALE
- 9 RADIX
- 10 NULLABLE
- 11 REMARKS
- */
- while (!$rs->EOF) {
- // adodb_pr($rs->fields);
- if (strtoupper(trim($rs->fields[2])) == $table && (!$schema || strtoupper($rs->fields[1]) == $schema)) {
- $fld = new ADOFieldObject();
- $fld->name = $rs->fields[3];
- $fld->type = $this->ODBCTypes($rs->fields[4]);
-
- // ref: http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnaraccgen/html/msdn_odk.asp
- // access uses precision to store length for char/varchar
- if ($fld->type == 'C' or $fld->type == 'X') {
- if ($this->databaseType == 'access')
- $fld->max_length = $rs->fields[6];
- else if ($rs->fields[4] <= -95) // UNICODE
- $fld->max_length = $rs->fields[7]/2;
- else
- $fld->max_length = $rs->fields[7];
- } else
- $fld->max_length = $rs->fields[7];
- $fld->not_null = !empty($rs->fields[10]);
- $fld->scale = $rs->fields[8];
- $retarr[strtoupper($fld->name)] = $fld;
- } else if (sizeof($retarr)>0)
- break;
- $rs->MoveNext();
- }
- $rs->Close(); //-- crashes 4.03pl1 -- why?
-
- if (empty($retarr)) $retarr = false;
- return $retarr;
- }
-
- function Prepare($sql)
- {
- if (! $this->_bindInputArray) return $sql; // no binding
- $stmt = odbc_prepare($this->_connectionID,$sql);
- if (!$stmt) {
- // we don't know whether odbc driver is parsing prepared stmts, so just return sql
- return $sql;
- }
- return array($sql,$stmt,false);
- }
-
- /* returns queryID or false */
- function _query($sql,$inputarr=false)
- {
- $this->_error = '';
-
- if ($inputarr) {
- if (is_array($sql)) {
- $stmtid = $sql[1];
- } else {
- $stmtid = odbc_prepare($this->_connectionID,$sql);
-
- if ($stmtid == false) {
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- return false;
- }
- }
-
- if (! odbc_execute($stmtid,$inputarr)) {
- //@odbc_free_result($stmtid);
- if ($this->_haserrorfunctions) {
- $this->_errorMsg = odbc_errormsg();
- $this->_errorCode = odbc_error();
- }
- return false;
- }
-
- } else if (is_array($sql)) {
- $stmtid = $sql[1];
- if (!odbc_execute($stmtid)) {
- //@odbc_free_result($stmtid);
- if ($this->_haserrorfunctions) {
- $this->_errorMsg = odbc_errormsg();
- $this->_errorCode = odbc_error();
- }
- return false;
- }
- } else
- $stmtid = odbc_exec($this->_connectionID,$sql);
-
- $this->_lastAffectedRows = 0;
- if ($stmtid) {
- if (@odbc_num_fields($stmtid) == 0) {
- $this->_lastAffectedRows = odbc_num_rows($stmtid);
- $stmtid = true;
- } else {
- $this->_lastAffectedRows = 0;
- odbc_binmode($stmtid,$this->binmode);
- odbc_longreadlen($stmtid,$this->maxblobsize);
- }
-
- if ($this->_haserrorfunctions) {
- $this->_errorMsg = '';
- $this->_errorCode = 0;
- } else
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- } else {
- if ($this->_haserrorfunctions) {
- $this->_errorMsg = odbc_errormsg();
- $this->_errorCode = odbc_error();
- } else
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- }
- return $stmtid;
- }
-
- /*
- Insert a null into the blob field of the table first.
- Then use UpdateBlob to store the blob.
-
- Usage:
-
- $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
- $conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');
- */
- function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
- {
- return $this->Execute("UPDATE $table SET $column=? WHERE $where",array($val)) != false;
- }
-
- // returns true or false
- function _close()
- {
- $ret = @odbc_close($this->_connectionID);
- $this->_connectionID = false;
- return $ret;
- }
-
- function _affectedrows()
- {
- return $this->_lastAffectedRows;
- }
-
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordSet_odbc extends ADORecordSet {
-
- var $bind = false;
- var $databaseType = "odbc";
- var $dataProvider = "odbc";
- var $useFetchArray;
- var $_has_stupid_odbc_fetch_api_change;
-
- function __construct($id,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- $this->fetchMode = $mode;
-
- $this->_queryID = $id;
-
- // the following is required for mysql odbc driver in 4.3.1 -- why?
- $this->EOF = false;
- $this->_currentRow = -1;
- //$this->ADORecordSet($id);
- }
-
-
- // returns the field object
- function FetchField($fieldOffset = -1)
- {
-
- $off=$fieldOffset+1; // offsets begin at 1
-
- $o= new ADOFieldObject();
- $o->name = @odbc_field_name($this->_queryID,$off);
- $o->type = @odbc_field_type($this->_queryID,$off);
- $o->max_length = @odbc_field_len($this->_queryID,$off);
- if (ADODB_ASSOC_CASE == 0) $o->name = strtolower($o->name);
- else if (ADODB_ASSOC_CASE == 1) $o->name = strtoupper($o->name);
- return $o;
- }
-
- /* Use associative array to get fields array */
- function Fields($colname)
- {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) return $this->fields[$colname];
- if (!$this->bind) {
- $this->bind = array();
- for ($i=0; $i < $this->_numOfFields; $i++) {
- $o = $this->FetchField($i);
- $this->bind[strtoupper($o->name)] = $i;
- }
- }
-
- return $this->fields[$this->bind[strtoupper($colname)]];
- }
-
-
- function _initrs()
- {
- global $ADODB_COUNTRECS;
- $this->_numOfRows = ($ADODB_COUNTRECS) ? @odbc_num_rows($this->_queryID) : -1;
- $this->_numOfFields = @odbc_num_fields($this->_queryID);
- // some silly drivers such as db2 as/400 and intersystems cache return _numOfRows = 0
- if ($this->_numOfRows == 0) $this->_numOfRows = -1;
- //$this->useFetchArray = $this->connection->useFetchArray;
- $this->_has_stupid_odbc_fetch_api_change = ADODB_PHPVER >= 0x4200;
- }
-
- function _seek($row)
- {
- return false;
- }
-
- // speed up SelectLimit() by switching to ADODB_FETCH_NUM as ADODB_FETCH_ASSOC is emulated
- function GetArrayLimit($nrows,$offset=-1)
- {
- if ($offset <= 0) {
- $rs = $this->GetArray($nrows);
- return $rs;
- }
- $savem = $this->fetchMode;
- $this->fetchMode = ADODB_FETCH_NUM;
- $this->Move($offset);
- $this->fetchMode = $savem;
-
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
- $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
- }
-
- $results = array();
- $cnt = 0;
- while (!$this->EOF && $nrows != $cnt) {
- $results[$cnt++] = $this->fields;
- $this->MoveNext();
- }
-
- return $results;
- }
-
-
- function MoveNext()
- {
- if ($this->_numOfRows != 0 && !$this->EOF) {
- $this->_currentRow++;
-
- if ($this->_has_stupid_odbc_fetch_api_change)
- $rez = @odbc_fetch_into($this->_queryID,$this->fields);
- else {
- $row = 0;
- $rez = @odbc_fetch_into($this->_queryID,$row,$this->fields);
- }
- if ($rez) {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
- $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
- }
- return true;
- }
- }
- $this->fields = false;
- $this->EOF = true;
- return false;
- }
-
- function _fetch()
- {
-
- if ($this->_has_stupid_odbc_fetch_api_change)
- $rez = @odbc_fetch_into($this->_queryID,$this->fields);
- else {
- $row = 0;
- $rez = @odbc_fetch_into($this->_queryID,$row,$this->fields);
- }
- if ($rez) {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
- $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
- }
- return true;
- }
- $this->fields = false;
- return false;
- }
-
- function _close()
- {
- return @odbc_free_result($this->_queryID);
- }
-
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-odbc_db2.inc.php b/src/adodb5/drivers/adodb-odbc_db2.inc.php
deleted file mode 100644
index 4baca701..00000000
--- a/src/adodb5/drivers/adodb-odbc_db2.inc.php
+++ /dev/null
@@ -1,368 +0,0 @@
-curMode = SQL_CUR_USE_ODBC;
-$db->Connect($dsn, $userid, $pwd);
-
-
-
-USING CLI INTERFACE
-===================
-
-I have had reports that the $host and $database params have to be reversed in
-Connect() when using the CLI interface. From Halmai Csongor csongor.halmai#nexum.hu:
-
-> The symptom is that if I change the database engine from postgres or any other to DB2 then the following
-> connection command becomes wrong despite being described this version to be correct in the docs.
->
-> $connection_object->Connect( $DATABASE_HOST, $DATABASE_AUTH_USER_NAME, $DATABASE_AUTH_PASSWORD, $DATABASE_NAME )
->
-> In case of DB2 I had to swap the first and last arguments in order to connect properly.
-
-
-System Error 5
-==============
-IF you get a System Error 5 when trying to Connect/Load, it could be a permission problem. Give the user connecting
-to DB2 full rights to the DB2 SQLLIB directory, and place the user in the DBUSERS group.
-*/
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-if (!defined('_ADODB_ODBC_LAYER')) {
- include(ADODB_DIR."/drivers/adodb-odbc.inc.php");
-}
-if (!defined('ADODB_ODBC_DB2')){
-define('ADODB_ODBC_DB2',1);
-
-class ADODB_ODBC_DB2 extends ADODB_odbc {
- var $databaseType = "db2";
- var $concat_operator = '||';
- var $sysTime = 'CURRENT TIME';
- var $sysDate = 'CURRENT DATE';
- var $sysTimeStamp = 'CURRENT TIMESTAMP';
- // The complete string representation of a timestamp has the form
- // yyyy-mm-dd-hh.mm.ss.nnnnnn.
- var $fmtTimeStamp = "'Y-m-d-H.i.s'";
- var $ansiOuter = true;
- var $identitySQL = 'values IDENTITY_VAL_LOCAL()';
- var $_bindInputArray = true;
- var $hasInsertID = true;
- var $rsPrefix = 'ADORecordset_odbc_';
-
- function ADODB_DB2()
- {
- if (strncmp(PHP_OS,'WIN',3) === 0) $this->curmode = SQL_CUR_USE_ODBC;
- $this->ADODB_odbc();
- }
-
- function IfNull( $field, $ifNull )
- {
- return " COALESCE($field, $ifNull) "; // if DB2 UDB
- }
-
- function ServerInfo()
- {
- //odbc_setoption($this->_connectionID,1,101 /*SQL_ATTR_ACCESS_MODE*/, 1 /*SQL_MODE_READ_ONLY*/);
- $vers = $this->GetOne('select versionnumber from sysibm.sysversions');
- //odbc_setoption($this->_connectionID,1,101, 0 /*SQL_MODE_READ_WRITE*/);
- return array('description'=>'DB2 ODBC driver', 'version'=>$vers);
- }
-
- function _insertid()
- {
- return $this->GetOne($this->identitySQL);
- }
-
- function RowLock($tables,$where,$flds='1 as ignore')
- {
- if ($this->_autocommit) $this->BeginTrans();
- return $this->GetOne("select $flds from $tables where $where for update");
- }
-
- function MetaTables($ttype=false,$showSchema=false, $qtable="%", $qschema="%")
- {
- global $ADODB_FETCH_MODE;
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $qid = odbc_tables($this->_connectionID, "", $qschema, $qtable, "");
-
- $rs = new ADORecordSet_odbc($qid);
-
- $ADODB_FETCH_MODE = $savem;
- if (!$rs) {
- $false = false;
- return $false;
- }
- $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
-
- $arr = $rs->GetArray();
- //print_r($arr);
-
- $rs->Close();
- $arr2 = array();
-
- if ($ttype) {
- $isview = strncmp($ttype,'V',1) === 0;
- }
- for ($i=0; $i < sizeof($arr); $i++) {
-
- if (!$arr[$i][2]) continue;
- if (strncmp($arr[$i][1],'SYS',3) === 0) continue;
-
- $type = $arr[$i][3];
-
- if ($showSchema) $arr[$i][2] = $arr[$i][1].'.'.$arr[$i][2];
-
- if ($ttype) {
- if ($isview) {
- if (strncmp($type,'V',1) === 0) $arr2[] = $arr[$i][2];
- } else if (strncmp($type,'T',1) === 0) $arr2[] = $arr[$i][2];
- } else if (strncmp($type,'S',1) !== 0) $arr2[] = $arr[$i][2];
- }
- return $arr2;
- }
-
- function MetaIndexes ($table, $primary = FALSE, $owner=false)
- {
- // save old fetch mode
- global $ADODB_FETCH_MODE;
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== FALSE) {
- $savem = $this->SetFetchMode(FALSE);
- }
- $false = false;
- // get index details
- $table = strtoupper($table);
- $SQL="SELECT NAME, UNIQUERULE, COLNAMES FROM SYSIBM.SYSINDEXES WHERE TBNAME='$table'";
- if ($primary)
- $SQL.= " AND UNIQUERULE='P'";
- $rs = $this->Execute($SQL);
- if (!is_object($rs)) {
- if (isset($savem))
- $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
- return $false;
- }
- $indexes = array ();
- // parse index data into array
- while ($row = $rs->FetchRow()) {
- $indexes[$row[0]] = array(
- 'unique' => ($row[1] == 'U' || $row[1] == 'P'),
- 'columns' => array()
- );
- $cols = ltrim($row[2],'+');
- $indexes[$row[0]]['columns'] = explode('+', $cols);
- }
- if (isset($savem)) {
- $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
- }
- return $indexes;
- }
-
- // Format date column in sql string given an input format that understands Y M D
- function SQLDate($fmt, $col=false)
- {
- // use right() and replace() ?
- if (!$col) $col = $this->sysDate;
- $s = '';
-
- $len = strlen($fmt);
- for ($i=0; $i < $len; $i++) {
- if ($s) $s .= '||';
- $ch = $fmt[$i];
- switch($ch) {
- case 'Y':
- case 'y':
- $s .= "char(year($col))";
- break;
- case 'M':
- $s .= "substr(monthname($col),1,3)";
- break;
- case 'm':
- $s .= "right(digits(month($col)),2)";
- break;
- case 'D':
- case 'd':
- $s .= "right(digits(day($col)),2)";
- break;
- case 'H':
- case 'h':
- if ($col != $this->sysDate) $s .= "right(digits(hour($col)),2)";
- else $s .= "''";
- break;
- case 'i':
- case 'I':
- if ($col != $this->sysDate)
- $s .= "right(digits(minute($col)),2)";
- else $s .= "''";
- break;
- case 'S':
- case 's':
- if ($col != $this->sysDate)
- $s .= "right(digits(second($col)),2)";
- else $s .= "''";
- break;
- default:
- if ($ch == '\\') {
- $i++;
- $ch = substr($fmt,$i,1);
- }
- $s .= $this->qstr($ch);
- }
- }
- return $s;
- }
-
-
- function SelectLimit($sql,$nrows=-1,$offset=-1,$inputArr=false)
- {
- $nrows = (integer) $nrows;
- if ($offset <= 0) {
- // could also use " OPTIMIZE FOR $nrows ROWS "
- if ($nrows >= 0) $sql .= " FETCH FIRST $nrows ROWS ONLY ";
- $rs = $this->Execute($sql,$inputArr);
- } else {
- if ($offset > 0 && $nrows < 0);
- else {
- $nrows += $offset;
- $sql .= " FETCH FIRST $nrows ROWS ONLY ";
- }
- $rs = ADOConnection::SelectLimit($sql,-1,$offset,$inputArr);
- }
-
- return $rs;
- }
-
-};
-
-
-class ADORecordSet_odbc_db2 extends ADORecordSet_odbc {
-
- var $databaseType = "db2";
-
- function ADORecordSet_db2($id,$mode=false)
- {
- $this->ADORecordSet_odbc($id,$mode);
- }
-
- function MetaType($t,$len=-1,$fieldobj=false)
- {
- if (is_object($t)) {
- $fieldobj = $t;
- $t = $fieldobj->type;
- $len = $fieldobj->max_length;
- }
-
- switch (strtoupper($t)) {
- case 'VARCHAR':
- case 'CHAR':
- case 'CHARACTER':
- case 'C':
- if ($len <= $this->blobSize) return 'C';
-
- case 'LONGCHAR':
- case 'TEXT':
- case 'CLOB':
- case 'DBCLOB': // double-byte
- case 'X':
- return 'X';
-
- case 'BLOB':
- case 'GRAPHIC':
- case 'VARGRAPHIC':
- return 'B';
-
- case 'DATE':
- case 'D':
- return 'D';
-
- case 'TIME':
- case 'TIMESTAMP':
- case 'T':
- return 'T';
-
- //case 'BOOLEAN':
- //case 'BIT':
- // return 'L';
-
- //case 'COUNTER':
- // return 'R';
-
- case 'INT':
- case 'INTEGER':
- case 'BIGINT':
- case 'SMALLINT':
- case 'I':
- return 'I';
-
- default: return 'N';
- }
- }
-}
-
-} //define
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-odbc_mssql.inc.php b/src/adodb5/drivers/adodb-odbc_mssql.inc.php
deleted file mode 100644
index 521ae9a1..00000000
--- a/src/adodb5/drivers/adodb-odbc_mssql.inc.php
+++ /dev/null
@@ -1,306 +0,0 @@
-ADODB_odbc();
- //$this->curmode = SQL_CUR_USE_ODBC;
- }
-
- // crashes php...
- function ServerInfo()
- {
- global $ADODB_FETCH_MODE;
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $row = $this->GetRow("execute sp_server_info 2");
- $ADODB_FETCH_MODE = $save;
- if (!is_array($row)) return false;
- $arr['description'] = $row[2];
- $arr['version'] = ADOConnection::_findvers($arr['description']);
- return $arr;
- }
-
- function IfNull( $field, $ifNull )
- {
- return " ISNULL($field, $ifNull) "; // if MS SQL Server
- }
-
- function _insertid()
- {
- // SCOPE_IDENTITY()
- // Returns the last IDENTITY value inserted into an IDENTITY column in
- // the same scope. A scope is a module -- a stored procedure, trigger,
- // function, or batch. Thus, two statements are in the same scope if
- // they are in the same stored procedure, function, or batch.
- return $this->GetOne($this->identitySQL);
- }
-
-
- function MetaForeignKeys($table, $owner=false, $upper=false)
- {
- global $ADODB_FETCH_MODE;
-
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $table = $this->qstr(strtoupper($table));
-
- $sql =
-"select object_name(constid) as constraint_name,
- col_name(fkeyid, fkey) as column_name,
- object_name(rkeyid) as referenced_table_name,
- col_name(rkeyid, rkey) as referenced_column_name
-from sysforeignkeys
-where upper(object_name(fkeyid)) = $table
-order by constraint_name, referenced_table_name, keyno";
-
- $constraints = $this->GetArray($sql);
-
- $ADODB_FETCH_MODE = $save;
-
- $arr = false;
- foreach($constraints as $constr) {
- //print_r($constr);
- $arr[$constr[0]][$constr[2]][] = $constr[1].'='.$constr[3];
- }
- if (!$arr) return false;
-
- $arr2 = false;
-
- foreach($arr as $k => $v) {
- foreach($v as $a => $b) {
- if ($upper) $a = strtoupper($a);
- $arr2[$a] = $b;
- }
- }
- return $arr2;
- }
-
- function MetaTables($ttype=false,$showSchema=false,$mask=false)
- {
- if ($mask) {$this->debug=1;
- $save = $this->metaTablesSQL;
- $mask = $this->qstr($mask);
- $this->metaTablesSQL .= " AND name like $mask";
- }
- $ret = ADOConnection::MetaTables($ttype,$showSchema);
-
- if ($mask) {
- $this->metaTablesSQL = $save;
- }
- return $ret;
- }
-
- function MetaColumns($table, $normalize=true)
- {
- $arr = ADOConnection::MetaColumns($table);
- return $arr;
- }
-
-
- function MetaIndexes($table,$primary=false, $owner=false)
- {
- $table = $this->qstr($table);
-
- $sql = "SELECT i.name AS ind_name, C.name AS col_name, USER_NAME(O.uid) AS Owner, c.colid, k.Keyno,
- CASE WHEN I.indid BETWEEN 1 AND 254 AND (I.status & 2048 = 2048 OR I.Status = 16402 AND O.XType = 'V') THEN 1 ELSE 0 END AS IsPK,
- CASE WHEN I.status & 2 = 2 THEN 1 ELSE 0 END AS IsUnique
- FROM dbo.sysobjects o INNER JOIN dbo.sysindexes I ON o.id = i.id
- INNER JOIN dbo.sysindexkeys K ON I.id = K.id AND I.Indid = K.Indid
- INNER JOIN dbo.syscolumns c ON K.id = C.id AND K.colid = C.Colid
- WHERE LEFT(i.name, 8) <> '_WA_Sys_' AND o.status >= 0 AND O.Name LIKE $table
- ORDER BY O.name, I.Name, K.keyno";
-
- global $ADODB_FETCH_MODE;
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== FALSE) {
- $savem = $this->SetFetchMode(FALSE);
- }
-
- $rs = $this->Execute($sql);
- if (isset($savem)) {
- $this->SetFetchMode($savem);
- }
- $ADODB_FETCH_MODE = $save;
-
- if (!is_object($rs)) {
- return FALSE;
- }
-
- $indexes = array();
- while ($row = $rs->FetchRow()) {
- if (!$primary && $row[5]) continue;
-
- $indexes[$row[0]]['unique'] = $row[6];
- $indexes[$row[0]]['columns'][] = $row[1];
- }
- return $indexes;
- }
-
- function _query($sql,$inputarr=false)
- {
- if (is_string($sql)) $sql = str_replace('||','+',$sql);
- return ADODB_odbc::_query($sql,$inputarr);
- }
-
- function SetTransactionMode( $transaction_mode )
- {
- $this->_transmode = $transaction_mode;
- if (empty($transaction_mode)) {
- $this->Execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
- return;
- }
- if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
- $this->Execute("SET TRANSACTION ".$transaction_mode);
- }
-
- // "Stein-Aksel Basma"
- // tested with MSSQL 2000
- function MetaPrimaryKeys($table)
- {
- global $ADODB_FETCH_MODE;
-
- $schema = '';
- $this->_findschema($table,$schema);
- //if (!$schema) $schema = $this->database;
- if ($schema) $schema = "and k.table_catalog like '$schema%'";
-
- $sql = "select distinct k.column_name,ordinal_position from information_schema.key_column_usage k,
- information_schema.table_constraints tc
- where tc.constraint_name = k.constraint_name and tc.constraint_type =
- 'PRIMARY KEY' and k.table_name = '$table' $schema order by ordinal_position ";
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
- $a = $this->GetCol($sql);
- $ADODB_FETCH_MODE = $savem;
-
- if ($a && sizeof($a)>0) return $a;
- $false = false;
- return $false;
- }
-
- function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
- {
- if ($nrows > 0 && $offset <= 0) {
- $sql = preg_replace(
- '/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop." $nrows ",$sql);
- $rs = $this->Execute($sql,$inputarr);
- } else
- $rs = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
-
- return $rs;
- }
-
- // Format date column in sql string given an input format that understands Y M D
- function SQLDate($fmt, $col=false)
- {
- if (!$col) $col = $this->sysTimeStamp;
- $s = '';
-
- $len = strlen($fmt);
- for ($i=0; $i < $len; $i++) {
- if ($s) $s .= '+';
- $ch = $fmt[$i];
- switch($ch) {
- case 'Y':
- case 'y':
- $s .= "datename(yyyy,$col)";
- break;
- case 'M':
- $s .= "convert(char(3),$col,0)";
- break;
- case 'm':
- $s .= "replace(str(month($col),2),' ','0')";
- break;
- case 'Q':
- case 'q':
- $s .= "datename(quarter,$col)";
- break;
- case 'D':
- case 'd':
- $s .= "replace(str(day($col),2),' ','0')";
- break;
- case 'h':
- $s .= "substring(convert(char(14),$col,0),13,2)";
- break;
-
- case 'H':
- $s .= "replace(str(datepart(hh,$col),2),' ','0')";
- break;
-
- case 'i':
- $s .= "replace(str(datepart(mi,$col),2),' ','0')";
- break;
- case 's':
- $s .= "replace(str(datepart(ss,$col),2),' ','0')";
- break;
- case 'a':
- case 'A':
- $s .= "substring(convert(char(19),$col,0),18,2)";
- break;
-
- default:
- if ($ch == '\\') {
- $i++;
- $ch = substr($fmt,$i,1);
- }
- $s .= $this->qstr($ch);
- break;
- }
- }
- return $s;
- }
-
-}
-
-class ADORecordSet_odbc_mssql extends ADORecordSet_odbc {
-
- var $databaseType = 'odbc_mssql';
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_odbc($id,$mode);
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-odbc_oracle.inc.php b/src/adodb5/drivers/adodb-odbc_oracle.inc.php
deleted file mode 100644
index 28cee9a9..00000000
--- a/src/adodb5/drivers/adodb-odbc_oracle.inc.php
+++ /dev/null
@@ -1,110 +0,0 @@
-ADODB_odbc();
- }
-
- function MetaTables()
- {
- $false = false;
- $rs = $this->Execute($this->metaTablesSQL);
- if ($rs === false) return $false;
- $arr = $rs->GetArray();
- $arr2 = array();
- for ($i=0; $i < sizeof($arr); $i++) {
- $arr2[] = $arr[$i][0];
- }
- $rs->Close();
- return $arr2;
- }
-
- function MetaColumns($table, $normalize=true)
- {
- global $ADODB_FETCH_MODE;
-
- $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
- if ($rs === false) {
- $false = false;
- return $false;
- }
- $retarr = array();
- while (!$rs->EOF) { //print_r($rs->fields);
- $fld = new ADOFieldObject();
- $fld->name = $rs->fields[0];
- $fld->type = $rs->fields[1];
- $fld->max_length = $rs->fields[2];
-
-
- if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
- else $retarr[strtoupper($fld->name)] = $fld;
-
- $rs->MoveNext();
- }
- $rs->Close();
- return $retarr;
- }
-
- // returns true or false
- function _connect($argDSN, $argUsername, $argPassword, $argDatabasename)
- {
- $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC );
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
-
- $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
- //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
- return $this->_connectionID != false;
- }
- // returns true or false
- function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
- {
- $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC );
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
-
- $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
- //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
- return $this->_connectionID != false;
- }
-}
-
-class ADORecordSet_odbc_oracle extends ADORecordSet_odbc {
-
- var $databaseType = 'odbc_oracle';
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_odbc($id,$mode);
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-odbtp.inc.php b/src/adodb5/drivers/adodb-odbtp.inc.php
deleted file mode 100644
index 938aaefc..00000000
--- a/src/adodb5/drivers/adodb-odbtp.inc.php
+++ /dev/null
@@ -1,834 +0,0 @@
-
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-define("_ADODB_ODBTP_LAYER", 2 );
-
-class ADODB_odbtp extends ADOConnection{
- var $databaseType = "odbtp";
- var $dataProvider = "odbtp";
- var $fmtDate = "'Y-m-d'";
- var $fmtTimeStamp = "'Y-m-d, h:i:sA'";
- var $replaceQuote = "''"; // string to use to replace quotes
- var $odbc_driver = 0;
- var $hasAffectedRows = true;
- var $hasInsertID = false;
- var $hasGenID = true;
- var $hasMoveFirst = true;
-
- var $_genSeqSQL = "create table %s (seq_name char(30) not null unique , seq_value integer not null)";
- var $_dropSeqSQL = "delete from adodb_seq where seq_name = '%s'";
- var $_bindInputArray = false;
- var $_useUnicodeSQL = false;
- var $_canPrepareSP = false;
- var $_dontPoolDBC = true;
-
- function __construct()
- {
- }
-
- function ServerInfo()
- {
- return array('description' => @odbtp_get_attr( ODB_ATTR_DBMSNAME, $this->_connectionID),
- 'version' => @odbtp_get_attr( ODB_ATTR_DBMSVER, $this->_connectionID));
- }
-
- function ErrorMsg()
- {
- if ($this->_errorMsg !== false) return $this->_errorMsg;
- if (empty($this->_connectionID)) return @odbtp_last_error();
- return @odbtp_last_error($this->_connectionID);
- }
-
- function ErrorNo()
- {
- if ($this->_errorCode !== false) return $this->_errorCode;
- if (empty($this->_connectionID)) return @odbtp_last_error_state();
- return @odbtp_last_error_state($this->_connectionID);
- }
-/*
- function DBDate($d,$isfld=false)
- {
- if (empty($d) && $d !== 0) return 'null';
- if ($isfld) return "convert(date, $d, 120)";
-
- if (is_string($d)) $d = ADORecordSet::UnixDate($d);
- $d = adodb_date($this->fmtDate,$d);
- return "convert(date, $d, 120)";
- }
-
- function DBTimeStamp($d,$isfld=false)
- {
- if (empty($d) && $d !== 0) return 'null';
- if ($isfld) return "convert(datetime, $d, 120)";
-
- if (is_string($d)) $d = ADORecordSet::UnixDate($d);
- $d = adodb_date($this->fmtDate,$d);
- return "convert(datetime, $d, 120)";
- }
-*/
-
- function _insertid()
- {
- // SCOPE_IDENTITY()
- // Returns the last IDENTITY value inserted into an IDENTITY column in
- // the same scope. A scope is a module -- a stored procedure, trigger,
- // function, or batch. Thus, two statements are in the same scope if
- // they are in the same stored procedure, function, or batch.
- return $this->GetOne($this->identitySQL);
- }
-
- function _affectedrows()
- {
- if ($this->_queryID) {
- return @odbtp_affected_rows ($this->_queryID);
- } else
- return 0;
- }
-
- function CreateSequence($seqname='adodbseq',$start=1)
- {
- //verify existence
- $num = $this->GetOne("select seq_value from adodb_seq");
- $seqtab='adodb_seq';
- if( $this->odbc_driver == ODB_DRIVER_FOXPRO ) {
- $path = @odbtp_get_attr( ODB_ATTR_DATABASENAME, $this->_connectionID );
- //if using vfp dbc file
- if( !strcasecmp(strrchr($path, '.'), '.dbc') )
- $path = substr($path,0,strrpos($path,'\/'));
- $seqtab = $path . '/' . $seqtab;
- }
- if($num == false) {
- if (empty($this->_genSeqSQL)) return false;
- $ok = $this->Execute(sprintf($this->_genSeqSQL ,$seqtab));
- }
- $num = $this->GetOne("select seq_value from adodb_seq where seq_name='$seqname'");
- if ($num) {
- return false;
- }
- $start -= 1;
- return $this->Execute("insert into adodb_seq values('$seqname',$start)");
- }
-
- function DropSequence($seqname)
- {
- if (empty($this->_dropSeqSQL)) return false;
- return $this->Execute(sprintf($this->_dropSeqSQL,$seqname));
- }
-
- function GenID($seq='adodbseq',$start=1)
- {
- $seqtab='adodb_seq';
- if( $this->odbc_driver == ODB_DRIVER_FOXPRO) {
- $path = @odbtp_get_attr( ODB_ATTR_DATABASENAME, $this->_connectionID );
- //if using vfp dbc file
- if( !strcasecmp(strrchr($path, '.'), '.dbc') )
- $path = substr($path,0,strrpos($path,'\/'));
- $seqtab = $path . '/' . $seqtab;
- }
- $MAXLOOPS = 100;
- while (--$MAXLOOPS>=0) {
- $num = $this->GetOne("select seq_value from adodb_seq where seq_name='$seq'");
- if ($num === false) {
- //verify if abodb_seq table exist
- $ok = $this->GetOne("select seq_value from adodb_seq ");
- if(!$ok) {
- //creating the sequence table adodb_seq
- $this->Execute(sprintf($this->_genSeqSQL ,$seqtab));
- }
- $start -= 1;
- $num = '0';
- $ok = $this->Execute("insert into adodb_seq values('$seq',$start)");
- if (!$ok) return false;
- }
- $ok = $this->Execute("update adodb_seq set seq_value=seq_value+1 where seq_name='$seq'");
- if($ok) {
- $num += 1;
- $this->genID = $num;
- return $num;
- }
- }
- if ($fn = $this->raiseErrorFn) {
- $fn($this->databaseType,'GENID',-32000,"Unable to generate unique id after $MAXLOOPS attempts",$seq,$num);
- }
- return false;
- }
-
- //example for $UserOrDSN
- //for visual fox : DRIVER={Microsoft Visual FoxPro Driver};SOURCETYPE=DBF;SOURCEDB=c:\YourDbfFileDir;EXCLUSIVE=NO;
- //for visual fox dbc: DRIVER={Microsoft Visual FoxPro Driver};SOURCETYPE=DBC;SOURCEDB=c:\YourDbcFileDir\mydb.dbc;EXCLUSIVE=NO;
- //for access : DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\path_to_access_db\base_test.mdb;UID=root;PWD=;
- //for mssql : DRIVER={SQL Server};SERVER=myserver;UID=myuid;PWD=mypwd;DATABASE=OdbtpTest;
- //if uid & pwd can be separate
- function _connect($HostOrInterface, $UserOrDSN='', $argPassword='', $argDatabase='')
- {
- $this->_connectionID = odbtp_connect($HostOrInterface,$UserOrDSN,$argPassword,$argDatabase);
- if ($this->_connectionID === false) {
- $this->_errorMsg = $this->ErrorMsg() ;
- return false;
- }
-
- odbtp_convert_datetime($this->_connectionID,true);
-
- if ($this->_dontPoolDBC) {
- if (function_exists('odbtp_dont_pool_dbc'))
- @odbtp_dont_pool_dbc($this->_connectionID);
- }
- else {
- $this->_dontPoolDBC = true;
- }
- $this->odbc_driver = @odbtp_get_attr(ODB_ATTR_DRIVER, $this->_connectionID);
- $dbms = strtolower(@odbtp_get_attr(ODB_ATTR_DBMSNAME, $this->_connectionID));
- $this->odbc_name = $dbms;
-
- // Account for inconsistent DBMS names
- if( $this->odbc_driver == ODB_DRIVER_ORACLE )
- $dbms = 'oracle';
- else if( $this->odbc_driver == ODB_DRIVER_SYBASE )
- $dbms = 'sybase';
-
- // Set DBMS specific attributes
- switch( $dbms ) {
- case 'microsoft sql server':
- $this->databaseType = 'odbtp_mssql';
- $this->fmtDate = "'Y-m-d'";
- $this->fmtTimeStamp = "'Y-m-d h:i:sA'";
- $this->sysDate = 'convert(datetime,convert(char,GetDate(),102),102)';
- $this->sysTimeStamp = 'GetDate()';
- $this->ansiOuter = true;
- $this->leftOuter = '*=';
- $this->rightOuter = '=*';
- $this->hasTop = 'top';
- $this->hasInsertID = true;
- $this->hasTransactions = true;
- $this->_bindInputArray = true;
- $this->_canSelectDb = true;
- $this->substr = "substring";
- $this->length = 'len';
- $this->identitySQL = 'select SCOPE_IDENTITY()';
- $this->metaDatabasesSQL = "select name from master..sysdatabases where name <> 'master'";
- $this->_canPrepareSP = true;
- break;
- case 'access':
- $this->databaseType = 'odbtp_access';
- $this->fmtDate = "#Y-m-d#";
- $this->fmtTimeStamp = "#Y-m-d h:i:sA#";
- $this->sysDate = "FORMAT(NOW,'yyyy-mm-dd')";
- $this->sysTimeStamp = 'NOW';
- $this->hasTop = 'top';
- $this->hasTransactions = false;
- $this->_canPrepareSP = true; // For MS Access only.
- break;
- case 'visual foxpro':
- $this->databaseType = 'odbtp_vfp';
- $this->fmtDate = "{^Y-m-d}";
- $this->fmtTimeStamp = "{^Y-m-d, h:i:sA}";
- $this->sysDate = 'date()';
- $this->sysTimeStamp = 'datetime()';
- $this->ansiOuter = true;
- $this->hasTop = 'top';
- $this->hasTransactions = false;
- $this->replaceQuote = "'+chr(39)+'";
- $this->true = '.T.';
- $this->false = '.F.';
-
- break;
- case 'oracle':
- $this->databaseType = 'odbtp_oci8';
- $this->fmtDate = "'Y-m-d 00:00:00'";
- $this->fmtTimeStamp = "'Y-m-d h:i:sA'";
- $this->sysDate = 'TRUNC(SYSDATE)';
- $this->sysTimeStamp = 'SYSDATE';
- $this->hasTransactions = true;
- $this->_bindInputArray = true;
- $this->concat_operator = '||';
- break;
- case 'sybase':
- $this->databaseType = 'odbtp_sybase';
- $this->fmtDate = "'Y-m-d'";
- $this->fmtTimeStamp = "'Y-m-d H:i:s'";
- $this->sysDate = 'GetDate()';
- $this->sysTimeStamp = 'GetDate()';
- $this->leftOuter = '*=';
- $this->rightOuter = '=*';
- $this->hasInsertID = true;
- $this->hasTransactions = true;
- $this->identitySQL = 'select SCOPE_IDENTITY()';
- break;
- default:
- $this->databaseType = 'odbtp';
- if( @odbtp_get_attr(ODB_ATTR_TXNCAPABLE, $this->_connectionID) )
- $this->hasTransactions = true;
- else
- $this->hasTransactions = false;
- }
- @odbtp_set_attr(ODB_ATTR_FULLCOLINFO, TRUE, $this->_connectionID );
-
- if ($this->_useUnicodeSQL )
- @odbtp_set_attr(ODB_ATTR_UNICODESQL, TRUE, $this->_connectionID);
-
- return true;
- }
-
- function _pconnect($HostOrInterface, $UserOrDSN='', $argPassword='', $argDatabase='')
- {
- $this->_dontPoolDBC = false;
- return $this->_connect($HostOrInterface, $UserOrDSN, $argPassword, $argDatabase);
- }
-
- function SelectDB($dbName)
- {
- if (!@odbtp_select_db($dbName, $this->_connectionID)) {
- return false;
- }
- $this->database = $dbName;
- $this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions
- return true;
- }
-
- function MetaTables($ttype='',$showSchema=false,$mask=false)
- {
- global $ADODB_FETCH_MODE;
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== false) $savefm = $this->SetFetchMode(false);
-
- $arr = $this->GetArray("||SQLTables||||$ttype");
-
- if (isset($savefm)) $this->SetFetchMode($savefm);
- $ADODB_FETCH_MODE = $savem;
-
- $arr2 = array();
- for ($i=0; $i < sizeof($arr); $i++) {
- if ($arr[$i][3] == 'SYSTEM TABLE' ) continue;
- if ($arr[$i][2])
- $arr2[] = $showSchema && $arr[$i][1]? $arr[$i][1].'.'.$arr[$i][2] : $arr[$i][2];
- }
- return $arr2;
- }
-
- function MetaColumns($table,$upper=true)
- {
- global $ADODB_FETCH_MODE;
-
- $schema = false;
- $this->_findschema($table,$schema);
- if ($upper) $table = strtoupper($table);
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== false) $savefm = $this->SetFetchMode(false);
-
- $rs = $this->Execute( "||SQLColumns||$schema|$table" );
-
- if (isset($savefm)) $this->SetFetchMode($savefm);
- $ADODB_FETCH_MODE = $savem;
-
- if (!$rs || $rs->EOF) {
- $false = false;
- return $false;
- }
- $retarr = array();
- while (!$rs->EOF) {
- //print_r($rs->fields);
- if (strtoupper($rs->fields[2]) == $table) {
- $fld = new ADOFieldObject();
- $fld->name = $rs->fields[3];
- $fld->type = $rs->fields[5];
- $fld->max_length = $rs->fields[6];
- $fld->not_null = !empty($rs->fields[9]);
- $fld->scale = $rs->fields[7];
- if (isset($rs->fields[12])) // vfp does not have field 12
- if (!is_null($rs->fields[12])) {
- $fld->has_default = true;
- $fld->default_value = $rs->fields[12];
- }
- $retarr[strtoupper($fld->name)] = $fld;
- } else if (!empty($retarr))
- break;
- $rs->MoveNext();
- }
- $rs->Close();
-
- return $retarr;
- }
-
- function MetaPrimaryKeys($table, $owner='')
- {
- global $ADODB_FETCH_MODE;
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $arr = $this->GetArray("||SQLPrimaryKeys||$owner|$table");
- $ADODB_FETCH_MODE = $savem;
-
- //print_r($arr);
- $arr2 = array();
- for ($i=0; $i < sizeof($arr); $i++) {
- if ($arr[$i][3]) $arr2[] = $arr[$i][3];
- }
- return $arr2;
- }
-
- function MetaForeignKeys($table, $owner='', $upper=false)
- {
- global $ADODB_FETCH_MODE;
-
- $savem = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $constraints = $this->GetArray("||SQLForeignKeys|||||$owner|$table");
- $ADODB_FETCH_MODE = $savem;
-
- $arr = false;
- foreach($constraints as $constr) {
- //print_r($constr);
- $arr[$constr[11]][$constr[2]][] = $constr[7].'='.$constr[3];
- }
- if (!$arr) {
- $false = false;
- return $false;
- }
-
- $arr2 = array();
-
- foreach($arr as $k => $v) {
- foreach($v as $a => $b) {
- if ($upper) $a = strtoupper($a);
- $arr2[$a] = $b;
- }
- }
- return $arr2;
- }
-
- function BeginTrans()
- {
- if (!$this->hasTransactions) return false;
- if ($this->transOff) return true;
- $this->transCnt += 1;
- $this->autoCommit = false;
- if (defined('ODB_TXN_DEFAULT'))
- $txn = ODB_TXN_DEFAULT;
- else
- $txn = ODB_TXN_READUNCOMMITTED;
- $rs = @odbtp_set_attr(ODB_ATTR_TRANSACTIONS,$txn,$this->_connectionID);
- if(!$rs) return false;
- return true;
- }
-
- function CommitTrans($ok=true)
- {
- if ($this->transOff) return true;
- if (!$ok) return $this->RollbackTrans();
- if ($this->transCnt) $this->transCnt -= 1;
- $this->autoCommit = true;
- if( ($ret = @odbtp_commit($this->_connectionID)) )
- $ret = @odbtp_set_attr(ODB_ATTR_TRANSACTIONS, ODB_TXN_NONE, $this->_connectionID);//set transaction off
- return $ret;
- }
-
- function RollbackTrans()
- {
- if ($this->transOff) return true;
- if ($this->transCnt) $this->transCnt -= 1;
- $this->autoCommit = true;
- if( ($ret = @odbtp_rollback($this->_connectionID)) )
- $ret = @odbtp_set_attr(ODB_ATTR_TRANSACTIONS, ODB_TXN_NONE, $this->_connectionID);//set transaction off
- return $ret;
- }
-
- function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
- {
- // TOP requires ORDER BY for Visual FoxPro
- if( $this->odbc_driver == ODB_DRIVER_FOXPRO ) {
- if (!preg_match('/ORDER[ \t\r\n]+BY/is',$sql)) $sql .= ' ORDER BY 1';
- }
- $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
- return $ret;
- }
-
- function Prepare($sql)
- {
- if (! $this->_bindInputArray) return $sql; // no binding
-
- $this->_errorMsg = false;
- $this->_errorCode = false;
-
- $stmt = @odbtp_prepare($sql,$this->_connectionID);
- if (!$stmt) {
- // print "Prepare Error for ($sql) ".$this->ErrorMsg()."
";
- return $sql;
- }
- return array($sql,$stmt,false);
- }
-
- function PrepareSP($sql)
- {
- if (!$this->_canPrepareSP) return $sql; // Can't prepare procedures
-
- $this->_errorMsg = false;
- $this->_errorCode = false;
-
- $stmt = @odbtp_prepare_proc($sql,$this->_connectionID);
- if (!$stmt) return false;
- return array($sql,$stmt);
- }
-
- /*
- Usage:
- $stmt = $db->PrepareSP('SP_RUNSOMETHING'); -- takes 2 params, @myid and @group
-
- # note that the parameter does not have @ in front!
- $db->Parameter($stmt,$id,'myid');
- $db->Parameter($stmt,$group,'group',false,64);
- $db->Parameter($stmt,$group,'photo',false,100000,ODB_BINARY);
- $db->Execute($stmt);
-
- @param $stmt Statement returned by Prepare() or PrepareSP().
- @param $var PHP variable to bind to. Can set to null (for isNull support).
- @param $name Name of stored procedure variable name to bind to.
- @param [$isOutput] Indicates direction of parameter 0/false=IN 1=OUT 2= IN/OUT. This is ignored in odbtp.
- @param [$maxLen] Holds an maximum length of the variable.
- @param [$type] The data type of $var. Legal values depend on driver.
-
- See odbtp_attach_param documentation at http://odbtp.sourceforge.net.
- */
- function Parameter(&$stmt, &$var, $name, $isOutput=false, $maxLen=0, $type=0)
- {
- if ( $this->odbc_driver == ODB_DRIVER_JET ) {
- $name = '['.$name.']';
- if( !$type && $this->_useUnicodeSQL
- && @odbtp_param_bindtype($stmt[1], $name) == ODB_CHAR )
- {
- $type = ODB_WCHAR;
- }
- }
- else {
- $name = '@'.$name;
- }
- return @odbtp_attach_param($stmt[1], $name, $var, $type, $maxLen);
- }
-
- /*
- Insert a null into the blob field of the table first.
- Then use UpdateBlob to store the blob.
-
- Usage:
-
- $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
- $conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');
- */
-
- function UpdateBlob($table,$column,$val,$where,$blobtype='image')
- {
- $sql = "UPDATE $table SET $column = ? WHERE $where";
- if( !($stmt = @odbtp_prepare($sql, $this->_connectionID)) )
- return false;
- if( !@odbtp_input( $stmt, 1, ODB_BINARY, 1000000, $blobtype ) )
- return false;
- if( !@odbtp_set( $stmt, 1, $val ) )
- return false;
- return @odbtp_execute( $stmt ) != false;
- }
-
- function MetaIndexes($table,$primary=false, $owner=false)
- {
- switch ( $this->odbc_driver) {
- case ODB_DRIVER_MSSQL:
- return $this->MetaIndexes_mssql($table, $primary);
- default:
- return array();
- }
- }
-
- function MetaIndexes_mssql($table,$primary=false)
- {
- $table = strtolower($this->qstr($table));
-
- $sql = "SELECT i.name AS ind_name, C.name AS col_name, USER_NAME(O.uid) AS Owner, c.colid, k.Keyno,
- CASE WHEN I.indid BETWEEN 1 AND 254 AND (I.status & 2048 = 2048 OR I.Status = 16402 AND O.XType = 'V') THEN 1 ELSE 0 END AS IsPK,
- CASE WHEN I.status & 2 = 2 THEN 1 ELSE 0 END AS IsUnique
- FROM dbo.sysobjects o INNER JOIN dbo.sysindexes I ON o.id = i.id
- INNER JOIN dbo.sysindexkeys K ON I.id = K.id AND I.Indid = K.Indid
- INNER JOIN dbo.syscolumns c ON K.id = C.id AND K.colid = C.Colid
- WHERE LEFT(i.name, 8) <> '_WA_Sys_' AND o.status >= 0 AND lower(O.Name) = $table
- ORDER BY O.name, I.Name, K.keyno";
-
- global $ADODB_FETCH_MODE;
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== FALSE) {
- $savem = $this->SetFetchMode(FALSE);
- }
-
- $rs = $this->Execute($sql);
- if (isset($savem)) {
- $this->SetFetchMode($savem);
- }
- $ADODB_FETCH_MODE = $save;
-
- if (!is_object($rs)) {
- return FALSE;
- }
-
- $indexes = array();
- while ($row = $rs->FetchRow()) {
- if ($primary && !$row[5]) continue;
-
- $indexes[$row[0]]['unique'] = $row[6];
- $indexes[$row[0]]['columns'][] = $row[1];
- }
- return $indexes;
- }
-
- function IfNull( $field, $ifNull )
- {
- switch( $this->odbc_driver ) {
- case ODB_DRIVER_MSSQL:
- return " ISNULL($field, $ifNull) ";
- case ODB_DRIVER_JET:
- return " IIF(IsNull($field), $ifNull, $field) ";
- }
- return " CASE WHEN $field is null THEN $ifNull ELSE $field END ";
- }
-
- function _query($sql,$inputarr=false)
- {
- $this->_errorMsg = false;
- $this->_errorCode = false;
-
- if ($inputarr) {
- if (is_array($sql)) {
- $stmtid = $sql[1];
- } else {
- $stmtid = @odbtp_prepare($sql,$this->_connectionID);
- if ($stmtid == false) {
- $this->_errorMsg = error_get_last() !== null ? error_get_last()['message'] : '';
- return false;
- }
- }
- $num_params = @odbtp_num_params( $stmtid );
- /*
- for( $param = 1; $param <= $num_params; $param++ ) {
- @odbtp_input( $stmtid, $param );
- @odbtp_set( $stmtid, $param, $inputarr[$param-1] );
- }*/
-
- $param = 1;
- foreach($inputarr as $v) {
- @odbtp_input( $stmtid, $param );
- @odbtp_set( $stmtid, $param, $v );
- $param += 1;
- if ($param > $num_params) break;
- }
-
- if (!@odbtp_execute($stmtid) ) {
- return false;
- }
- } else if (is_array($sql)) {
- $stmtid = $sql[1];
- if (!@odbtp_execute($stmtid)) {
- return false;
- }
- } else {
- $stmtid = odbtp_query($sql,$this->_connectionID);
- }
- $this->_lastAffectedRows = 0;
- if ($stmtid) {
- $this->_lastAffectedRows = @odbtp_affected_rows($stmtid);
- }
- return $stmtid;
- }
-
- function _close()
- {
- $ret = @odbtp_close($this->_connectionID);
- $this->_connectionID = false;
- return $ret;
- }
-}
-
-class ADORecordSet_odbtp extends ADORecordSet {
-
- var $databaseType = 'odbtp';
- var $canSeek = true;
-
- function __construct($queryID,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- $this->fetchMode = $mode;
- $this->ADORecordSet($queryID);
- }
-
- function _initrs()
- {
- $this->_numOfFields = @odbtp_num_fields($this->_queryID);
- if (!($this->_numOfRows = @odbtp_num_rows($this->_queryID)))
- $this->_numOfRows = -1;
-
- if (!$this->connection->_useUnicodeSQL) return;
-
- if ($this->connection->odbc_driver == ODB_DRIVER_JET) {
- if (!@odbtp_get_attr(ODB_ATTR_MAPCHARTOWCHAR,
- $this->connection->_connectionID))
- {
- for ($f = 0; $f < $this->_numOfFields; $f++) {
- if (@odbtp_field_bindtype($this->_queryID, $f) == ODB_CHAR)
- @odbtp_bind_field($this->_queryID, $f, ODB_WCHAR);
- }
- }
- }
- }
-
- function FetchField($fieldOffset = 0)
- {
- $off=$fieldOffset; // offsets begin at 0
- $o= new ADOFieldObject();
- $o->name = @odbtp_field_name($this->_queryID,$off);
- $o->type = @odbtp_field_type($this->_queryID,$off);
- $o->max_length = @odbtp_field_length($this->_queryID,$off);
- if (ADODB_ASSOC_CASE == 0) $o->name = strtolower($o->name);
- else if (ADODB_ASSOC_CASE == 1) $o->name = strtoupper($o->name);
- return $o;
- }
-
- function _seek($row)
- {
- return @odbtp_data_seek($this->_queryID, $row);
- }
-
- function fields($colname)
- {
- if ($this->fetchMode & ADODB_FETCH_ASSOC) return $this->fields[$colname];
-
- if (!$this->bind) {
- $this->bind = array();
- for ($i=0; $i < $this->_numOfFields; $i++) {
- $name = @odbtp_field_name( $this->_queryID, $i );
- $this->bind[strtoupper($name)] = $i;
- }
- }
- return $this->fields[$this->bind[strtoupper($colname)]];
- }
-
- function _fetch_odbtp($type=0)
- {
- switch ($this->fetchMode) {
- case ADODB_FETCH_NUM:
- $this->fields = @odbtp_fetch_row($this->_queryID, $type);
- break;
- case ADODB_FETCH_ASSOC:
- $this->fields = @odbtp_fetch_assoc($this->_queryID, $type);
- break;
- default:
- $this->fields = @odbtp_fetch_array($this->_queryID, $type);
- }
- if ($this->databaseType = 'odbtp_vfp') {
- if ($this->fields)
- foreach($this->fields as $k => $v) {
- if (strncmp($v,'1899-12-30',10) == 0) $this->fields[$k] = '';
- }
- }
- return is_array($this->fields);
- }
-
- function _fetch()
- {
- return $this->_fetch_odbtp();
- }
-
- function MoveFirst()
- {
- if (!$this->_fetch_odbtp(ODB_FETCH_FIRST)) return false;
- $this->EOF = false;
- $this->_currentRow = 0;
- return true;
- }
-
- function MoveLast()
- {
- if (!$this->_fetch_odbtp(ODB_FETCH_LAST)) return false;
- $this->EOF = false;
- $this->_currentRow = $this->_numOfRows - 1;
- return true;
- }
-
- function NextRecordSet()
- {
- if (!@odbtp_next_result($this->_queryID)) return false;
- $this->_inited = false;
- $this->bind = false;
- $this->_currentRow = -1;
- $this->Init();
- return true;
- }
-
- function _close()
- {
- return @odbtp_free_query($this->_queryID);
- }
-}
-
-class ADORecordSet_odbtp_mssql extends ADORecordSet_odbtp {
-
- var $databaseType = 'odbtp_mssql';
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_odbtp($id,$mode);
- }
-}
-
-class ADORecordSet_odbtp_access extends ADORecordSet_odbtp {
-
- var $databaseType = 'odbtp_access';
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_odbtp($id,$mode);
- }
-}
-
-class ADORecordSet_odbtp_vfp extends ADORecordSet_odbtp {
-
- var $databaseType = 'odbtp_vfp';
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_odbtp($id,$mode);
- }
-}
-
-class ADORecordSet_odbtp_oci8 extends ADORecordSet_odbtp {
-
- var $databaseType = 'odbtp_oci8';
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_odbtp($id,$mode);
- }
-}
-
-class ADORecordSet_odbtp_sybase extends ADORecordSet_odbtp {
-
- var $databaseType = 'odbtp_sybase';
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_odbtp($id,$mode);
- }
-}
-?>
diff --git a/src/adodb5/drivers/adodb-odbtp_unicode.inc.php b/src/adodb5/drivers/adodb-odbtp_unicode.inc.php
deleted file mode 100644
index 33b2d275..00000000
--- a/src/adodb5/drivers/adodb-odbtp_unicode.inc.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-/*
- Because the ODBTP server sends and reads UNICODE text data using UTF-8
- encoding, the following HTML meta tag must be included within the HTML
- head section of every HTML form and script page:
-
-
-
- Also, all SQL query strings must be submitted as UTF-8 encoded text.
-*/
-
-if (!defined('_ADODB_ODBTP_LAYER')) {
- include(ADODB_DIR."/drivers/adodb-odbtp.inc.php");
-}
-
-class ADODB_odbtp_unicode extends ADODB_odbtp {
- var $databaseType = 'odbtp';
- var $_useUnicodeSQL = true;
-
- function __construct()
- {
- $this->ADODB_odbtp();
- }
-}
-?>
diff --git a/src/adodb5/drivers/adodb-oracle.inc.php b/src/adodb5/drivers/adodb-oracle.inc.php
deleted file mode 100644
index 13676e18..00000000
--- a/src/adodb5/drivers/adodb-oracle.inc.php
+++ /dev/null
@@ -1,342 +0,0 @@
-format($this->fmtDate);
- else $ds = adodb_date($this->fmtDate,$d);
- return 'TO_DATE('.$ds.",'YYYY-MM-DD')";
- }
-
- // format and return date string in database timestamp format
- function DBTimeStamp($ts)
- {
-
- if (is_string($ts)) $ts = ADORecordSet::UnixTimeStamp($ts);
- if (is_object($ts)) $ds = $ts->format($this->fmtDate);
- else $ds = adodb_date($this->fmtTimeStamp,$ts);
- return 'TO_DATE('.$ds.",'RRRR-MM-DD, HH:MI:SS AM')";
- }
-
-
- function BindDate($d)
- {
- $d = ADOConnection::DBDate($d);
- if (strncmp($d,"'",1)) return $d;
-
- return substr($d,1,strlen($d)-2);
- }
-
- function BindTimeStamp($d)
- {
- $d = ADOConnection::DBTimeStamp($d);
- if (strncmp($d,"'",1)) return $d;
-
- return substr($d,1,strlen($d)-2);
- }
-
-
-
- function BeginTrans()
- {
- $this->autoCommit = false;
- ora_commitoff($this->_connectionID);
- return true;
- }
-
-
- function CommitTrans($ok=true)
- {
- if (!$ok) return $this->RollbackTrans();
- $ret = ora_commit($this->_connectionID);
- ora_commiton($this->_connectionID);
- return $ret;
- }
-
-
- function RollbackTrans()
- {
- $ret = ora_rollback($this->_connectionID);
- ora_commiton($this->_connectionID);
- return $ret;
- }
-
-
- /* there seems to be a bug in the oracle extension -- always returns ORA-00000 - no error */
- function ErrorMsg()
- {
- if ($this->_errorMsg !== false) return $this->_errorMsg;
-
- if (is_resource($this->_curs)) $this->_errorMsg = @ora_error($this->_curs);
- if (empty($this->_errorMsg)) $this->_errorMsg = @ora_error($this->_connectionID);
- return $this->_errorMsg;
- }
-
-
- function ErrorNo()
- {
- if ($this->_errorCode !== false) return $this->_errorCode;
-
- if (is_resource($this->_curs)) $this->_errorCode = @ora_errorcode($this->_curs);
- if (empty($this->_errorCode)) $this->_errorCode = @ora_errorcode($this->_connectionID);
- return $this->_errorCode;
- }
-
-
-
- // returns true or false
- function _connect($argHostname, $argUsername, $argPassword, $argDatabasename, $mode=0)
- {
- if (!function_exists('ora_plogon')) return null;
-
- // Reset error messages before connecting
- $this->_errorMsg = false;
- $this->_errorCode = false;
-
- // G. Giunta 2003/08/13 - This looks danegrously suspicious: why should we want to set
- // the oracle home to the host name of remote DB?
-// if ($argHostname) putenv("ORACLE_HOME=$argHostname");
-
- if($argHostname) { // code copied from version submitted for oci8 by Jorma Tuomainen
- if (empty($argDatabasename)) $argDatabasename = $argHostname;
- else {
- if(strpos($argHostname,":")) {
- $argHostinfo=explode(":",$argHostname);
- $argHostname=$argHostinfo[0];
- $argHostport=$argHostinfo[1];
- } else {
- $argHostport="1521";
- }
-
-
- if ($this->connectSID) {
- $argDatabasename="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=".$argHostname
- .")(PORT=$argHostport))(CONNECT_DATA=(SID=$argDatabasename)))";
- } else
- $argDatabasename="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=".$argHostname
- .")(PORT=$argHostport))(CONNECT_DATA=(SERVICE_NAME=$argDatabasename)))";
- }
-
- }
-
- if ($argDatabasename) $argUsername .= "@$argDatabasename";
-
- //if ($argHostname) print "Connect: 1st argument should be left blank for $this->databaseType
";
- if ($mode == 1)
- $this->_connectionID = ora_plogon($argUsername,$argPassword);
- else
- $this->_connectionID = ora_logon($argUsername,$argPassword);
- if ($this->_connectionID === false) return false;
- if ($this->autoCommit) ora_commiton($this->_connectionID);
- if ($this->_initdate) {
- $rs = $this->_query("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD'");
- if ($rs) ora_close($rs);
- }
-
- return true;
- }
-
-
- // returns true or false
- function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
- {
- return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename, 1);
- }
-
-
- // returns query ID if successful, otherwise false
- function _query($sql,$inputarr=false)
- {
- // Reset error messages before executing
- $this->_errorMsg = false;
- $this->_errorCode = false;
-
- $curs = ora_open($this->_connectionID);
-
- if ($curs === false) return false;
- $this->_curs = $curs;
- if (!ora_parse($curs,$sql)) return false;
- if (ora_exec($curs)) return $curs;
- // before we close the cursor, we have to store the error message
- // that we can obtain ONLY from the cursor (and not from the connection)
- $this->_errorCode = @ora_errorcode($curs);
- $this->_errorMsg = @ora_error($curs);
- //
- @ora_close($curs);
- return false;
- }
-
-
- // returns true or false
- function _close()
- {
- return @ora_logoff($this->_connectionID);
- }
-
-
-
-}
-
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordset_oracle extends ADORecordSet {
-
- var $databaseType = "oracle";
- var $bind = false;
-
- function __construct($queryID,$mode=false)
- {
-
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- $this->fetchMode = $mode;
-
- $this->_queryID = $queryID;
-
- $this->_inited = true;
- $this->fields = array();
- if ($queryID) {
- $this->_currentRow = 0;
- $this->EOF = !$this->_fetch();
- @$this->_initrs();
- } else {
- $this->_numOfRows = 0;
- $this->_numOfFields = 0;
- $this->EOF = true;
- }
-
- $this->_queryID;
- }
-
-
-
- /* Returns: an object containing field information.
- Get column information in the Recordset object. fetchField() can be used in order to obtain information about
- fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by
- fetchField() is retrieved. */
-
- function FetchField($fieldOffset = -1)
- {
- $fld = new ADOFieldObject;
- $fld->name = ora_columnname($this->_queryID, $fieldOffset);
- $fld->type = ora_columntype($this->_queryID, $fieldOffset);
- $fld->max_length = ora_columnsize($this->_queryID, $fieldOffset);
- return $fld;
- }
-
- /* Use associative array to get fields array */
- function Fields($colname)
- {
- if (!$this->bind) {
- $this->bind = array();
- for ($i=0; $i < $this->_numOfFields; $i++) {
- $o = $this->FetchField($i);
- $this->bind[strtoupper($o->name)] = $i;
- }
- }
-
- return $this->fields[$this->bind[strtoupper($colname)]];
- }
-
- function _initrs()
- {
- $this->_numOfRows = -1;
- $this->_numOfFields = @ora_numcols($this->_queryID);
- }
-
-
- function _seek($row)
- {
- return false;
- }
-
- function _fetch($ignore_fields=false) {
-// should remove call by reference, but ora_fetch_into requires it in 4.0.3pl1
- if ($this->fetchMode & ADODB_FETCH_ASSOC)
- return @ora_fetch_into($this->_queryID,$this->fields,ORA_FETCHINTO_NULLS|ORA_FETCHINTO_ASSOC);
- else
- return @ora_fetch_into($this->_queryID,$this->fields,ORA_FETCHINTO_NULLS);
- }
-
- /* close() only needs to be called if you are worried about using too much memory while your script
- is running. All associated result memory for the specified result identifier will automatically be freed. */
-
- function _close()
-{
- return @ora_close($this->_queryID);
- }
-
- function MetaType($t,$len=-1)
- {
- if (is_object($t)) {
- $fieldobj = $t;
- $t = $fieldobj->type;
- $len = $fieldobj->max_length;
- }
-
- switch (strtoupper($t)) {
- case 'VARCHAR':
- case 'VARCHAR2':
- case 'CHAR':
- case 'VARBINARY':
- case 'BINARY':
- if ($len <= $this->blobSize) return 'C';
- case 'LONG':
- case 'LONG VARCHAR':
- case 'CLOB':
- return 'X';
- case 'LONG RAW':
- case 'LONG VARBINARY':
- case 'BLOB':
- return 'B';
-
- case 'DATE': return 'D';
-
- //case 'T': return 'T';
-
- case 'BIT': return 'L';
- case 'INT':
- case 'SMALLINT':
- case 'INTEGER': return 'I';
- default: return 'N';
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-pdo.inc.php b/src/adodb5/drivers/adodb-pdo.inc.php
index eff83072..6a838d48 100644
--- a/src/adodb5/drivers/adodb-pdo.inc.php
+++ b/src/adodb5/drivers/adodb-pdo.inc.php
@@ -116,7 +116,7 @@ function Time()
else $sql = "select $this->sysTimeStamp";
$rs = $this->_Execute($sql);
- if ($rs && !$rs->EOF) return $this->UnixTimeStamp(reset($rs->fields));
+ if ($rs && !$rs->EOF) return static::UnixTimeStamp(reset($rs->fields));
return false;
}
@@ -264,6 +264,7 @@ function ErrorNo()
function SetTransactionMode($transaction_mode)
{
+ $seqname = null;
if(method_exists($this->_driver, 'SetTransactionMode'))
return $this->_driver->SetTransactionMode($transaction_mode);
@@ -358,6 +359,7 @@ function GenID($seqname='adodbseq',$startID=1)
/* returns queryID or false */
function _query($sql,$inputarr=false)
{
+ $ok = null;
if (is_array($sql)) {
$stmt = $sql[1];
} else {
@@ -427,12 +429,12 @@ function _init($parentDriver)
function ServerInfo()
{
- return ADOConnection::ServerInfo();
+ return (new ADOConnection())->ServerInfo();
}
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
- $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
+ $ret = (new ADOConnection())->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
return $ret;
}
@@ -623,4 +625,4 @@ function Fields($colname)
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/drivers/adodb-pdo_mssql.inc.php b/src/adodb5/drivers/adodb-pdo_mssql.inc.php
index f57dd295..74f613a7 100644
--- a/src/adodb5/drivers/adodb-pdo_mssql.inc.php
+++ b/src/adodb5/drivers/adodb-pdo_mssql.inc.php
@@ -27,12 +27,12 @@ function _init($parentDriver)
function ServerInfo()
{
- return ADOConnection::ServerInfo();
+ return (new ADOConnection())->ServerInfo();
}
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
- $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
+ $ret = (new ADOConnection())->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
return $ret;
}
@@ -58,4 +58,4 @@ function MetaColumns($table,$normalize=true)
}
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/drivers/adodb-pdo_mysql.inc.php b/src/adodb5/drivers/adodb-pdo_mysql.inc.php
index 3e5e6a8d..f92a690a 100644
--- a/src/adodb5/drivers/adodb-pdo_mysql.inc.php
+++ b/src/adodb5/drivers/adodb-pdo_mysql.inc.php
@@ -34,10 +34,10 @@ function _init($parentDriver)
function OffsetDate($dayFraction,$date=false)
{
if (!$date) $date = $this->sysDate;
-
+
$fraction = $dayFraction * 24 * 3600;
return $date . ' + INTERVAL ' . $fraction.' SECOND';
-
+
// return "from_unixtime(unix_timestamp($date)+$fraction)";
}
@@ -53,8 +53,9 @@ function Concat()
function ServerInfo()
{
- $arr['description'] = ADOConnection::GetOne("select version()");
- $arr['version'] = ADOConnection::_findvers($arr['description']);
+ $arr = [];
+ $arr['description'] = (new ADOConnection())->GetOne("select version()");
+ $arr['version'] = (new ADOConnection())->_findvers($arr['description']);
return $arr;
}
@@ -69,7 +70,7 @@ function MetaTables($ttype=false,$showSchema=false,$mask=false)
$mask = $this->qstr($mask);
$this->metaTablesSQL .= " like $mask";
}
- $ret = ADOConnection::MetaTables($ttype,$showSchema);
+ $ret = (new ADOConnection())->MetaTables($ttype, $showSchema);
$this->metaTablesSQL = $save;
return $ret;
@@ -179,4 +180,4 @@ function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs=0)
return $rs;
}
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/drivers/adodb-pdo_oci.inc.php b/src/adodb5/drivers/adodb-pdo_oci.inc.php
index 4ba017a0..8bdd81c3 100644
--- a/src/adodb5/drivers/adodb-pdo_oci.inc.php
+++ b/src/adodb5/drivers/adodb-pdo_oci.inc.php
@@ -39,7 +39,7 @@ function MetaTables($ttype=false,$showSchema=false,$mask=false)
$mask = $this->qstr(strtoupper($mask));
$this->metaTablesSQL .= " AND table_name like $mask";
}
- $ret = ADOConnection::MetaTables($ttype,$showSchema);
+ $ret = (new ADOConnection())->MetaTables($ttype, $showSchema);
if ($mask) {
$this->metaTablesSQL = $save;
@@ -90,4 +90,4 @@ function MetaColumns($table,$normalize=true)
}
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/drivers/adodb-pdo_pgsql.inc.php b/src/adodb5/drivers/adodb-pdo_pgsql.inc.php
index 8c67a849..79a2c0d9 100644
--- a/src/adodb5/drivers/adodb-pdo_pgsql.inc.php
+++ b/src/adodb5/drivers/adodb-pdo_pgsql.inc.php
@@ -64,8 +64,9 @@ function _init($parentDriver)
function ServerInfo()
{
- $arr['description'] = ADOConnection::GetOne("select version()");
- $arr['version'] = ADOConnection::_findvers($arr['description']);
+ $arr = [];
+ $arr['description'] = (new ADOConnection())->GetOne("select version()");
+ $arr['version'] = (new ADOConnection())->_findvers($arr['description']);
return $arr;
}
@@ -104,7 +105,7 @@ function MetaTables($ttype=false,$showSchema=false,$mask=false)
union
select viewname,'V' from pg_views where viewname like $mask";
}
- $ret = ADOConnection::MetaTables($ttype,$showSchema);
+ $ret = (new ADOConnection())->MetaTables($ttype, $showSchema);
if ($mask) {
$this->metaTablesSQL = $save;
@@ -114,6 +115,7 @@ function MetaTables($ttype=false,$showSchema=false,$mask=false)
function MetaColumns($table,$normalize=true)
{
+ $keys = null;
global $ADODB_FETCH_MODE;
$schema = false;
diff --git a/src/adodb5/drivers/adodb-pdo_sqlite.inc.php b/src/adodb5/drivers/adodb-pdo_sqlite.inc.php
index af2d64ca..6230624f 100644
--- a/src/adodb5/drivers/adodb-pdo_sqlite.inc.php
+++ b/src/adodb5/drivers/adodb-pdo_sqlite.inc.php
@@ -38,9 +38,12 @@ function _init($parentDriver)
function ServerInfo()
{
+ $arr = [];
$parent = $this->pdoDriver;
- @($ver = array_pop($parent->GetCol("SELECT sqlite_version()")));
- @($end = array_pop($parent->GetCol("PRAGMA encoding")));
+ $getCol = $parent->GetCol("SELECT sqlite_version()");
+ @($ver = array_pop($getCol));
+ $getCol2 = $parent->GetCol("PRAGMA encoding");
+ @($end = array_pop($getCol2));
$arr['version'] = $ver;
$arr['description'] = 'SQLite ';
@@ -64,12 +67,14 @@ function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
function GenID($seq='adodbseq',$start=1)
{
+ $ok = null;
$parent = $this->pdoDriver;
// if you have to modify the parameter below, your database is overloaded,
// or you need to implement generation of id's yourself!
$MAXLOOPS = 100;
while (--$MAXLOOPS>=0) {
- @($num = array_pop($parent->GetCol("SELECT id FROM {$seq}")));
+ $getCol = $parent->GetCol("SELECT id FROM {$seq}");
+ @($num = array_pop($getCol));
if ($num === false || !is_numeric($num)) {
@$parent->Execute(sprintf($this->_genSeqSQL ,$seq));
$start -= 1;
@@ -187,4 +192,4 @@ function MetaTables($ttype=false,$showSchema=false,$mask=false)
return $parent->GetCol($this->metaTablesSQL);
}
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/drivers/adodb-postgres.inc.php b/src/adodb5/drivers/adodb-postgres.inc.php
deleted file mode 100644
index 491e4ccd..00000000
--- a/src/adodb5/drivers/adodb-postgres.inc.php
+++ /dev/null
@@ -1,14 +0,0 @@
-
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-postgres64.inc.php b/src/adodb5/drivers/adodb-postgres64.inc.php
deleted file mode 100644
index 410f3f21..00000000
--- a/src/adodb5/drivers/adodb-postgres64.inc.php
+++ /dev/null
@@ -1,1071 +0,0 @@
-
- jlim - changed concat operator to || and data types to MetaType to match documented pgsql types
- see http://www.postgresql.org/devel-corner/docs/postgres/datatype.htm
- 22 Nov 2000 jlim - added changes to FetchField() and MetaTables() contributed by "raser"
- 27 Nov 2000 jlim - added changes to _connect/_pconnect from ideas by "Lennie"
- 15 Dec 2000 jlim - added changes suggested by Additional code changes by "Eric G. Werk" egw@netguide.dk.
- 31 Jan 2002 jlim - finally installed postgresql. testing
- 01 Mar 2001 jlim - Freek Dijkstra changes, also support for text type
-
- See http://www.varlena.com/varlena/GeneralBits/47.php
-
- -- What indexes are on my table?
- select * from pg_indexes where tablename = 'tablename';
-
- -- What triggers are on my table?
- select c.relname as "Table", t.tgname as "Trigger Name",
- t.tgconstrname as "Constraint Name", t.tgenabled as "Enabled",
- t.tgisconstraint as "Is Constraint", cc.relname as "Referenced Table",
- p.proname as "Function Name"
- from pg_trigger t, pg_class c, pg_class cc, pg_proc p
- where t.tgfoid = p.oid and t.tgrelid = c.oid
- and t.tgconstrrelid = cc.oid
- and c.relname = 'tablename';
-
- -- What constraints are on my table?
- select r.relname as "Table", c.conname as "Constraint Name",
- contype as "Constraint Type", conkey as "Key Columns",
- confkey as "Foreign Columns", consrc as "Source"
- from pg_class r, pg_constraint c
- where r.oid = c.conrelid
- and relname = 'tablename';
-
-*/
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-function adodb_addslashes($s)
-{
- $len = strlen($s);
- if ($len == 0) return "''";
- if (strncmp($s,"'",1) === 0 && substr($s,$len-1) == "'") return $s; // already quoted
-
- return "'".addslashes($s)."'";
-}
-
-class ADODB_postgres64 extends ADOConnection{
- var $databaseType = 'postgres64';
- var $dataProvider = 'postgres';
- var $hasInsertID = true;
- var $_resultid = false;
- var $concat_operator='||';
- var $metaDatabasesSQL = "select datname from pg_database where datname not in ('template0','template1') order by 1";
- var $metaTablesSQL = "select tablename,'T' from pg_tables where tablename not like 'pg\_%'
- and tablename not in ('sql_features', 'sql_implementation_info', 'sql_languages',
- 'sql_packages', 'sql_sizing', 'sql_sizing_profiles')
- union
- select viewname,'V' from pg_views where viewname not like 'pg\_%'";
- //"select tablename from pg_tables where tablename not like 'pg_%' order by 1";
- var $isoDates = true; // accepts dates in ISO format
- var $sysDate = "CURRENT_DATE";
- var $sysTimeStamp = "CURRENT_TIMESTAMP";
- var $blobEncodeType = 'C';
- var $metaColumnsSQL = "SELECT a.attname,t.typname,a.attlen,a.atttypmod,a.attnotnull,a.atthasdef,a.attnum
- FROM pg_class c, pg_attribute a,pg_type t
- WHERE relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s')) and a.attname not like '....%%'
-AND a.attnum > 0 AND a.atttypid = t.oid AND a.attrelid = c.oid ORDER BY a.attnum";
-
- // used when schema defined
- var $metaColumnsSQL1 = "SELECT a.attname, t.typname, a.attlen, a.atttypmod, a.attnotnull, a.atthasdef, a.attnum
-FROM pg_class c, pg_attribute a, pg_type t, pg_namespace n
-WHERE relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s'))
- and c.relnamespace=n.oid and n.nspname='%s'
- and a.attname not like '....%%' AND a.attnum > 0
- AND a.atttypid = t.oid AND a.attrelid = c.oid ORDER BY a.attnum";
-
- // get primary key etc -- from Freek Dijkstra
- var $metaKeySQL = "SELECT ic.relname AS index_name, a.attname AS column_name,i.indisunique AS unique_key, i.indisprimary AS primary_key
- FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a WHERE bc.oid = i.indrelid AND ic.oid = i.indexrelid AND (i.indkey[0] = a.attnum OR i.indkey[1] = a.attnum OR i.indkey[2] = a.attnum OR i.indkey[3] = a.attnum OR i.indkey[4] = a.attnum OR i.indkey[5] = a.attnum OR i.indkey[6] = a.attnum OR i.indkey[7] = a.attnum) AND a.attrelid = bc.oid AND bc.relname = '%s'";
-
- var $hasAffectedRows = true;
- var $hasLimit = false; // set to true for pgsql 7 only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10
- // below suggested by Freek Dijkstra
- var $true = 'TRUE'; // string that represents TRUE for a database
- var $false = 'FALSE'; // string that represents FALSE for a database
- var $fmtDate = "'Y-m-d'"; // used by DBDate() as the default date format used by the database
- var $fmtTimeStamp = "'Y-m-d H:i:s'"; // used by DBTimeStamp as the default timestamp fmt.
- var $hasMoveFirst = true;
- var $hasGenID = true;
- var $_genIDSQL = "SELECT NEXTVAL('%s')";
- var $_genSeqSQL = "CREATE SEQUENCE %s START %s";
- var $_dropSeqSQL = "DROP SEQUENCE %s";
- var $metaDefaultsSQL = "SELECT d.adnum as num, d.adsrc as def from pg_attrdef d, pg_class c where d.adrelid=c.oid and c.relname='%s' order by d.adnum";
- var $random = 'random()'; /// random function
- var $autoRollback = true; // apparently pgsql does not autorollback properly before php 4.3.4
- // http://bugs.php.net/bug.php?id=25404
-
- var $uniqueIisR = true;
- var $_bindInputArray = false; // requires postgresql 7.3+ and ability to modify database
- var $disableBlobs = false; // set to true to disable blob checking, resulting in 2-5% improvement in performance.
-
- // The last (fmtTimeStamp is not entirely correct:
- // PostgreSQL also has support for time zones,
- // and writes these time in this format: "2001-03-01 18:59:26+02".
- // There is no code for the "+02" time zone information, so I just left that out.
- // I'm not familiar enough with both ADODB as well as Postgres
- // to know what the concequences are. The other values are correct (wheren't in 0.94)
- // -- Freek Dijkstra
-
- function __construct()
- {
- // changes the metaColumnsSQL, adds columns: attnum[6]
- }
-
- function ServerInfo()
- {
- if (isset($this->version)) return $this->version;
-
- $arr['description'] = $this->GetOne("select version()");
- $arr['version'] = ADOConnection::_findvers($arr['description']);
- $this->version = $arr;
- return $arr;
- }
-
- function IfNull( $field, $ifNull )
- {
- return " coalesce($field, $ifNull) ";
- }
-
- // get the last id - never tested
- function pg_insert_id($tablename,$fieldname)
- {
- $result=pg_exec($this->_connectionID, "SELECT last_value FROM ${tablename}_${fieldname}_seq");
- if ($result) {
- $arr = @pg_fetch_row($result,0);
- pg_freeresult($result);
- if (isset($arr[0])) return $arr[0];
- }
- return false;
- }
-
-/* Warning from http://www.php.net/manual/function.pg-getlastoid.php:
-Using a OID as a unique identifier is not generally wise.
-Unless you are very careful, you might end up with a tuple having
-a different OID if a database must be reloaded. */
- function _insertid($table,$column)
- {
- if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') return false;
- $oid = pg_getlastoid($this->_resultid);
- // to really return the id, we need the table and column-name, else we can only return the oid != id
- return empty($table) || empty($column) ? $oid : $this->GetOne("SELECT $column FROM $table WHERE oid=".(int)$oid);
- }
-
-// I get this error with PHP before 4.0.6 - jlim
-// Warning: This compilation does not support pg_cmdtuples() in adodb-postgres.inc.php on line 44
- function _affectedrows()
- {
- if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') return false;
- return pg_cmdtuples($this->_resultid);
- }
-
-
- // returns true/false
- function BeginTrans()
- {
- if ($this->transOff) return true;
- $this->transCnt += 1;
- return @pg_Exec($this->_connectionID, "begin ".$this->_transmode);
- }
-
- function RowLock($tables,$where,$flds='1 as ignore')
- {
- if (!$this->transCnt) $this->BeginTrans();
- return $this->GetOne("select $flds from $tables where $where for update");
- }
-
- // returns true/false.
- function CommitTrans($ok=true)
- {
- if ($this->transOff) return true;
- if (!$ok) return $this->RollbackTrans();
-
- $this->transCnt -= 1;
- return @pg_Exec($this->_connectionID, "commit");
- }
-
- // returns true/false
- function RollbackTrans()
- {
- if ($this->transOff) return true;
- $this->transCnt -= 1;
- return @pg_Exec($this->_connectionID, "rollback");
- }
-
- function MetaTables($ttype=false,$showSchema=false,$mask=false)
- {
- $info = $this->ServerInfo();
- if ($info['version'] >= 7.3) {
- $this->metaTablesSQL = "select tablename,'T' from pg_tables where tablename not like 'pg\_%'
- and schemaname not in ( 'pg_catalog','information_schema')
- union
- select viewname,'V' from pg_views where viewname not like 'pg\_%' and schemaname not in ( 'pg_catalog','information_schema') ";
- }
- if ($mask) {
- $save = $this->metaTablesSQL;
- $mask = $this->qstr(strtolower($mask));
- if ($info['version']>=7.3)
- $this->metaTablesSQL = "
-select tablename,'T' from pg_tables where tablename like $mask and schemaname not in ( 'pg_catalog','information_schema')
- union
-select viewname,'V' from pg_views where viewname like $mask and schemaname not in ( 'pg_catalog','information_schema') ";
- else
- $this->metaTablesSQL = "
-select tablename,'T' from pg_tables where tablename like $mask
- union
-select viewname,'V' from pg_views where viewname like $mask";
- }
- $ret = ADOConnection::MetaTables($ttype,$showSchema);
-
- if ($mask) {
- $this->metaTablesSQL = $save;
- }
- return $ret;
- }
-
-
- // if magic quotes disabled, use pg_escape_string()
- function qstr($s,$magic_quotes=false)
- {
- if (is_bool($s)) return $s ? 'true' : 'false';
-
- if (!$magic_quotes) {
- if (ADODB_PHPVER >= 0x5200) {
- return "'".pg_escape_string($this->_connectionID,$s)."'";
- }
- if (ADODB_PHPVER >= 0x4200) {
- return "'".pg_escape_string($s)."'";
- }
- if ($this->replaceQuote[0] == '\\'){
- $s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\\000"),$s);
- }
- return "'".str_replace("'",$this->replaceQuote,$s)."'";
- }
-
- // undo magic quotes for "
- $s = str_replace('\\"','"',$s);
- return "'$s'";
- }
-
-
-
- // Format date column in sql string given an input format that understands Y M D
- function SQLDate($fmt, $col=false)
- {
- if (!$col) $col = $this->sysTimeStamp;
- $s = 'TO_CHAR('.$col.",'";
-
- $len = strlen($fmt);
- for ($i=0; $i < $len; $i++) {
- $ch = $fmt[$i];
- switch($ch) {
- case 'Y':
- case 'y':
- $s .= 'YYYY';
- break;
- case 'Q':
- case 'q':
- $s .= 'Q';
- break;
-
- case 'M':
- $s .= 'Mon';
- break;
-
- case 'm':
- $s .= 'MM';
- break;
- case 'D':
- case 'd':
- $s .= 'DD';
- break;
-
- case 'H':
- $s.= 'HH24';
- break;
-
- case 'h':
- $s .= 'HH';
- break;
-
- case 'i':
- $s .= 'MI';
- break;
-
- case 's':
- $s .= 'SS';
- break;
-
- case 'a':
- case 'A':
- $s .= 'AM';
- break;
-
- case 'w':
- $s .= 'D';
- break;
-
- case 'l':
- $s .= 'DAY';
- break;
-
- case 'W':
- $s .= 'WW';
- break;
-
- default:
- // handle escape characters...
- if ($ch == '\\') {
- $i++;
- $ch = substr($fmt,$i,1);
- }
- if (strpos('-/.:;, ',$ch) !== false) $s .= $ch;
- else $s .= '"'.$ch.'"';
-
- }
- }
- return $s. "')";
- }
-
-
-
- /*
- * Load a Large Object from a file
- * - the procedure stores the object id in the table and imports the object using
- * postgres proprietary blob handling routines
- *
- * contributed by Mattia Rossi mattia@technologist.com
- * modified for safe mode by juraj chlebec
- */
- function UpdateBlobFile($table,$column,$path,$where,$blobtype='BLOB')
- {
- pg_exec ($this->_connectionID, "begin");
-
- $fd = fopen($path,'r');
- $contents = fread($fd,filesize($path));
- fclose($fd);
-
- $oid = pg_lo_create($this->_connectionID);
- $handle = pg_lo_open($this->_connectionID, $oid, 'w');
- pg_lo_write($handle, $contents);
- pg_lo_close($handle);
-
- // $oid = pg_lo_import ($path);
- pg_exec($this->_connectionID, "commit");
- $rs = ADOConnection::UpdateBlob($table,$column,$oid,$where,$blobtype);
- $rez = !empty($rs);
- return $rez;
- }
-
- /*
- * Deletes/Unlinks a Blob from the database, otherwise it
- * will be left behind
- *
- * Returns TRUE on success or FALSE on failure.
- *
- * contributed by Todd Rogers todd#windfox.net
- */
- function BlobDelete( $blob )
- {
- pg_exec ($this->_connectionID, "begin");
- $result = @pg_lo_unlink($blob);
- pg_exec ($this->_connectionID, "commit");
- return( $result );
- }
-
- /*
- Hueristic - not guaranteed to work.
- */
- function GuessOID($oid)
- {
- if (strlen($oid)>16) return false;
- return is_numeric($oid);
- }
-
- /*
- * If an OID is detected, then we use pg_lo_* to open the oid file and read the
- * real blob from the db using the oid supplied as a parameter. If you are storing
- * blobs using bytea, we autodetect and process it so this function is not needed.
- *
- * contributed by Mattia Rossi mattia@technologist.com
- *
- * see http://www.postgresql.org/idocs/index.php?largeobjects.html
- *
- * Since adodb 4.54, this returns the blob, instead of sending it to stdout. Also
- * added maxsize parameter, which defaults to $db->maxblobsize if not defined.
- */
- function BlobDecode($blob,$maxsize=false,$hastrans=true)
- {
- if (!$this->GuessOID($blob)) return $blob;
-
- if ($hastrans) @pg_exec($this->_connectionID,"begin");
- $fd = @pg_lo_open($this->_connectionID,$blob,"r");
- if ($fd === false) {
- if ($hastrans) @pg_exec($this->_connectionID,"commit");
- return $blob;
- }
- if (!$maxsize) $maxsize = $this->maxblobsize;
- $realblob = @pg_loread($fd,$maxsize);
- @pg_loclose($fd);
- if ($hastrans) @pg_exec($this->_connectionID,"commit");
- return $realblob;
- }
-
- /*
- See http://www.postgresql.org/idocs/index.php?datatype-binary.html
-
- NOTE: SQL string literals (input strings) must be preceded with two backslashes
- due to the fact that they must pass through two parsers in the PostgreSQL
- backend.
- */
- function BlobEncode($blob)
- {
- if (ADODB_PHPVER >= 0x5200) return pg_escape_bytea($this->_connectionID, $blob);
- if (ADODB_PHPVER >= 0x4200) return pg_escape_bytea($blob);
-
- /*92=backslash, 0=null, 39=single-quote*/
- $badch = array(chr(92),chr(0),chr(39)); # \ null '
- $fixch = array('\\\\134','\\\\000','\\\\047');
- return adodb_str_replace($badch,$fixch,$blob);
-
- // note that there is a pg_escape_bytea function only for php 4.2.0 or later
- }
-
- // assumes bytea for blob, and varchar for clob
- function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
- {
-
- if ($blobtype == 'CLOB') {
- return $this->Execute("UPDATE $table SET $column=" . $this->qstr($val) . " WHERE $where");
- }
- // do not use bind params which uses qstr(), as blobencode() already quotes data
- return $this->Execute("UPDATE $table SET $column='".$this->BlobEncode($val)."'::bytea WHERE $where");
- }
-
- function OffsetDate($dayFraction,$date=false)
- {
- if (!$date) $date = $this->sysDate;
- else if (strncmp($date,"'",1) == 0) {
- $len = strlen($date);
- if (10 <= $len && $len <= 12) $date = 'date '.$date;
- else $date = 'timestamp '.$date;
- }
-
-
- return "($date+interval'".($dayFraction * 1440)." minutes')";
- #return "($date+interval'$dayFraction days')";
- }
-
-
- // for schema support, pass in the $table param "$schema.$tabname".
- // converts field names to lowercase, $upper is ignored
- // see http://phplens.com/lens/lensforum/msgs.php?id=14018 for more info
- function MetaColumns($table,$normalize=true)
- {
- global $ADODB_FETCH_MODE;
-
- $schema = false;
- $false = false;
- $this->_findschema($table,$schema);
-
- if ($normalize) $table = strtolower($table);
-
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
-
- if ($schema) $rs = $this->Execute(sprintf($this->metaColumnsSQL1,$table,$table,$schema));
- else $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table,$table));
- if (isset($savem)) $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
-
- if ($rs === false) {
- return $false;
- }
- if (!empty($this->metaKeySQL)) {
- // If we want the primary keys, we have to issue a separate query
- // Of course, a modified version of the metaColumnsSQL query using a
- // LEFT JOIN would have been much more elegant, but postgres does
- // not support OUTER JOINS. So here is the clumsy way.
-
- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
-
- $rskey = $this->Execute(sprintf($this->metaKeySQL,($table)));
- // fetch all result in once for performance.
- $keys = $rskey->GetArray();
- if (isset($savem)) $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
-
- $rskey->Close();
- unset($rskey);
- }
-
- $rsdefa = array();
- if (!empty($this->metaDefaultsSQL)) {
- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
- $sql = sprintf($this->metaDefaultsSQL, ($table));
- $rsdef = $this->Execute($sql);
- if (isset($savem)) $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
-
- if ($rsdef) {
- while (!$rsdef->EOF) {
- $num = $rsdef->fields['num'];
- $s = $rsdef->fields['def'];
- if (strpos($s,'::')===false && substr($s, 0, 1) == "'") { /* quoted strings hack... for now... fixme */
- $s = substr($s, 1);
- $s = substr($s, 0, strlen($s) - 1);
- }
-
- $rsdefa[$num] = $s;
- $rsdef->MoveNext();
- }
- } else {
- ADOConnection::outp( "==> SQL => " . $sql);
- }
- unset($rsdef);
- }
-
- $retarr = array();
- while (!$rs->EOF) {
- $fld = new ADOFieldObject();
- $fld->name = $rs->fields[0];
- $fld->type = $rs->fields[1];
- $fld->max_length = $rs->fields[2];
- $fld->attnum = $rs->fields[6];
-
- if ($fld->max_length <= 0) $fld->max_length = $rs->fields[3]-4;
- if ($fld->max_length <= 0) $fld->max_length = -1;
- if ($fld->type == 'numeric') {
- $fld->scale = $fld->max_length & 0xFFFF;
- $fld->max_length >>= 16;
- }
- // dannym
- // 5 hasdefault; 6 num-of-column
- $fld->has_default = ($rs->fields[5] == 't');
- if ($fld->has_default) {
- $fld->default_value = $rsdefa[$rs->fields[6]];
- }
-
- //Freek
- $fld->not_null = $rs->fields[4] == 't';
-
-
- // Freek
- if (is_array($keys)) {
- foreach($keys as $key) {
- if ($fld->name == $key['column_name'] AND $key['primary_key'] == 't')
- $fld->primary_key = true;
- if ($fld->name == $key['column_name'] AND $key['unique_key'] == 't')
- $fld->unique = true; // What name is more compatible?
- }
- }
-
- if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
- else $retarr[($normalize) ? strtoupper($fld->name) : $fld->name] = $fld;
-
- $rs->MoveNext();
- }
- $rs->Close();
- if (empty($retarr))
- return $false;
- else
- return $retarr;
-
- }
-
- function MetaIndexes ($table, $primary = FALSE)
- {
- global $ADODB_FETCH_MODE;
-
- $schema = false;
- $this->_findschema($table,$schema);
-
- if ($schema) { // requires pgsql 7.3+ - pg_namespace used.
- $sql = '
-SELECT c.relname as "Name", i.indisunique as "Unique", i.indkey as "Columns"
-FROM pg_catalog.pg_class c
-JOIN pg_catalog.pg_index i ON i.indexrelid=c.oid
-JOIN pg_catalog.pg_class c2 ON c2.oid=i.indrelid
- ,pg_namespace n
-WHERE (c2.relname=\'%s\' or c2.relname=lower(\'%s\')) and c.relnamespace=c2.relnamespace and c.relnamespace=n.oid and n.nspname=\'%s\'';
- } else {
- $sql = '
-SELECT c.relname as "Name", i.indisunique as "Unique", i.indkey as "Columns"
-FROM pg_catalog.pg_class c
-JOIN pg_catalog.pg_index i ON i.indexrelid=c.oid
-JOIN pg_catalog.pg_class c2 ON c2.oid=i.indrelid
-WHERE (c2.relname=\'%s\' or c2.relname=lower(\'%s\'))';
- }
-
- if ($primary == FALSE) {
- $sql .= ' AND i.indisprimary=false;';
- }
-
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== FALSE) {
- $savem = $this->SetFetchMode(FALSE);
- }
-
- $rs = $this->Execute(sprintf($sql,$table,$table,$schema));
- if (isset($savem)) {
- $this->SetFetchMode($savem);
- }
- $ADODB_FETCH_MODE = $save;
-
- if (!is_object($rs)) {
- $false = false;
- return $false;
- }
-
- $col_names = $this->MetaColumnNames($table,true,true);
- //3rd param is use attnum,
- // see http://sourceforge.net/tracker/index.php?func=detail&aid=1451245&group_id=42718&atid=433976
- $indexes = array();
- while ($row = $rs->FetchRow()) {
- $columns = array();
- foreach (explode(' ', $row[2]) as $col) {
- $columns[] = $col_names[$col];
- }
-
- $indexes[$row[0]] = array(
- 'unique' => ($row[1] == 't'),
- 'columns' => $columns
- );
- }
- return $indexes;
- }
-
- // returns true or false
- //
- // examples:
- // $db->Connect("host=host1 user=user1 password=secret port=4341");
- // $db->Connect('host1','user1','secret');
- function _connect($str,$user='',$pwd='',$db='',$ctype=0)
- {
-
- if (!function_exists('pg_connect')) return null;
-
- $this->_errorMsg = false;
-
- if ($user || $pwd || $db) {
- $user = adodb_addslashes($user);
- $pwd = adodb_addslashes($pwd);
- if (strlen($db) == 0) $db = 'template1';
- $db = adodb_addslashes($db);
- if ($str) {
- $host = explode(':', $str);
- if ($host[0]) $str = "host=".adodb_addslashes($host[0]);
- else $str = '';
- if (isset($host[1])) $str .= " port=$host[1]";
- else if (!empty($this->port)) $str .= " port=".$this->port;
- }
- if ($user) $str .= " user=".$user;
- if ($pwd) $str .= " password=".$pwd;
- if ($db) $str .= " dbname=".$db;
- }
-
- //if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432";
-
- if ($ctype === 1) { // persistent
- $this->_connectionID = pg_pconnect($str);
- } else {
- if ($ctype === -1) { // nconnect, we trick pgsql ext by changing the connection str
- static $ncnt;
-
- if (empty($ncnt)) $ncnt = 1;
- else $ncnt += 1;
-
- $str .= str_repeat(' ',$ncnt);
- }
- $this->_connectionID = pg_connect($str);
- }
- if ($this->_connectionID === false) return false;
- $this->Execute("set datestyle='ISO'");
-
- $info = $this->ServerInfo();
- $this->pgVersion = (float) substr($info['version'],0,3);
- if ($this->pgVersion >= 7.1) { // good till version 999
- $this->_nestedSQL = true;
- }
- return true;
- }
-
- function _nconnect($argHostname, $argUsername, $argPassword, $argDatabaseName)
- {
- return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabaseName,-1);
- }
-
- // returns true or false
- //
- // examples:
- // $db->PConnect("host=host1 user=user1 password=secret port=4341");
- // $db->PConnect('host1','user1','secret');
- function _pconnect($str,$user='',$pwd='',$db='')
- {
- return $this->_connect($str,$user,$pwd,$db,1);
- }
-
-
- // returns queryID or false
- function _query($sql,$inputarr=false)
- {
- $this->_errorMsg = false;
- if ($inputarr) {
- /*
- It appears that PREPARE/EXECUTE is slower for many queries.
-
- For query executed 1000 times:
- "select id,firstname,lastname from adoxyz
- where firstname not like ? and lastname not like ? and id = ?"
-
- with plan = 1.51861286163 secs
- no plan = 1.26903700829 secs
-
-
-
- */
- $plan = 'P'.md5($sql);
-
- $execp = '';
- foreach($inputarr as $v) {
- if ($execp) $execp .= ',';
- if (is_string($v)) {
- if (strncmp($v,"'",1) !== 0) $execp .= $this->qstr($v);
- } else {
- $execp .= $v;
- }
- }
-
- if ($execp) $exsql = "EXECUTE $plan ($execp)";
- else $exsql = "EXECUTE $plan";
-
-
- $rez = @pg_exec($this->_connectionID,$exsql);
- if (!$rez) {
- # Perhaps plan does not exist? Prepare/compile plan.
- $params = '';
- foreach($inputarr as $v) {
- if ($params) $params .= ',';
- if (is_string($v)) {
- $params .= 'VARCHAR';
- } else if (is_integer($v)) {
- $params .= 'INTEGER';
- } else {
- $params .= "REAL";
- }
- }
- $sqlarr = explode('?',$sql);
- //print_r($sqlarr);
- $sql = '';
- $i = 1;
- foreach($sqlarr as $v) {
- $sql .= $v.' $'.$i;
- $i++;
- }
- $s = "PREPARE $plan ($params) AS ".substr($sql,0,strlen($sql)-2);
- //adodb_pr($s);
- $rez = pg_exec($this->_connectionID,$s);
- //echo $this->ErrorMsg();
- }
- if ($rez)
- $rez = pg_exec($this->_connectionID,$exsql);
- } else {
- //adodb_backtrace();
- $rez = pg_exec($this->_connectionID,$sql);
- }
- // check if no data returned, then no need to create real recordset
- if ($rez && pg_numfields($rez) <= 0) {
- if (is_resource($this->_resultid) && get_resource_type($this->_resultid) === 'pgsql result') {
- pg_freeresult($this->_resultid);
- }
- $this->_resultid = $rez;
- return true;
- }
-
- return $rez;
- }
-
- function _errconnect()
- {
- if (defined('DB_ERROR_CONNECT_FAILED')) return DB_ERROR_CONNECT_FAILED;
- else return 'Database connection failed';
- }
-
- /* Returns: the last error message from previous database operation */
- function ErrorMsg()
- {
- if ($this->_errorMsg !== false) return $this->_errorMsg;
- if (ADODB_PHPVER >= 0x4300) {
- if (!empty($this->_resultid)) {
- $this->_errorMsg = @pg_result_error($this->_resultid);
- if ($this->_errorMsg) return $this->_errorMsg;
- }
-
- if (!empty($this->_connectionID)) {
- $this->_errorMsg = @pg_last_error($this->_connectionID);
- } else $this->_errorMsg = $this->_errconnect();
- } else {
- if (empty($this->_connectionID)) $this->_errconnect();
- else $this->_errorMsg = @pg_errormessage($this->_connectionID);
- }
- return $this->_errorMsg;
- }
-
- function ErrorNo()
- {
- $e = $this->ErrorMsg();
- if (strlen($e)) {
- return ADOConnection::MetaError($e);
- }
- return 0;
- }
-
- // returns true or false
- function _close()
- {
- if ($this->transCnt) $this->RollbackTrans();
- if ($this->_resultid) {
- @pg_freeresult($this->_resultid);
- $this->_resultid = false;
- }
- @pg_close($this->_connectionID);
- $this->_connectionID = false;
- return true;
- }
-
-
- /*
- * Maximum size of C field
- */
- function CharMax()
- {
- return 1000000000; // should be 1 Gb?
- }
-
- /*
- * Maximum size of X field
- */
- function TextMax()
- {
- return 1000000000; // should be 1 Gb?
- }
-
-
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordSet_postgres64 extends ADORecordSet{
- var $_blobArr;
- var $databaseType = "postgres64";
- var $canSeek = true;
- function __construct($queryID,$mode=false)
- {
- if ($mode === false) {
- global $ADODB_FETCH_MODE;
- $mode = $ADODB_FETCH_MODE;
- }
- switch ($mode)
- {
- case ADODB_FETCH_NUM: $this->fetchMode = PGSQL_NUM; break;
- case ADODB_FETCH_ASSOC:$this->fetchMode = PGSQL_ASSOC; break;
-
- case ADODB_FETCH_DEFAULT:
- case ADODB_FETCH_BOTH:
- default: $this->fetchMode = PGSQL_BOTH; break;
- }
- $this->adodbFetchMode = $mode;
- $this->ADORecordSet($queryID);
- }
-
- function GetRowAssoc($upper=true)
- {
- if ($this->fetchMode == PGSQL_ASSOC && !$upper) return $this->fields;
- $row = ADORecordSet::GetRowAssoc($upper);
- return $row;
- }
-
- function _initrs()
- {
- global $ADODB_COUNTRECS;
- $qid = $this->_queryID;
- $this->_numOfRows = ($ADODB_COUNTRECS)? @pg_numrows($qid):-1;
- $this->_numOfFields = @pg_numfields($qid);
-
- // cache types for blob decode check
- // apparently pg_fieldtype actually performs an sql query on the database to get the type.
- if (empty($this->connection->noBlobs))
- for ($i=0, $max = $this->_numOfFields; $i < $max; $i++) {
- if (pg_fieldtype($qid,$i) == 'bytea') {
- $this->_blobArr[$i] = pg_fieldname($qid,$i);
- }
- }
- }
-
- /* Use associative array to get fields array */
- function Fields($colname)
- {
- if ($this->fetchMode != PGSQL_NUM) return @$this->fields[$colname];
-
- if (!$this->bind) {
- $this->bind = array();
- for ($i=0; $i < $this->_numOfFields; $i++) {
- $o = $this->FetchField($i);
- $this->bind[strtoupper($o->name)] = $i;
- }
- }
- return $this->fields[$this->bind[strtoupper($colname)]];
- }
-
- function FetchField($off = 0)
- {
- // offsets begin at 0
-
- $o= new ADOFieldObject();
- $o->name = @pg_fieldname($this->_queryID,$off);
- $o->type = @pg_fieldtype($this->_queryID,$off);
- $o->max_length = @pg_fieldsize($this->_queryID,$off);
- return $o;
- }
-
- function _seek($row)
- {
- return @pg_fetch_row($this->_queryID,$row);
- }
-
- function _decode($blob)
- {
- if ($blob === NULL) return NULL;
- eval('$realblob="'.adodb_str_replace(array('"','$'),array('\"','\$'),$blob).'";');
- return $realblob;
- }
-
- function _fixblobs()
- {
- if ($this->fetchMode == PGSQL_NUM || $this->fetchMode == PGSQL_BOTH) {
- foreach($this->_blobArr as $k => $v) {
- $this->fields[$k] = ADORecordSet_postgres64::_decode($this->fields[$k]);
- }
- }
- if ($this->fetchMode == PGSQL_ASSOC || $this->fetchMode == PGSQL_BOTH) {
- foreach($this->_blobArr as $k => $v) {
- $this->fields[$v] = ADORecordSet_postgres64::_decode($this->fields[$v]);
- }
- }
- }
-
- // 10% speedup to move MoveNext to child class
- function MoveNext()
- {
- if (!$this->EOF) {
- $this->_currentRow++;
- if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
- $this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
- if (is_array($this->fields) && $this->fields) {
- if (isset($this->_blobArr)) $this->_fixblobs();
- return true;
- }
- }
- $this->fields = false;
- $this->EOF = true;
- }
- return false;
- }
-
- function _fetch()
- {
-
- if ($this->_currentRow >= $this->_numOfRows && $this->_numOfRows >= 0)
- return false;
-
- $this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
-
- if ($this->fields && isset($this->_blobArr)) $this->_fixblobs();
-
- return (is_array($this->fields));
- }
-
- function _close()
- {
- return @pg_freeresult($this->_queryID);
- }
-
- function MetaType($t,$len=-1,$fieldobj=false)
- {
- if (is_object($t)) {
- $fieldobj = $t;
- $t = $fieldobj->type;
- $len = $fieldobj->max_length;
- }
- switch (strtoupper($t)) {
- case 'MONEY': // stupid, postgres expects money to be a string
- case 'INTERVAL':
- case 'CHAR':
- case 'CHARACTER':
- case 'VARCHAR':
- case 'NAME':
- case 'BPCHAR':
- case '_VARCHAR':
- case 'INET':
- case 'MACADDR':
- if ($len <= $this->blobSize) return 'C';
-
- case 'TEXT':
- return 'X';
-
- case 'IMAGE': // user defined type
- case 'BLOB': // user defined type
- case 'BIT': // This is a bit string, not a single bit, so don't return 'L'
- case 'VARBIT':
- case 'BYTEA':
- return 'B';
-
- case 'BOOL':
- case 'BOOLEAN':
- return 'L';
-
- case 'DATE':
- return 'D';
-
-
- case 'TIMESTAMP WITHOUT TIME ZONE':
- case 'TIME':
- case 'DATETIME':
- case 'TIMESTAMP':
- case 'TIMESTAMPTZ':
- return 'T';
-
- case 'SMALLINT':
- case 'BIGINT':
- case 'INTEGER':
- case 'INT8':
- case 'INT4':
- case 'INT2':
- if (isset($fieldobj) &&
- empty($fieldobj->primary_key) && (!$this->uniqueIisR || empty($fieldobj->unique))) return 'I';
-
- case 'OID':
- case 'SERIAL':
- return 'R';
-
- default:
- return 'N';
- }
- }
-
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-postgres7.inc.php b/src/adodb5/drivers/adodb-postgres7.inc.php
deleted file mode 100644
index 654060c3..00000000
--- a/src/adodb5/drivers/adodb-postgres7.inc.php
+++ /dev/null
@@ -1,313 +0,0 @@
-ADODB_postgres64();
- if (ADODB_ASSOC_CASE !== 2) {
- $this->rsPrefix .= 'assoc_';
- }
- $this->_bindInputArray = PHP_VERSION >= 5.1;
- }
-
-
- // the following should be compat with postgresql 7.2,
- // which makes obsolete the LIMIT limit,offset syntax
- function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
- {
- $offsetStr = ($offset >= 0) ? " OFFSET ".((integer)$offset) : '';
- $limitStr = ($nrows >= 0) ? " LIMIT ".((integer)$nrows) : '';
- if ($secs2cache)
- $rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
- else
- $rs = $this->Execute($sql."$limitStr$offsetStr",$inputarr);
-
- return $rs;
- }
- /*
- function Prepare($sql)
- {
- $info = $this->ServerInfo();
- if ($info['version']>=7.3) {
- return array($sql,false);
- }
- return $sql;
- }
- */
-
- /*
- I discovered that the MetaForeignKeys method no longer worked for Postgres 8.3.
- I went ahead and modified it to work for both 8.2 and 8.3.
- Please feel free to include this change in your next release of adodb.
- William Kolodny [William.Kolodny#gt-t.net]
- */
- function MetaForeignKeys($table, $owner=false, $upper=false)
- {
- $sql="
- SELECT fum.ftblname AS lookup_table, split_part(fum.rf, ')'::text, 1) AS lookup_field,
- fum.ltable AS dep_table, split_part(fum.lf, ')'::text, 1) AS dep_field
- FROM (
- SELECT fee.ltable, fee.ftblname, fee.consrc, split_part(fee.consrc,'('::text, 2) AS lf,
- split_part(fee.consrc, '('::text, 3) AS rf
- FROM (
- SELECT foo.relname AS ltable, foo.ftblname,
- pg_get_constraintdef(foo.oid) AS consrc
- FROM (
- SELECT c.oid, c.conname AS name, t.relname, ft.relname AS ftblname
- FROM pg_constraint c
- JOIN pg_class t ON (t.oid = c.conrelid)
- JOIN pg_class ft ON (ft.oid = c.confrelid)
- JOIN pg_namespace nft ON (nft.oid = ft.relnamespace)
- LEFT JOIN pg_description ds ON (ds.objoid = c.oid)
- JOIN pg_namespace n ON (n.oid = t.relnamespace)
- WHERE c.contype = 'f'::\"char\"
- ORDER BY t.relname, n.nspname, c.conname, c.oid
- ) foo
- ) fee) fum
- WHERE fum.ltable='".strtolower($table)."'
- ORDER BY fum.ftblname, fum.ltable, split_part(fum.lf, ')'::text, 1)
- ";
- $rs = $this->Execute($sql);
-
- if (!$rs || $rs->EOF) return false;
-
- $a = array();
- while (!$rs->EOF) {
- if ($upper) {
- $a[strtoupper($rs->Fields('lookup_table'))][] = strtoupper(str_replace('"','',$rs->Fields('dep_field').'='.$rs->Fields('lookup_field')));
- } else {
- $a[$rs->Fields('lookup_table')][] = str_replace('"','',$rs->Fields('dep_field').'='.$rs->Fields('lookup_field'));
- }
- $rs->MoveNext();
- }
-
- return $a;
-
- }
-
- // from Edward Jaramilla, improved version - works on pg 7.4
- function _old_MetaForeignKeys($table, $owner=false, $upper=false)
- {
- $sql = 'SELECT t.tgargs as args
- FROM
- pg_trigger t,pg_class c,pg_proc p
- WHERE
- t.tgenabled AND
- t.tgrelid = c.oid AND
- t.tgfoid = p.oid AND
- p.proname = \'RI_FKey_check_ins\' AND
- c.relname = \''.strtolower($table).'\'
- ORDER BY
- t.tgrelid';
-
- $rs = $this->Execute($sql);
-
- if (!$rs || $rs->EOF) return false;
-
- $arr = $rs->GetArray();
- $a = array();
- foreach($arr as $v) {
- $data = explode(chr(0), $v['args']);
- $size = count($data)-1; //-1 because the last node is empty
- for($i = 4; $i < $size; $i++) {
- if ($upper)
- $a[strtoupper($data[2])][] = strtoupper($data[$i].'='.$data[++$i]);
- else
- $a[$data[2]][] = $data[$i].'='.$data[++$i];
- }
- }
- return $a;
- }
-
- function _query($sql,$inputarr=false)
- {
- if (! $this->_bindInputArray) {
- // We don't have native support for parameterized queries, so let's emulate it at the parent
- return ADODB_postgres64::_query($sql, $inputarr);
- }
- $this->_errorMsg = false;
- // -- added Cristiano da Cunha Duarte
- if ($inputarr) {
- $sqlarr = explode('?',trim($sql));
- $sql = '';
- $i = 1;
- $last = sizeof($sqlarr)-1;
- foreach($sqlarr as $v) {
- if ($last < $i) $sql .= $v;
- else $sql .= $v.' $'.$i;
- $i++;
- }
-
- $rez = pg_query_params($this->_connectionID,$sql, $inputarr);
- } else {
- $rez = pg_query($this->_connectionID,$sql);
- }
- // check if no data returned, then no need to create real recordset
- if ($rez && pg_numfields($rez) <= 0) {
- if (is_resource($this->_resultid) && get_resource_type($this->_resultid) === 'pgsql result') {
- pg_freeresult($this->_resultid);
- }
- $this->_resultid = $rez;
- return true;
- }
- return $rez;
- }
-
- // this is a set of functions for managing client encoding - very important if the encodings
- // of your database and your output target (i.e. HTML) don't match
- //for instance, you may have UNICODE database and server it on-site as WIN1251 etc.
- // GetCharSet - get the name of the character set the client is using now
- // the functions should work with Postgres 7.0 and above, the set of charsets supported
- // depends on compile flags of postgres distribution - if no charsets were compiled into the server
- // it will return 'SQL_ANSI' always
- function GetCharSet()
- {
- //we will use ADO's builtin property charSet
- $this->charSet = @pg_client_encoding($this->_connectionID);
- if (!$this->charSet) {
- return false;
- } else {
- return $this->charSet;
- }
- }
-
- // SetCharSet - switch the client encoding
- function SetCharSet($charset_name)
- {
- $this->GetCharSet();
- if ($this->charSet !== $charset_name) {
- $if = pg_set_client_encoding($this->_connectionID, $charset_name);
- if ($if == "0" & $this->GetCharSet() == $charset_name) {
- return true;
- } else return false;
- } else return true;
- }
-
-}
-
-/*--------------------------------------------------------------------------------------
- Class Name: Recordset
---------------------------------------------------------------------------------------*/
-
-class ADORecordSet_postgres7 extends ADORecordSet_postgres64{
-
- var $databaseType = "postgres7";
-
-
- function __construct($queryID,$mode=false)
- {
- $this->ADORecordSet_postgres64($queryID,$mode);
- }
-
- // 10% speedup to move MoveNext to child class
- function MoveNext()
- {
- if (!$this->EOF) {
- $this->_currentRow++;
- if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
- $this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
-
- if (is_array($this->fields)) {
- if ($this->fields && isset($this->_blobArr)) $this->_fixblobs();
- return true;
- }
- }
- $this->fields = false;
- $this->EOF = true;
- }
- return false;
- }
-
-}
-
-class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{
-
- var $databaseType = "postgres7";
-
-
- function __construct($queryID,$mode=false)
- {
- $this->ADORecordSet_postgres64($queryID,$mode);
- }
-
- function _fetch()
- {
- if ($this->_currentRow >= $this->_numOfRows && $this->_numOfRows >= 0)
- return false;
-
- $this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
-
- if ($this->fields) {
- if (isset($this->_blobArr)) $this->_fixblobs();
- $this->_updatefields();
- }
-
- return (is_array($this->fields));
- }
-
- // Create associative array
- function _updatefields()
- {
- if (ADODB_ASSOC_CASE == 2) return; // native
-
- $arr = array();
- $lowercase = (ADODB_ASSOC_CASE == 0);
-
- foreach($this->fields as $k => $v) {
- if (is_integer($k)) $arr[$k] = $v;
- else {
- if ($lowercase)
- $arr[strtolower($k)] = $v;
- else
- $arr[strtoupper($k)] = $v;
- }
- }
- $this->fields = $arr;
- }
-
- function MoveNext()
- {
- if (!$this->EOF) {
- $this->_currentRow++;
- if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
- $this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
-
- if (is_array($this->fields)) {
- if ($this->fields) {
- if (isset($this->_blobArr)) $this->_fixblobs();
-
- $this->_updatefields();
- }
- return true;
- }
- }
-
-
- $this->fields = false;
- $this->EOF = true;
- }
- return false;
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-postgres8.inc.php b/src/adodb5/drivers/adodb-postgres8.inc.php
deleted file mode 100644
index 05a705eb..00000000
--- a/src/adodb5/drivers/adodb-postgres8.inc.php
+++ /dev/null
@@ -1,12 +0,0 @@
-
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-proxy.inc.php b/src/adodb5/drivers/adodb-proxy.inc.php
deleted file mode 100644
index dbe39fc9..00000000
--- a/src/adodb5/drivers/adodb-proxy.inc.php
+++ /dev/null
@@ -1,33 +0,0 @@
-ADORecordset($id,$mode);
- }
- };
-} // define
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-sapdb.inc.php b/src/adodb5/drivers/adodb-sapdb.inc.php
deleted file mode 100644
index 723f415a..00000000
--- a/src/adodb5/drivers/adodb-sapdb.inc.php
+++ /dev/null
@@ -1,184 +0,0 @@
-curmode = SQL_CUR_USE_ODBC;
- $this->ADODB_odbc();
- }
-
- function ServerInfo()
- {
- $info = ADODB_odbc::ServerInfo();
- if (!$info['version'] && preg_match('/([0-9.]+)/',$info['description'],$matches)) {
- $info['version'] = $matches[1];
- }
- return $info;
- }
-
- function MetaPrimaryKeys($table)
- {
- $table = $this->Quote(strtoupper($table));
-
- return $this->GetCol("SELECT columnname FROM COLUMNS WHERE tablename=$table AND mode='KEY' ORDER BY pos");
- }
-
- function MetaIndexes ($table, $primary = FALSE)
- {
- $table = $this->Quote(strtoupper($table));
-
- $sql = "SELECT INDEXNAME,TYPE,COLUMNNAME FROM INDEXCOLUMNS ".
- " WHERE TABLENAME=$table".
- " ORDER BY INDEXNAME,COLUMNNO";
-
- global $ADODB_FETCH_MODE;
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== FALSE) {
- $savem = $this->SetFetchMode(FALSE);
- }
-
- $rs = $this->Execute($sql);
- if (isset($savem)) {
- $this->SetFetchMode($savem);
- }
- $ADODB_FETCH_MODE = $save;
-
- if (!is_object($rs)) {
- return FALSE;
- }
-
- $indexes = array();
- while ($row = $rs->FetchRow()) {
- $indexes[$row[0]]['unique'] = $row[1] == 'UNIQUE';
- $indexes[$row[0]]['columns'][] = $row[2];
- }
- if ($primary) {
- $indexes['SYSPRIMARYKEYINDEX'] = array(
- 'unique' => True, // by definition
- 'columns' => $this->GetCol("SELECT columnname FROM COLUMNS WHERE tablename=$table AND mode='KEY' ORDER BY pos"),
- );
- }
- return $indexes;
- }
-
- function MetaColumns ($table)
- {
- global $ADODB_FETCH_MODE;
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- if ($this->fetchMode !== FALSE) {
- $savem = $this->SetFetchMode(FALSE);
- }
- $table = $this->Quote(strtoupper($table));
-
- $retarr = array();
- foreach($this->GetAll("SELECT COLUMNNAME,DATATYPE,LEN,DEC,NULLABLE,MODE,\"DEFAULT\",CASE WHEN \"DEFAULT\" IS NULL THEN 0 ELSE 1 END AS HAS_DEFAULT FROM COLUMNS WHERE tablename=$table ORDER BY pos") as $column)
- {
- $fld = new ADOFieldObject();
- $fld->name = $column[0];
- $fld->type = $column[1];
- $fld->max_length = $fld->type == 'LONG' ? 2147483647 : $column[2];
- $fld->scale = $column[3];
- $fld->not_null = $column[4] == 'NO';
- $fld->primary_key = $column[5] == 'KEY';
- if ($fld->has_default = $column[7]) {
- if ($fld->primary_key && $column[6] == 'DEFAULT SERIAL (1)') {
- $fld->auto_increment = true;
- $fld->has_default = false;
- } else {
- $fld->default_value = $column[6];
- switch($fld->type) {
- case 'VARCHAR':
- case 'CHARACTER':
- case 'LONG':
- $fld->default_value = $column[6];
- break;
- default:
- $fld->default_value = trim($column[6]);
- break;
- }
- }
- }
- $retarr[$fld->name] = $fld;
- }
- if (isset($savem)) {
- $this->SetFetchMode($savem);
- }
- $ADODB_FETCH_MODE = $save;
-
- return $retarr;
- }
-
- function MetaColumnNames($table)
- {
- $table = $this->Quote(strtoupper($table));
-
- return $this->GetCol("SELECT columnname FROM COLUMNS WHERE tablename=$table ORDER BY pos");
- }
-
- // unlike it seems, this depends on the db-session and works in a multiuser environment
- function _insertid($table,$column)
- {
- return empty($table) ? False : $this->GetOne("SELECT $table.CURRVAL FROM DUAL");
- }
-
- /*
- SelectLimit implementation problems:
-
- The following will return random 10 rows as order by performed after "WHERE rowno<10"
- which is not ideal...
-
- select * from table where rowno < 10 order by 1
-
- This means that we have to use the adoconnection base class SelectLimit when
- there is an "order by".
-
- See http://listserv.sap.com/pipermail/sapdb.general/2002-January/010405.html
- */
-
-};
-
-
-class ADORecordSet_sapdb extends ADORecordSet_odbc {
-
- var $databaseType = "sapdb";
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_odbc($id,$mode);
- }
-}
-
-} //define
-?>
\ No newline at end of file
diff --git a/src/adodb5/drivers/adodb-sqlanywhere.inc.php b/src/adodb5/drivers/adodb-sqlanywhere.inc.php
deleted file mode 100644
index ba5a503f..00000000
--- a/src/adodb5/drivers/adodb-sqlanywhere.inc.php
+++ /dev/null
@@ -1,169 +0,0 @@
-create_blobvar($blobVarName);
-
- b) load blob var from file. $filename must be complete path
-
- $dbcon->load_blobvar_from_file($blobVarName, $filename);
-
- c) Use the $blobVarName in SQL insert or update statement in the values
- clause:
-
- $recordSet = $dbconn->Execute('INSERT INTO tabname (idcol, blobcol) '
- .
- 'VALUES (\'test\', ' . $blobVarName . ')');
-
- instead of loading blob from a file, you can also load from
- an unformatted (raw) blob variable:
- $dbcon->load_blobvar_from_var($blobVarName, $varName);
-
- d) drop blob variable on db server to free up resources:
- $dbconn->drop_blobvar($blobVarName);
-
- Sybase_SQLAnywhere data driver. Requires ODBC.
-
-*/
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-if (!defined('_ADODB_ODBC_LAYER')) {
- include(ADODB_DIR."/drivers/adodb-odbc.inc.php");
-}
-
-if (!defined('ADODB_SYBASE_SQLANYWHERE')){
-
- define('ADODB_SYBASE_SQLANYWHERE',1);
-
- class ADODB_sqlanywhere extends ADODB_odbc {
- var $databaseType = "sqlanywhere";
- var $hasInsertID = true;
-
- function __construct()
- {
- $this->ADODB_odbc();
- }
-
- function _insertid() {
- return $this->GetOne('select @@identity');
- }
-
- function create_blobvar($blobVarName) {
- $this->Execute("create variable $blobVarName long binary");
- return;
- }
-
- function drop_blobvar($blobVarName) {
- $this->Execute("drop variable $blobVarName");
- return;
- }
-
- function load_blobvar_from_file($blobVarName, $filename) {
- $chunk_size = 1000;
-
- $fd = fopen ($filename, "rb");
-
- $integer_chunks = (integer)filesize($filename) / $chunk_size;
- $modulus = filesize($filename) % $chunk_size;
- if ($modulus != 0){
- $integer_chunks += 1;
- }
-
- for($loop=1;$loop<=$integer_chunks;$loop++){
- $contents = fread ($fd, $chunk_size);
- $contents = bin2hex($contents);
-
- $hexstring = '';
-
- for($loop2=0;$loop2qstr($hexstring);
-
- $this->Execute("set $blobVarName = $blobVarName || " . $hexstring);
- }
-
- fclose ($fd);
- return;
- }
-
- function load_blobvar_from_var($blobVarName, &$varName) {
- $chunk_size = 1000;
-
- $integer_chunks = (integer)strlen($varName) / $chunk_size;
- $modulus = strlen($varName) % $chunk_size;
- if ($modulus != 0){
- $integer_chunks += 1;
- }
-
- for($loop=1;$loop<=$integer_chunks;$loop++){
- $contents = substr ($varName, (($loop - 1) * $chunk_size), $chunk_size);
- $contents = bin2hex($contents);
-
- $hexstring = '';
-
- for($loop2=0;$loop2qstr($hexstring);
-
- $this->Execute("set $blobVarName = $blobVarName || " . $hexstring);
- }
-
- return;
- }
-
- /*
- Insert a null into the blob field of the table first.
- Then use UpdateBlob to store the blob.
-
- Usage:
-
- $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
- $conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');
- */
- function UpdateBlob($table,$column,&$val,$where,$blobtype='BLOB')
- {
- $blobVarName = 'hold_blob';
- $this->create_blobvar($blobVarName);
- $this->load_blobvar_from_var($blobVarName, $val);
- $this->Execute("UPDATE $table SET $column=$blobVarName WHERE $where");
- $this->drop_blobvar($blobVarName);
- return true;
- }
- }; //class
-
- class ADORecordSet_sqlanywhere extends ADORecordSet_odbc {
-
- var $databaseType = "sqlanywhere";
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_odbc($id,$mode);
- }
-
-
- }; //class
-
-
-} //define
-?>
diff --git a/src/adodb5/drivers/adodb-vfp.inc.php b/src/adodb5/drivers/adodb-vfp.inc.php
deleted file mode 100644
index 8cd791a8..00000000
--- a/src/adodb5/drivers/adodb-vfp.inc.php
+++ /dev/null
@@ -1,107 +0,0 @@
-ADODB_odbc();
- }
-
- function Time()
- {
- return time();
- }
-
- function BeginTrans() { return false;}
-
- // quote string to be sent back to database
- function qstr($s,$nofixquotes=false)
- {
- if (!$nofixquotes) return "'".str_replace("\r\n","'+chr(13)+'",str_replace("'",$this->replaceQuote,$s))."'";
- return "'".$s."'";
- }
-
-
- // TOP requires ORDER BY for VFP
- function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
- {
- $this->hasTop = preg_match('/ORDER[ \t\r\n]+BY/is',$sql) ? 'top' : false;
- $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
- return $ret;
- }
-
-
-
-};
-
-
-class ADORecordSet_vfp extends ADORecordSet_odbc {
-
- var $databaseType = "vfp";
-
-
- function __construct($id,$mode=false)
- {
- $this->ADORecordSet_odbc($id,$mode);
- }
-
- function MetaType($t,$len=-1)
- {
- if (is_object($t)) {
- $fieldobj = $t;
- $t = $fieldobj->type;
- $len = $fieldobj->max_length;
- }
- switch (strtoupper($t)) {
- case 'C':
- if ($len <= $this->blobSize) return 'C';
- case 'M':
- return 'X';
-
- case 'D': return 'D';
-
- case 'T': return 'T';
-
- case 'L': return 'L';
-
- case 'I': return 'I';
-
- default: return 'N';
- }
- }
-}
-
-} //define
-?>
\ No newline at end of file
diff --git a/src/adodb5/pear/Auth/Container/ADOdb.php b/src/adodb5/pear/Auth/Container/ADOdb.php
deleted file mode 100644
index de550522..00000000
--- a/src/adodb5/pear/Auth/Container/ADOdb.php
+++ /dev/null
@@ -1,413 +0,0 @@
-
-// | Richard Tango-Lowy |
-// +----------------------------------------------------------------------+
-//
-// $Id: ADOdb.php,v 1.3 2005/05/18 06:58:47 jlim Exp $
-//
-
-require_once 'Auth/Container.php';
-require_once 'adodb.inc.php';
-require_once 'adodb-pear.inc.php';
-require_once 'adodb-errorpear.inc.php';
-
-/**
- * Storage driver for fetching login data from a database using ADOdb-PHP.
- *
- * This storage driver can use all databases which are supported
- * by the ADBdb DB abstraction layer to fetch login data.
- * See http://php.weblogs.com/adodb for information on ADOdb.
- * NOTE: The ADOdb directory MUST be in your PHP include_path!
- *
- * @author Richard Tango-Lowy
- * @package Auth
- * @version $Revision: 1.3 $
- */
-class Auth_Container_ADOdb extends Auth_Container
-{
-
- /**
- * Additional options for the storage container
- * @var array
- */
- var $options = array();
-
- /**
- * DB object
- * @var object
- */
- var $db = null;
- var $dsn = '';
-
- /**
- * User that is currently selected from the DB.
- * @var string
- */
- var $activeUser = '';
-
- // {{{ Constructor
-
- /**
- * Constructor of the container class
- *
- * Initate connection to the database via PEAR::ADOdb
- *
- * @param string Connection data or DB object
- * @return object Returns an error object if something went wrong
- */
- function __construct($dsn)
- {
- $this->_setDefaults();
-
- if (is_array($dsn)) {
- $this->_parseOptions($dsn);
-
- if (empty($this->options['dsn'])) {
- PEAR::raiseError('No connection parameters specified!');
- }
- } else {
- // Extract db_type from dsn string.
- $this->options['dsn'] = $dsn;
- }
- }
-
- // }}}
- // {{{ _connect()
-
- /**
- * Connect to database by using the given DSN string
- *
- * @access private
- * @param string DSN string
- * @return mixed Object on error, otherwise bool
- */
- function _connect($dsn)
- {
- if (is_string($dsn) || is_array($dsn)) {
- if(!$this->db) {
- $this->db = ADONewConnection($dsn);
- if( $err = ADODB_Pear_error() ) {
- return PEAR::raiseError($err);
- }
- }
-
- } else {
- return PEAR::raiseError('The given dsn was not valid in file ' . __FILE__ . ' at line ' . __LINE__,
- 41,
- PEAR_ERROR_RETURN,
- null,
- null
- );
- }
-
- if(!$this->db) {
- return PEAR::raiseError(ADODB_Pear_error());
- } else {
- return true;
- }
- }
-
- // }}}
- // {{{ _prepare()
-
- /**
- * Prepare database connection
- *
- * This function checks if we have already opened a connection to
- * the database. If that's not the case, a new connection is opened.
- *
- * @access private
- * @return mixed True or a DB error object.
- */
- function _prepare()
- {
- if(!$this->db) {
- $res = $this->_connect($this->options['dsn']);
- }
- return true;
- }
-
- // }}}
- // {{{ query()
-
- /**
- * Prepare query to the database
- *
- * This function checks if we have already opened a connection to
- * the database. If that's not the case, a new connection is opened.
- * After that the query is passed to the database.
- *
- * @access public
- * @param string Query string
- * @return mixed a DB_result object or DB_OK on success, a DB
- * or PEAR error on failure
- */
- function query($query)
- {
- $err = $this->_prepare();
- if ($err !== true) {
- return $err;
- }
- return $this->db->query($query);
- }
-
- // }}}
- // {{{ _setDefaults()
-
- /**
- * Set some default options
- *
- * @access private
- * @return void
- */
- function _setDefaults()
- {
- $this->options['db_type'] = 'mysql';
- $this->options['table'] = 'auth';
- $this->options['usernamecol'] = 'username';
- $this->options['passwordcol'] = 'password';
- $this->options['dsn'] = '';
- $this->options['db_fields'] = '';
- $this->options['cryptType'] = 'md5';
- }
-
- // }}}
- // {{{ _parseOptions()
-
- /**
- * Parse options passed to the container class
- *
- * @access private
- * @param array
- */
- function _parseOptions($array)
- {
- foreach ($array as $key => $value) {
- if (isset($this->options[$key])) {
- $this->options[$key] = $value;
- }
- }
-
- /* Include additional fields if they exist */
- if(!empty($this->options['db_fields'])){
- if(is_array($this->options['db_fields'])){
- $this->options['db_fields'] = implode(', ', $this->options['db_fields']);
- }
- $this->options['db_fields'] = ', '.$this->options['db_fields'];
- }
- }
-
- // }}}
- // {{{ fetchData()
-
- /**
- * Get user information from database
- *
- * This function uses the given username to fetch
- * the corresponding login data from the database
- * table. If an account that matches the passed username
- * and password is found, the function returns true.
- * Otherwise it returns false.
- *
- * @param string Username
- * @param string Password
- * @return mixed Error object or boolean
- */
- function fetchData($username, $password)
- {
- // Prepare for a database query
- $err = $this->_prepare();
- if ($err !== true) {
- return PEAR::raiseError($err->getMessage(), $err->getCode());
- }
-
- // Find if db_fields contains a *, i so assume all col are selected
- if(strstr($this->options['db_fields'], '*')){
- $sql_from = "*";
- }
- else{
- $sql_from = $this->options['usernamecol'] . ", ".$this->options['passwordcol'].$this->options['db_fields'];
- }
-
- $query = "SELECT ".$sql_from.
- " FROM ".$this->options['table'].
- " WHERE ".$this->options['usernamecol']." = " . $this->db->Quote($username);
-
- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
- $rset = $this->db->Execute( $query );
- $res = $rset->fetchRow();
-
- if (DB::isError($res)) {
- return PEAR::raiseError($res->getMessage(), $res->getCode());
- }
- if (!is_array($res)) {
- $this->activeUser = '';
- return false;
- }
- if ($this->verifyPassword(trim($password, "\r\n"),
- trim($res[$this->options['passwordcol']], "\r\n"),
- $this->options['cryptType'])) {
- // Store additional field values in the session
- foreach ($res as $key => $value) {
- if ($key == $this->options['passwordcol'] ||
- $key == $this->options['usernamecol']) {
- continue;
- }
- // Use reference to the auth object if exists
- // This is because the auth session variable can change so a static call to setAuthData does not make sence
- if(is_object($this->_auth_obj)){
- $this->_auth_obj->setAuthData($key, $value);
- } else {
- Auth::setAuthData($key, $value);
- }
- }
-
- return true;
- }
-
- $this->activeUser = $res[$this->options['usernamecol']];
- return false;
- }
-
- // }}}
- // {{{ listUsers()
-
- function listUsers()
- {
- $err = $this->_prepare();
- if ($err !== true) {
- return PEAR::raiseError($err->getMessage(), $err->getCode());
- }
-
- $retVal = array();
-
- // Find if db_fileds contains a *, i so assume all col are selected
- if(strstr($this->options['db_fields'], '*')){
- $sql_from = "*";
- }
- else{
- $sql_from = $this->options['usernamecol'] . ", ".$this->options['passwordcol'].$this->options['db_fields'];
- }
-
- $query = sprintf("SELECT %s FROM %s",
- $sql_from,
- $this->options['table']
- );
- $res = $this->db->getAll($query, null, DB_FETCHMODE_ASSOC);
-
- if (DB::isError($res)) {
- return PEAR::raiseError($res->getMessage(), $res->getCode());
- } else {
- foreach ($res as $user) {
- $user['username'] = $user[$this->options['usernamecol']];
- $retVal[] = $user;
- }
- }
- return $retVal;
- }
-
- // }}}
- // {{{ addUser()
-
- /**
- * Add user to the storage container
- *
- * @access public
- * @param string Username
- * @param string Password
- * @param mixed Additional information that are stored in the DB
- *
- * @return mixed True on success, otherwise error object
- */
- function addUser($username, $password, $additional = "")
- {
- if (function_exists($this->options['cryptType'])) {
- $cryptFunction = $this->options['cryptType'];
- } else {
- $cryptFunction = 'md5';
- }
-
- $additional_key = '';
- $additional_value = '';
-
- if (is_array($additional)) {
- foreach ($additional as $key => $value) {
- $additional_key .= ', ' . $key;
- $additional_value .= ", '" . $value . "'";
- }
- }
-
- $query = sprintf("INSERT INTO %s (%s, %s%s) VALUES ('%s', '%s'%s)",
- $this->options['table'],
- $this->options['usernamecol'],
- $this->options['passwordcol'],
- $additional_key,
- $username,
- $cryptFunction($password),
- $additional_value
- );
-
- $res = $this->query($query);
-
- if (DB::isError($res)) {
- return PEAR::raiseError($res->getMessage(), $res->getCode());
- } else {
- return true;
- }
- }
-
- // }}}
- // {{{ removeUser()
-
- /**
- * Remove user from the storage container
- *
- * @access public
- * @param string Username
- *
- * @return mixed True on success, otherwise error object
- */
- function removeUser($username)
- {
- $query = sprintf("DELETE FROM %s WHERE %s = '%s'",
- $this->options['table'],
- $this->options['usernamecol'],
- $username
- );
-
- $res = $this->query($query);
-
- if (DB::isError($res)) {
- return PEAR::raiseError($res->getMessage(), $res->getCode());
- } else {
- return true;
- }
- }
-
- // }}}
-}
-
-function showDbg( $string ) {
- print "
--- $string";
-}
-function dump( $var, $str, $vardump = false ) {
- print "$str
";
- ( !$vardump ) ? ( print_r( $var )) : ( var_dump( $var ));
- print "
";
-}
-?>
diff --git a/src/adodb5/pear/readme.Auth.txt b/src/adodb5/pear/readme.Auth.txt
deleted file mode 100644
index db283197..00000000
--- a/src/adodb5/pear/readme.Auth.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-From: Rich Tango-Lowy (richtl#arscognita.com)
-Date: Sat, May 29, 2004 11:20 am
-
-OK, I hacked out an ADOdb container for PEAR-Auth. The error handling's
-a bit of a mess, but all the methods work.
-
-Copy ADOdb.php to your pear/Auth/Container/ directory.
-
-Use the ADOdb container exactly as you would the DB
-container, but specify 'ADOdb' instead of 'DB':
-
-$dsn = "mysql://myuser:mypass@localhost/authdb";
-$a = new Auth("ADOdb", $dsn, "loginFunction");
-
-
--------------------
-
-John Lim adds:
-
-See http://pear.php.net/manual/en/package.authentication.php
diff --git a/src/adodb5/perf/perf-db2.inc.php b/src/adodb5/perf/perf-db2.inc.php
deleted file mode 100644
index 71cb84a8..00000000
--- a/src/adodb5/perf/perf-db2.inc.php
+++ /dev/null
@@ -1,102 +0,0 @@
- array('RATIO',
- "SELECT
- case when sum(POOL_DATA_L_READS+POOL_INDEX_L_READS)=0 then 0
- else 100*(1-sum(POOL_DATA_P_READS+POOL_INDEX_P_READS)/sum(POOL_DATA_L_READS+POOL_INDEX_L_READS)) end
- FROM TABLE(SNAPSHOT_APPL('',-2)) as t",
- '=WarnCacheRatio'),
-
- 'Data Cache',
- 'data cache buffers' => array('DATAC',
- 'select sum(npages) from SYSCAT.BUFFERPOOLS',
- 'See tuning reference.' ),
- 'cache blocksize' => array('DATAC',
- 'select avg(pagesize) from SYSCAT.BUFFERPOOLS',
- '' ),
- 'data cache size' => array('DATAC',
- 'select sum(npages*pagesize) from SYSCAT.BUFFERPOOLS',
- '' ),
- 'Connections',
- 'current connections' => array('SESS',
- "SELECT count(*) FROM TABLE(SNAPSHOT_APPL_INFO('',-2)) as t",
- ''),
-
- false
- );
-
-
- function __construct(&$conn)
- {
- $this->conn = $conn;
- }
-
- function Explain($sql,$partial=false)
- {
- $save = $this->conn->LogSQL(false);
- if ($partial) {
- $sqlq = $this->conn->qstr($sql.'%');
- $arr = $this->conn->GetArray("select distinct sql1 from adodb_logsql where sql1 like $sqlq");
- if ($arr) {
- foreach($arr as $row) {
- $sql = reset($row);
- if (crc32($sql) == $partial) break;
- }
- }
- }
- $qno = rand();
- $ok = $this->conn->Execute("EXPLAIN PLAN SET QUERYNO=$qno FOR $sql");
- ob_start();
- if (!$ok) echo "Have EXPLAIN tables been created?
";
- else {
- $rs = $this->conn->Execute("select * from explain_statement where queryno=$qno");
- if ($rs) rs2html($rs);
- }
- $s = ob_get_contents();
- ob_end_clean();
- $this->conn->LogSQL($save);
-
- $s .= $this->Tracer($sql);
- return $s;
- }
-
-
- function Tables()
- {
- $rs = $this->conn->Execute("select tabschema,tabname,card as rows,
- npages pages_used,fpages pages_allocated, tbspace tablespace
- from syscat.tables where tabschema not in ('SYSCAT','SYSIBM','SYSSTAT') order by 1,2");
- return rs2html($rs,false,false,false,false);
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/perf/perf-informix.inc.php b/src/adodb5/perf/perf-informix.inc.php
deleted file mode 100644
index 1e03b32a..00000000
--- a/src/adodb5/perf/perf-informix.inc.php
+++ /dev/null
@@ -1,70 +0,0 @@
- array('RATIOH',
- "select round((1-(wt.value / (rd.value + wr.value)))*100,2)
- from sysmaster:sysprofile wr, sysmaster:sysprofile rd, sysmaster:sysprofile wt
- where rd.name = 'pagreads' and
- wr.name = 'pagwrites' and
- wt.name = 'buffwts'",
- '=WarnCacheRatio'),
- 'IO',
- 'data reads' => array('IO',
- "select value from sysmaster:sysprofile where name='pagreads'",
- 'Page reads'),
-
- 'data writes' => array('IO',
- "select value from sysmaster:sysprofile where name='pagwrites'",
- 'Page writes'),
-
- 'Connections',
- 'current connections' => array('SESS',
- 'select count(*) from sysmaster:syssessions',
- 'Number of sessions'),
-
- false
-
- );
-
- function __construct(&$conn)
- {
- $this->conn = $conn;
- }
-
-}
-?>
diff --git a/src/adodb5/perf/perf-mssql.inc.php b/src/adodb5/perf/perf-mssql.inc.php
deleted file mode 100644
index 787813db..00000000
--- a/src/adodb5/perf/perf-mssql.inc.php
+++ /dev/null
@@ -1,164 +0,0 @@
- array('RATIO',
- "select round((a.cntr_value*100.0)/b.cntr_value,2) from master.dbo.sysperfinfo a, master.dbo.sysperfinfo b where a.counter_name = 'Buffer cache hit ratio' and b.counter_name='Buffer cache hit ratio base'",
- '=WarnCacheRatio'),
- 'prepared sql hit ratio' => array('RATIO',
- array('dbcc cachestats','Prepared',1,100),
- ''),
- 'adhoc sql hit ratio' => array('RATIO',
- array('dbcc cachestats','Adhoc',1,100),
- ''),
- 'IO',
- 'data reads' => array('IO',
- "select cntr_value from master.dbo.sysperfinfo where counter_name = 'Page reads/sec'"),
- 'data writes' => array('IO',
- "select cntr_value from master.dbo.sysperfinfo where counter_name = 'Page writes/sec'"),
-
- 'Data Cache',
- 'data cache size' => array('DATAC',
- "select cntr_value*8192 from master.dbo.sysperfinfo where counter_name = 'Total Pages' and object_name='SQLServer:Buffer Manager'",
- '' ),
- 'data cache blocksize' => array('DATAC',
- "select 8192",'page size'),
- 'Connections',
- 'current connections' => array('SESS',
- '=sp_who',
- ''),
- 'max connections' => array('SESS',
- "SELECT @@MAX_CONNECTIONS",
- ''),
-
- false
- );
-
-
- function __construct(&$conn)
- {
- if ($conn->dataProvider == 'odbc') {
- $this->sql1 = 'sql1';
- //$this->explain = false;
- }
- $this->conn = $conn;
- }
-
- function Explain($sql,$partial=false)
- {
-
- $save = $this->conn->LogSQL(false);
- if ($partial) {
- $sqlq = $this->conn->qstr($sql.'%');
- $arr = $this->conn->GetArray("select distinct sql1 from adodb_logsql where sql1 like $sqlq");
- if ($arr) {
- foreach($arr as $row) {
- $sql = reset($row);
- if (crc32($sql) == $partial) break;
- }
- }
- }
-
- $s = 'Explain: '.htmlspecialchars($sql).'
';
- $this->conn->Execute("SET SHOWPLAN_ALL ON;");
- $sql = str_replace('?',"''",$sql);
- global $ADODB_FETCH_MODE;
-
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $rs = $this->conn->Execute($sql);
- //adodb_printr($rs);
- $ADODB_FETCH_MODE = $save;
- if ($rs) {
- $rs->MoveNext();
- $s .= ' Rows IO CPU Plan ';
- while (!$rs->EOF) {
- $s .= ''.round($rs->fields[8],1).' '.round($rs->fields[9],3).' '.round($rs->fields[10],3).' '.htmlspecialchars($rs->fields[0])."
\n"; ## NOTE CORRUPT tag is intentional!!!!
- $rs->MoveNext();
- }
- $s .= '
';
-
- $rs->NextRecordSet();
- }
-
- $this->conn->Execute("SET SHOWPLAN_ALL OFF;");
- $this->conn->LogSQL($save);
- $s .= $this->Tracer($sql);
- return $s;
- }
-
- function Tables()
- {
- global $ADODB_FETCH_MODE;
-
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- //$this->conn->debug=1;
- $s = 'tablename size_in_k index size reserved size ';
- $rs1 = $this->conn->Execute("select distinct name from sysobjects where xtype='U'");
- if ($rs1) {
- while (!$rs1->EOF) {
- $tab = $rs1->fields[0];
- $tabq = $this->conn->qstr($tab);
- $rs2 = $this->conn->Execute("sp_spaceused $tabq");
- if ($rs2) {
- $s .= ''.$tab.' '.$rs2->fields[3].' '.$rs2->fields[4].' '.$rs2->fields[2].' ';
- $rs2->Close();
- }
- $rs1->MoveNext();
- }
- $rs1->Close();
- }
- $ADODB_FETCH_MODE = $save;
- return $s.'
';
- }
-
- function sp_who()
- {
- $arr = $this->conn->GetArray('sp_who');
- return sizeof($arr);
- }
-
- function HealthCheck($cli=false)
- {
-
- $this->conn->Execute('dbcc traceon(3604)');
- $html = adodb_perf::HealthCheck($cli);
- $this->conn->Execute('dbcc traceoff(3604)');
- return $html;
- }
-
-
-}
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/perf/perf-mssqlnative.inc.php b/src/adodb5/perf/perf-mssqlnative.inc.php
deleted file mode 100644
index a79646a2..00000000
--- a/src/adodb5/perf/perf-mssqlnative.inc.php
+++ /dev/null
@@ -1,164 +0,0 @@
- array('RATIO',
- "select round((a.cntr_value*100.0)/b.cntr_value,2) from master.dbo.sysperfinfo a, master.dbo.sysperfinfo b where a.counter_name = 'Buffer cache hit ratio' and b.counter_name='Buffer cache hit ratio base'",
- '=WarnCacheRatio'),
- 'prepared sql hit ratio' => array('RATIO',
- array('dbcc cachestats','Prepared',1,100),
- ''),
- 'adhoc sql hit ratio' => array('RATIO',
- array('dbcc cachestats','Adhoc',1,100),
- ''),
- 'IO',
- 'data reads' => array('IO',
- "select cntr_value from master.dbo.sysperfinfo where counter_name = 'Page reads/sec'"),
- 'data writes' => array('IO',
- "select cntr_value from master.dbo.sysperfinfo where counter_name = 'Page writes/sec'"),
-
- 'Data Cache',
- 'data cache size' => array('DATAC',
- "select cntr_value*8192 from master.dbo.sysperfinfo where counter_name = 'Total Pages' and object_name='SQLServer:Buffer Manager'",
- '' ),
- 'data cache blocksize' => array('DATAC',
- "select 8192",'page size'),
- 'Connections',
- 'current connections' => array('SESS',
- '=sp_who',
- ''),
- 'max connections' => array('SESS',
- "SELECT @@MAX_CONNECTIONS",
- ''),
-
- false
- );
-
-
- function __construct(&$conn)
- {
- if ($conn->dataProvider == 'odbc') {
- $this->sql1 = 'sql1';
- //$this->explain = false;
- }
- $this->conn =& $conn;
- }
-
- function Explain($sql,$partial=false)
- {
-
- $save = $this->conn->LogSQL(false);
- if ($partial) {
- $sqlq = $this->conn->qstr($sql.'%');
- $arr = $this->conn->GetArray("select distinct sql1 from adodb_logsql where sql1 like $sqlq");
- if ($arr) {
- foreach($arr as $row) {
- $sql = reset($row);
- if (crc32($sql) == $partial) break;
- }
- }
- }
-
- $s = 'Explain: '.htmlspecialchars($sql).'
';
- $this->conn->Execute("SET SHOWPLAN_ALL ON;");
- $sql = str_replace('?',"''",$sql);
- global $ADODB_FETCH_MODE;
-
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- $rs =& $this->conn->Execute($sql);
- //adodb_printr($rs);
- $ADODB_FETCH_MODE = $save;
- if ($rs) {
- $rs->MoveNext();
- $s .= ' Rows IO CPU Plan ';
- while (!$rs->EOF) {
- $s .= ''.round($rs->fields[8],1).' '.round($rs->fields[9],3).' '.round($rs->fields[10],3).' '.htmlspecialchars($rs->fields[0])."
\n"; ## NOTE CORRUPT tag is intentional!!!!
- $rs->MoveNext();
- }
- $s .= '
';
-
- $rs->NextRecordSet();
- }
-
- $this->conn->Execute("SET SHOWPLAN_ALL OFF;");
- $this->conn->LogSQL($save);
- $s .= $this->Tracer($sql);
- return $s;
- }
-
- function Tables()
- {
- global $ADODB_FETCH_MODE;
-
- $save = $ADODB_FETCH_MODE;
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
- //$this->conn->debug=1;
- $s = 'tablename size_in_k index size reserved size ';
- $rs1 = $this->conn->Execute("select distinct name from sysobjects where xtype='U'");
- if ($rs1) {
- while (!$rs1->EOF) {
- $tab = $rs1->fields[0];
- $tabq = $this->conn->qstr($tab);
- $rs2 = $this->conn->Execute("sp_spaceused $tabq");
- if ($rs2) {
- $s .= ''.$tab.' '.$rs2->fields[3].' '.$rs2->fields[4].' '.$rs2->fields[2].' ';
- $rs2->Close();
- }
- $rs1->MoveNext();
- }
- $rs1->Close();
- }
- $ADODB_FETCH_MODE = $save;
- return $s.'
';
- }
-
- function sp_who()
- {
- $arr = $this->conn->GetArray('sp_who');
- return sizeof($arr);
- }
-
- function HealthCheck($cli=false)
- {
-
- $this->conn->Execute('dbcc traceon(3604)');
- $html = adodb_perf::HealthCheck($cli);
- $this->conn->Execute('dbcc traceoff(3604)');
- return $html;
- }
-
-
-}
-
-?>
\ No newline at end of file
diff --git a/src/adodb5/perf/perf-mysql.inc.php b/src/adodb5/perf/perf-mysql.inc.php
index 75d2ba16..58f40972 100644
--- a/src/adodb5/perf/perf-mysql.inc.php
+++ b/src/adodb5/perf/perf-mysql.inc.php
@@ -16,9 +16,9 @@
if (!defined('ADODB_DIR')) die();
class perf_mysql extends adodb_perf{
-
+
var $tablesSQL = 'show table status';
-
+
var $createTableSQL = "CREATE TABLE adodb_logsql (
created datetime NOT NULL,
sql0 varchar(250) NOT NULL,
@@ -27,7 +27,7 @@ class perf_mysql extends adodb_perf{
tracer text NOT NULL,
timer decimal(16,6) NOT NULL
)";
-
+
var $settings = array(
'Ratios',
'MyISAM cache hit ratio' => array('RATIO',
@@ -49,7 +49,7 @@ class perf_mysql extends adodb_perf{
'data writes' => array('IO',
'=GetWrites',
'Number of inserts/updates/deletes * coef (Key_writes is not accurate)'),
-
+
'Data Cache',
'MyISAM data cache size' => array('DATAC',
array("show variables", 'key_buffer_size'),
@@ -77,18 +77,18 @@ class perf_mysql extends adodb_perf{
'max connections' => array( 'SESS',
array("show variables",'max_connections'),
''),
-
+
false
);
-
+
function __construct(&$conn)
{
$this->conn = $conn;
}
-
+
function Explain($sql,$partial=false)
{
-
+
if (strtoupper(substr(trim($sql),0,6)) !== 'SELECT') return 'Unable to EXPLAIN non-select statement
';
$save = $this->conn->LogSQL(false);
if ($partial) {
@@ -102,12 +102,12 @@ function Explain($sql,$partial=false)
}
}
$sql = str_replace('?',"''",$sql);
-
+
if ($partial) {
$sqlq = $this->conn->qstr($sql.'%');
$sql = $this->conn->GetOne("select sql1 from adodb_logsql where sql1 like $sqlq");
}
-
+
$s = 'Explain: '.htmlspecialchars($sql).'
';
$rs = $this->conn->Execute('EXPLAIN '.$sql);
$s .= rs2html($rs,false,false,false,false);
@@ -115,30 +115,30 @@ function Explain($sql,$partial=false)
$s .= $this->Tracer($sql);
return $s;
}
-
+
function Tables()
{
if (!$this->tablesSQL) return false;
-
+
$rs = $this->conn->Execute($this->tablesSQL);
if (!$rs) return false;
-
+
$html = rs2html($rs,false,false,false,false);
return $html;
}
-
+
function GetReads()
{
global $ADODB_FETCH_MODE;
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false);
-
+
$rs = $this->conn->Execute('show status');
-
+
if (isset($savem)) $this->conn->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
-
+
if (!$rs) return 0;
$val = 0;
while (!$rs->EOF) {
@@ -150,24 +150,24 @@ function GetReads()
}
$rs->MoveNext();
}
-
+
$rs->Close();
-
+
return $val;
}
-
+
function GetWrites()
{
global $ADODB_FETCH_MODE;
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false);
-
+
$rs = $this->conn->Execute('show status');
-
+
if (isset($savem)) $this->conn->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
-
+
if (!$rs) return 0;
$val = 0.0;
while (!$rs->EOF) {
@@ -183,27 +183,27 @@ function GetWrites()
}
$rs->MoveNext();
}
-
+
$rs->Close();
-
+
return $val;
}
-
+
function FindDBHitRatio()
{
// first find out type of table
//$this->conn->debug=1;
-
+
global $ADODB_FETCH_MODE;
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false);
-
+
$rs = $this->conn->Execute('show table status');
-
+
if (isset($savem)) $this->conn->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
-
+
if (!$rs) return '';
$type = strtoupper($rs->fields[1]);
$rs->Close();
@@ -216,29 +216,29 @@ function FindDBHitRatio()
default:
return $type.' not supported';
}
-
+
}
-
+
function GetQHitRatio()
{
//Total number of queries = Qcache_inserts + Qcache_hits + Qcache_not_cached
$hits = $this->_DBParameter(array("show status","Qcache_hits"));
$total = $this->_DBParameter(array("show status","Qcache_inserts"));
$total += $this->_DBParameter(array("show status","Qcache_not_cached"));
-
+
$total += $hits;
if ($total) return round(($hits*100)/$total,2);
return 0;
}
-
+
/*
Use session variable to store Hit percentage, because MySQL
does not remember last value of SHOW INNODB STATUS hit ratio
-
+
# 1st query to SHOW INNODB STATUS
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000
-
+
# 2nd query to SHOW INNODB STATUS
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool activity since the last printout
@@ -246,16 +246,16 @@ function GetQHitRatio()
function GetInnoDBHitRatio()
{
global $ADODB_FETCH_MODE;
-
+
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false);
-
+
$rs = $this->conn->Execute('show innodb status');
-
+
if (isset($savem)) $this->conn->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
-
+
if (!$rs || $rs->EOF) return 0;
$stat = $rs->fields[0];
$rs->Close();
@@ -271,30 +271,30 @@ function GetInnoDBHitRatio()
}
return 0;
}
-
+
function GetKeyHitRatio()
{
$hits = $this->_DBParameter(array("show status","Key_read_requests"));
$reqs = $this->_DBParameter(array("show status","Key_reads"));
if ($reqs == 0) return 0;
-
+
return round(($hits/($reqs+$hits))*100,2);
}
-
+
// start hack
var $optimizeTableLow = 'CHECK TABLE %s FAST QUICK';
var $optimizeTableHigh = 'OPTIMIZE TABLE %s';
-
+
/**
* @see adodb_perf#optimizeTable
*/
function optimizeTable( $table, $mode = ADODB_OPT_LOW)
{
if ( !is_string( $table)) return false;
-
+
$conn = $this->conn;
if ( !$conn) return false;
-
+
$sql = '';
switch( $mode) {
case ADODB_OPT_LOW : $sql = $this->optimizeTableLow; break;
@@ -302,14 +302,14 @@ function optimizeTable( $table, $mode = ADODB_OPT_LOW)
default :
{
// May dont use __FUNCTION__ constant for BC (__FUNCTION__ Added in PHP 4.3.0)
- ADOConnection::outp( sprintf( "%s: '%s' using of undefined mode '%s'
", __CLASS__, __FUNCTION__, $mode));
+ ADOConnection::outp( sprintf( "%s: '%s' using of undefined mode '%s'
", self::class, __FUNCTION__, $mode));
return false;
}
}
$sql = sprintf( $sql, $table);
-
+
return $conn->Execute( $sql) !== false;
}
// end hack
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/perf/perf-oci8.inc.php b/src/adodb5/perf/perf-oci8.inc.php
deleted file mode 100644
index b5c87e52..00000000
--- a/src/adodb5/perf/perf-oci8.inc.php
+++ /dev/null
@@ -1,570 +0,0 @@
- array('RATIOH',
- "select round((1-(phy.value / (cur.value + con.value)))*100,2)
- from v\$sysstat cur, v\$sysstat con, v\$sysstat phy
- where cur.name = 'db block gets' and
- con.name = 'consistent gets' and
- phy.name = 'physical reads'",
- '=WarnCacheRatio'),
-
- 'sql cache hit ratio' => array( 'RATIOH',
- 'select round(100*(sum(pins)-sum(reloads))/sum(pins),2) from v$librarycache',
- 'increase shared_pool_size if too ratio low'),
-
- 'datadict cache hit ratio' => array('RATIOH',
- "select
- round((1 - (sum(getmisses) / (sum(gets) +
- sum(getmisses))))*100,2)
- from v\$rowcache",
- 'increase shared_pool_size if too ratio low'),
-
- 'memory sort ratio' => array('RATIOH',
- "SELECT ROUND((100 * b.VALUE) /DECODE ((a.VALUE + b.VALUE),
- 0,1,(a.VALUE + b.VALUE)),2)
-FROM v\$sysstat a,
- v\$sysstat b
-WHERE a.name = 'sorts (disk)'
-AND b.name = 'sorts (memory)'",
- "% of memory sorts compared to disk sorts - should be over 95%"),
-
- 'IO',
- 'data reads' => array('IO',
- "select value from v\$sysstat where name='physical reads'"),
-
- 'data writes' => array('IO',
- "select value from v\$sysstat where name='physical writes'"),
-
- 'Data Cache',
-
- 'data cache buffers' => array( 'DATAC',
- "select a.value/b.value from v\$parameter a, v\$parameter b
- where a.name = 'db_cache_size' and b.name= 'db_block_size'",
- 'Number of cache buffers. Tune db_cache_size if the data cache hit ratio is too low.'),
- 'data cache blocksize' => array('DATAC',
- "select value from v\$parameter where name='db_block_size'",
- '' ),
-
- 'Memory Pools',
- 'SGA Max Size' => array( 'DATAC',
- "select value from v\$parameter where name = 'sga_max_size'",
- 'The sga_max_size is the maximum value to which sga_target can be set.' ),
- 'SGA target' => array( 'DATAC',
- "select value from v\$parameter where name = 'sga_target'",
- 'If sga_target is defined then data cache, shared, java and large pool size can be 0. This is because all these pools are consolidated into one sga_target.' ),
- 'data cache size' => array('DATAC',
- "select value from v\$parameter where name = 'db_cache_size'",
- 'db_cache_size' ),
- 'shared pool size' => array('DATAC',
- "select value from v\$parameter where name = 'shared_pool_size'",
- 'shared_pool_size, which holds shared sql, stored procedures, dict cache and similar shared structs' ),
- 'java pool size' => array('DATAJ',
- "select value from v\$parameter where name = 'java_pool_size'",
- 'java_pool_size' ),
- 'large pool buffer size' => array('CACHE',
- "select value from v\$parameter where name='large_pool_size'",
- 'this pool is for large mem allocations (not because it is larger than shared pool), for MTS sessions, parallel queries, io buffers (large_pool_size) ' ),
-
- 'pga buffer size' => array('CACHE',
- "select value from v\$parameter where name='pga_aggregate_target'",
- 'program global area is private memory for sorting, and hash and bitmap merges - since oracle 9i (pga_aggregate_target)' ),
-
-
- 'Connections',
- 'current connections' => array('SESS',
- 'select count(*) from sys.v_$session where username is not null',
- ''),
- 'max connections' => array( 'SESS',
- "select value from v\$parameter where name='sessions'",
- ''),
-
- 'Memory Utilization',
- 'data cache utilization ratio' => array('RATIOU',
- "select round((1-bytes/sgasize)*100, 2)
- from (select sum(bytes) sgasize from sys.v_\$sgastat) s, sys.v_\$sgastat f
- where name = 'free memory' and pool = 'shared pool'",
- 'Percentage of data cache actually in use - should be over 85%'),
-
- 'shared pool utilization ratio' => array('RATIOU',
- 'select round((sga.bytes/case when p.value=0 then sga.bytes else to_number(p.value) end)*100,2)
- from v$sgastat sga, v$parameter p
- where sga.name = \'free memory\' and sga.pool = \'shared pool\'
- and p.name = \'shared_pool_size\'',
- 'Percentage of shared pool actually used - too low is bad, too high is worse'),
-
- 'large pool utilization ratio' => array('RATIOU',
- "select round((1-bytes/sgasize)*100, 2)
- from (select sum(bytes) sgasize from sys.v_\$sgastat) s, sys.v_\$sgastat f
- where name = 'free memory' and pool = 'large pool'",
- 'Percentage of large_pool actually in use - too low is bad, too high is worse'),
- 'sort buffer size' => array('CACHE',
- "select value from v\$parameter where name='sort_area_size'",
- 'max in-mem sort_area_size (per query), uses memory in pga' ),
-
- 'pga usage at peak' => array('RATIOU',
- '=PGA','Mb utilization at peak transactions (requires Oracle 9i+)'),
- 'Transactions',
- 'rollback segments' => array('ROLLBACK',
- "select count(*) from sys.v_\$rollstat",
- ''),
-
- 'peak transactions' => array('ROLLBACK',
- "select max_utilization tx_hwm
- from sys.v_\$resource_limit
- where resource_name = 'transactions'",
- 'Taken from high-water-mark'),
- 'max transactions' => array('ROLLBACK',
- "select value from v\$parameter where name = 'transactions'",
- 'max transactions / rollback segments < 3.5 (or transactions_per_rollback_segment)'),
- 'Parameters',
- 'cursor sharing' => array('CURSOR',
- "select value from v\$parameter where name = 'cursor_sharing'",
- 'Cursor reuse strategy. Recommended is FORCE (8i+) or SIMILAR (9i+). See cursor_sharing.'),
- /*
- 'cursor reuse' => array('CURSOR',
- "select count(*) from (select sql_text_wo_constants, count(*)
- from t1
- group by sql_text_wo_constants
-having count(*) > 100)",'These are sql statements that should be using bind variables'),*/
- 'index cache cost' => array('COST',
- "select value from v\$parameter where name = 'optimizer_index_caching'",
- '=WarnIndexCost'),
- 'random page cost' => array('COST',
- "select value from v\$parameter where name = 'optimizer_index_cost_adj'",
- '=WarnPageCost'),
-
- 'Backup',
- 'Achivelog Mode' => array('BACKUP', 'select log_mode from v$database', 'To turn on archivelog:
-
- SQLPLUS> connect sys as sysdba;
- SQLPLUS> shutdown immediate;
-
- SQLPLUS> startup mount exclusive;
- SQLPLUS> alter database archivelog;
- SQLPLUS> archive log start;
- SQLPLUS> alter database open;
-
'),
-
- 'DBID' => array('BACKUP','select dbid from v$database','Primary key of database, used for recovery with an RMAN Recovery Catalog'),
- 'Archive Log Dest' => array('BACKUP', "SELECT NVL(v1.value,v2.value)
-FROM v\$parameter v1, v\$parameter v2 WHERE v1.name='log_archive_dest' AND v2.name='log_archive_dest_10'", ''),
-
- 'Flashback Area' => array('BACKUP', "select nvl(value,'Flashback Area not used') from v\$parameter where name=lower('DB_RECOVERY_FILE_DEST')", 'Flashback area is a folder where all backup data and logs can be stored and managed by Oracle. If Error: message displayed, then it is not in use.'),
- 'Control File Keep Time' => array('BACKUP', "select value from v\$parameter where name='control_file_record_keep_time'",'No of days to keep RMAN info in control file. I recommend it be set to x2 or x3 times the frequency of your full backup.'),
- false
-
- );
-
-
- function __construct(&$conn)
- {
- $savelog = $conn->LogSQL(false);
- $this->version = $conn->ServerInfo();
- $conn->LogSQL($savelog);
- $this->conn = $conn;
- }
-
- function WarnPageCost($val)
- {
- if ($val == 100) $s = 'Too High. ';
- else $s = '';
-
- return $s.'Recommended is 20-50 for TP, and 50 for data warehouses. Default is 100. See optimizer_index_cost_adj. ';
- }
-
- function WarnIndexCost($val)
- {
- if ($val == 0) $s = 'Too Low. ';
- else $s = '';
-
- return $s.'Percentage of indexed data blocks expected in the cache.
- Recommended is 20 (fast disk array) to 30 (slower hard disks). Default is 0.
- See optimizer_index_caching.';
- }
-
- function PGA()
- {
- if ($this->version['version'] < 9) return 'Oracle 9i or later required';
-
- $rs = $this->conn->Execute("select a.mb,a.targ as pga_size_pct,a.pct from
- (select round(pga_target_for_estimate/1024.0/1024.0,0) Mb,
- pga_target_factor targ,estd_pga_cache_hit_percentage pct,rownum as r
- from v\$pga_target_advice) a left join
- (select round(pga_target_for_estimate/1024.0/1024.0,0) Mb,
- pga_target_factor targ,estd_pga_cache_hit_percentage pct,rownum as r
- from v\$pga_target_advice) b on
- a.r = b.r+1 where
- b.pct < 100");
- if (!$rs) return "Only in 9i or later";
- $rs->Close();
- if ($rs->EOF) return "PGA could be too big";
-
- return reset($rs->fields);
- }
-
- function Explain($sql,$partial=false)
- {
- $savelog = $this->conn->LogSQL(false);
- $rs = $this->conn->SelectLimit("select ID FROM PLAN_TABLE");
- if (!$rs) {
- echo "Missing PLAN_TABLE
-
-CREATE TABLE PLAN_TABLE (
- STATEMENT_ID VARCHAR2(30),
- TIMESTAMP DATE,
- REMARKS VARCHAR2(80),
- OPERATION VARCHAR2(30),
- OPTIONS VARCHAR2(30),
- OBJECT_NODE VARCHAR2(128),
- OBJECT_OWNER VARCHAR2(30),
- OBJECT_NAME VARCHAR2(30),
- OBJECT_INSTANCE NUMBER(38),
- OBJECT_TYPE VARCHAR2(30),
- OPTIMIZER VARCHAR2(255),
- SEARCH_COLUMNS NUMBER,
- ID NUMBER(38),
- PARENT_ID NUMBER(38),
- POSITION NUMBER(38),
- COST NUMBER(38),
- CARDINALITY NUMBER(38),
- BYTES NUMBER(38),
- OTHER_TAG VARCHAR2(255),
- PARTITION_START VARCHAR2(255),
- PARTITION_STOP VARCHAR2(255),
- PARTITION_ID NUMBER(38),
- OTHER LONG,
- DISTRIBUTION VARCHAR2(30)
-);
-
";
- return false;
- }
-
- $rs->Close();
- // $this->conn->debug=1;
-
- if ($partial) {
- $sqlq = $this->conn->qstr($sql.'%');
- $arr = $this->conn->GetArray("select distinct sql1 from adodb_logsql where sql1 like $sqlq");
- if ($arr) {
- foreach($arr as $row) {
- $sql = reset($row);
- if (crc32($sql) == $partial) break;
- }
- }
- }
-
- $s = "Explain: ".htmlspecialchars($sql)."
";
-
- $this->conn->BeginTrans();
- $id = "ADODB ".microtime();
-
- $rs = $this->conn->Execute("EXPLAIN PLAN SET STATEMENT_ID='$id' FOR $sql");
- $m = $this->conn->ErrorMsg();
- if ($m) {
- $this->conn->RollbackTrans();
- $this->conn->LogSQL($savelog);
- $s .= "$m
";
- return $s;
- }
- $rs = $this->conn->Execute("
- select
- ''||lpad('--', (level-1)*2,'-') || trim(operation) || ' ' || trim(options)||'
' as Operation,
- object_name,COST,CARDINALITY,bytes
- FROM plan_table
-START WITH id = 0 and STATEMENT_ID='$id'
-CONNECT BY prior id=parent_id and statement_id='$id'");
-
- $s .= rs2html($rs,false,false,false,false);
- $this->conn->RollbackTrans();
- $this->conn->LogSQL($savelog);
- $s .= $this->Tracer($sql,$partial);
- return $s;
- }
-
-
- function CheckMemory()
- {
- if ($this->version['version'] < 9) return 'Oracle 9i or later required';
-
- $rs = $this->conn->Execute("
-select a.size_for_estimate as cache_mb_estimate,
- case when a.size_factor=1 then
- '<<= current'
- when a.estd_physical_read_factor-b.estd_physical_read_factor > 0 and a.estd_physical_read_factor<1 then
- '- BETTER - '
- else ' ' end as currsize,
- a.estd_physical_read_factor-b.estd_physical_read_factor as best_when_0
- from (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r from v\$db_cache_advice) a ,
- (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r from v\$db_cache_advice) b where a.r = b.r-1");
- if (!$rs) return false;
-
- /*
- The v$db_cache_advice utility show the marginal changes in physical data block reads for different sizes of db_cache_size
- */
- $s = "Data Cache Estimate
";
- if ($rs->EOF) {
- $s .= "Cache that is 50% of current size is still too big
";
- } else {
- $s .= "Ideal size of Data Cache is when \"best_when_0\" changes from a positive number and becomes zero.";
- $s .= rs2html($rs,false,false,false,false);
- }
- return $s;
- }
-
- /*
- Generate html for suspicious/expensive sql
- */
- function tohtml(&$rs,$type)
- {
- $o1 = $rs->FetchField(0);
- $o2 = $rs->FetchField(1);
- $o3 = $rs->FetchField(2);
- if ($rs->EOF) return 'None found
';
- $check = '';
- $sql = '';
- $s = "\n\n".$o1->name.' '.$o2->name.' '.$o3->name.' ';
- while (!$rs->EOF) {
- if ($check != $rs->fields[0].'::'.$rs->fields[1]) {
- if ($check) {
- $carr = explode('::',$check);
- $prefix = "';
- $suffix = '';
- if (strlen($prefix)>2000) {
- $prefix = '';
- $suffix = '';
- }
-
- $s .= "\n".$carr[0].' '.$carr[1].' '.$prefix.$sql.$suffix.' ';
- }
- $sql = $rs->fields[2];
- $check = $rs->fields[0].'::'.$rs->fields[1];
- } else
- $sql .= $rs->fields[2];
- if (substr($sql,strlen($sql)-1) == "\0") $sql = substr($sql,0,strlen($sql)-1);
- $rs->MoveNext();
- }
- $rs->Close();
-
- $carr = explode('::',$check);
- $prefix = "';
- $suffix = '';
- if (strlen($prefix)>2000) {
- $prefix = '';
- $suffix = '';
- }
- $s .= "\n".$carr[0].' '.$carr[1].' '.$prefix.$sql.$suffix.' ';
-
- return $s."
\n\n";
- }
-
- // code thanks to Ixora.
- // http://www.ixora.com.au/scripts/query_opt.htm
- // requires oracle 8.1.7 or later
- function SuspiciousSQL($numsql=10)
- {
- $sql = "
-select
- substr(to_char(s.pct, '99.00'), 2) || '%' load,
- s.executions executes,
- p.sql_text
-from
- (
- select
- address,
- buffer_gets,
- executions,
- pct,
- rank() over (order by buffer_gets desc) ranking
- from
- (
- select
- address,
- buffer_gets,
- executions,
- 100 * ratio_to_report(buffer_gets) over () pct
- from
- sys.v_\$sql
- where
- command_type != 47 and module != 'T.O.A.D.'
- )
- where
- buffer_gets > 50 * executions
- ) s,
- sys.v_\$sqltext p
-where
- s.ranking <= $numsql and
- p.address = s.address
-order by
- 1 desc, s.address, p.piece";
-
- global $ADODB_CACHE_MODE;
- if (isset($_GET['expsixora']) && isset($_GET['sql'])) {
- $partial = empty($_GET['part']);
- echo "".$this->Explain($_GET['sql'],$partial)."\n";
- }
-
- if (isset($_GET['sql'])) return $this->_SuspiciousSQL($numsql);
-
- $s = '';
- $timer = time();
- $s .= $this->_SuspiciousSQL($numsql);
- $timer = time() - $timer;
-
- if ($timer > $this->noShowIxora) return $s;
- $s .= '';
-
- $save = $ADODB_CACHE_MODE;
- $ADODB_CACHE_MODE = ADODB_FETCH_NUM;
- if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false);
-
- $savelog = $this->conn->LogSQL(false);
- $rs = $this->conn->SelectLimit($sql);
- $this->conn->LogSQL($savelog);
-
- if (isset($savem)) $this->conn->SetFetchMode($savem);
- $ADODB_CACHE_MODE = $save;
- if ($rs) {
- $s .= "\n
Ixora Suspicious SQL
";
- $s .= $this->tohtml($rs,'expsixora');
- }
-
- return $s;
- }
-
- // code thanks to Ixora.
- // http://www.ixora.com.au/scripts/query_opt.htm
- // requires oracle 8.1.7 or later
- function ExpensiveSQL($numsql = 10)
- {
- $sql = "
-select
- substr(to_char(s.pct, '99.00'), 2) || '%' load,
- s.executions executes,
- p.sql_text
-from
- (
- select
- address,
- disk_reads,
- executions,
- pct,
- rank() over (order by disk_reads desc) ranking
- from
- (
- select
- address,
- disk_reads,
- executions,
- 100 * ratio_to_report(disk_reads) over () pct
- from
- sys.v_\$sql
- where
- command_type != 47 and module != 'T.O.A.D.'
- )
- where
- disk_reads > 50 * executions
- ) s,
- sys.v_\$sqltext p
-where
- s.ranking <= $numsql and
- p.address = s.address
-order by
- 1 desc, s.address, p.piece
-";
- global $ADODB_CACHE_MODE;
- if (isset($_GET['expeixora']) && isset($_GET['sql'])) {
- $partial = empty($_GET['part']);
- echo "".$this->Explain($_GET['sql'],$partial)."\n";
- }
- if (isset($_GET['sql'])) {
- $var = $this->_ExpensiveSQL($numsql);
- return $var;
- }
-
- $s = '';
- $timer = time();
- $s .= $this->_ExpensiveSQL($numsql);
- $timer = time() - $timer;
- if ($timer > $this->noShowIxora) return $s;
-
- $s .= '';
- $save = $ADODB_CACHE_MODE;
- $ADODB_CACHE_MODE = ADODB_FETCH_NUM;
- if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false);
-
- $savelog = $this->conn->LogSQL(false);
- $rs = $this->conn->Execute($sql);
- $this->conn->LogSQL($savelog);
-
- if (isset($savem)) $this->conn->SetFetchMode($savem);
- $ADODB_CACHE_MODE = $save;
-
- if ($rs) {
- $s .= "\n
Ixora Expensive SQL
";
- $s .= $this->tohtml($rs,'expeixora');
- }
-
- return $s;
- }
-
- function clearsql()
- {
- $perf_table = adodb_perf::table();
- // using the naive "delete from $perf_table where created<".$this->conn->sysTimeStamp will cause the table to lock, possibly
- // for a long time
- $sql =
-"DECLARE cnt pls_integer;
-BEGIN
- cnt := 0;
- FOR rec IN (SELECT ROWID AS rr FROM $perf_table WHERE createdconn->Execute($sql);
- }
-
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/perf/perf-postgres.inc.php b/src/adodb5/perf/perf-postgres.inc.php
deleted file mode 100644
index 7d3ad83f..00000000
--- a/src/adodb5/perf/perf-postgres.inc.php
+++ /dev/null
@@ -1,153 +0,0 @@
- array('RATIO',
- "select case when count(*)=3 then 'TRUE' else 'FALSE' end from pg_settings where (name='stats_block_level' or name='stats_row_level' or name='stats_start_collector') and setting='on' ",
- 'Value must be TRUE to enable hit ratio statistics (stats_start_collector,stats_row_level and stats_block_level must be set to true in postgresql.conf)'),
- 'data cache hit ratio' => array('RATIO',
- "select case when blks_hit=0 then 0 else round( ((1-blks_read::float/blks_hit)*100)::numeric, 2) end from pg_stat_database where datname='\$DATABASE'",
- '=WarnCacheRatio'),
- 'IO',
- 'data reads' => array('IO',
- 'select sum(heap_blks_read+toast_blks_read) from pg_statio_user_tables',
- ),
- 'data writes' => array('IO',
- 'select round((sum(n_tup_ins/4.0+n_tup_upd/8.0+n_tup_del/4.0)/16)::numeric,2) from pg_stat_user_tables',
- 'Count of inserts/updates/deletes * coef'),
-
- 'Data Cache',
- 'data cache buffers' => array('DATAC',
- "select setting from pg_settings where name='shared_buffers'",
- 'Number of cache buffers. Tuning'),
- 'cache blocksize' => array('DATAC',
- 'select 8192',
- '(estimate)' ),
- 'data cache size' => array( 'DATAC',
- "select setting::integer*8192 from pg_settings where name='shared_buffers'",
- '' ),
- 'operating system cache size' => array( 'DATA',
- "select setting::integer*8192 from pg_settings where name='effective_cache_size'",
- '(effective cache size)' ),
- 'Memory Usage',
- # Postgres 7.5 changelog: Rename server parameters SortMem and VacuumMem to work_mem and maintenance_work_mem;
- 'sort/work buffer size' => array('CACHE',
- "select setting::integer*1024 from pg_settings where name='sort_mem' or name = 'work_mem' order by name",
- 'Size of sort buffer (per query)' ),
- 'Connections',
- 'current connections' => array('SESS',
- 'select count(*) from pg_stat_activity',
- ''),
- 'max connections' => array('SESS',
- "select setting from pg_settings where name='max_connections'",
- ''),
- 'Parameters',
- 'rollback buffers' => array('COST',
- "select setting from pg_settings where name='wal_buffers'",
- 'WAL buffers'),
- 'random page cost' => array('COST',
- "select setting from pg_settings where name='random_page_cost'",
- 'Cost of doing a seek (default=4). See random_page_cost'),
- false
- );
-
- function __construct(&$conn)
- {
- $this->conn = $conn;
- }
-
- var $optimizeTableLow = 'VACUUM %s';
- var $optimizeTableHigh = 'VACUUM ANALYZE %s';
-
-/**
- * @see adodb_perf#optimizeTable
- */
-
- function optimizeTable($table, $mode = ADODB_OPT_LOW)
- {
- if(! is_string($table)) return false;
-
- $conn = $this->conn;
- if (! $conn) return false;
-
- $sql = '';
- switch($mode) {
- case ADODB_OPT_LOW : $sql = $this->optimizeTableLow; break;
- case ADODB_OPT_HIGH: $sql = $this->optimizeTableHigh; break;
- default :
- {
- ADOConnection::outp(sprintf("%s: '%s' using of undefined mode '%s'
", __CLASS__, 'optimizeTable', $mode));
- return false;
- }
- }
- $sql = sprintf($sql, $table);
-
- return $conn->Execute($sql) !== false;
- }
-
- function Explain($sql,$partial=false)
- {
- $save = $this->conn->LogSQL(false);
-
- if ($partial) {
- $sqlq = $this->conn->qstr($sql.'%');
- $arr = $this->conn->GetArray("select distinct distinct sql1 from adodb_logsql where sql1 like $sqlq");
- if ($arr) {
- foreach($arr as $row) {
- $sql = reset($row);
- if (crc32($sql) == $partial) break;
- }
- }
- }
- $sql = str_replace('?',"''",$sql);
- $s = 'Explain: '.htmlspecialchars($sql).'
';
- $rs = $this->conn->Execute('EXPLAIN '.$sql);
- $this->conn->LogSQL($save);
- $s .= '';
- if ($rs)
- while (!$rs->EOF) {
- $s .= reset($rs->fields)."\n";
- $rs->MoveNext();
- }
- $s .= '
';
- $s .= $this->Tracer($sql,$partial);
- return $s;
- }
-}
-?>
\ No newline at end of file
diff --git a/src/adodb5/pivottable.inc.php b/src/adodb5/pivottable.inc.php
index 89789030..2967f333 100644
--- a/src/adodb5/pivottable.inc.php
+++ b/src/adodb5/pivottable.inc.php
@@ -123,7 +123,7 @@ function PivotTableSQL(&$db,$tables,$rowfields,$colfield, $where=false,
print "$sql";
$rs = $gDB->Execute($sql);
rs2html($rs);
-
+
/*
Generated SQL:
@@ -171,7 +171,7 @@ function PivotTableSQL(&$db,$tables,$rowfields,$colfield, $where=false,
rs2html($rs);
/*
Generated SQL:
-
+
SELECT CompanyName,QuantityPerUnit,
SUM(CASE WHEN UnitsInStock <= 0 THEN UnitsInStock ELSE 0 END) AS "Sum 0 ",
SUM(CASE WHEN 0 < UnitsInStock and UnitsInStock <= 5 THEN UnitsInStock ELSE 0 END) AS "Sum 1 to 5",
@@ -184,4 +184,4 @@ function PivotTableSQL(&$db,$tables,$rowfields,$colfield, $where=false,
GROUP BY CompanyName,QuantityPerUnit
*/
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/server.php b/src/adodb5/server.php
index 09383de9..8f6a5df3 100644
--- a/src/adodb5/server.php
+++ b/src/adodb5/server.php
@@ -73,7 +73,7 @@ function err($s)
if (isset($_REQUEST['nrows'])) {
$nrows = $_REQUEST['nrows'];
- $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : -1;
+ $offset = $_REQUEST['offset'] ?? -1;
$rs = $conn->SelectLimit($sql,$nrows,$offset);
} else
$rs = $conn->Execute($sql);
diff --git a/src/adodb5/session/adodb-compress-bzip2.php b/src/adodb5/session/adodb-compress-bzip2.php
index d786f1b1..47706995 100644
--- a/src/adodb5/session/adodb-compress-bzip2.php
+++ b/src/adodb5/session/adodb-compress-bzip2.php
@@ -39,8 +39,8 @@ function getBlockSize() {
/**
*/
function setBlockSize($block_size) {
- assert('$block_size >= 1');
- assert('$block_size <= 9');
+ assert($block_size >= 1);
+ assert($block_size <= 9);
$this->_block_size = (int) $block_size;
}
@@ -53,8 +53,8 @@ function getWorkLevel() {
/**
*/
function setWorkLevel($work_level) {
- assert('$work_level >= 0');
- assert('$work_level <= 250');
+ assert($work_level >= 0);
+ assert($work_level <= 250);
$this->_work_level = (int) $work_level;
}
@@ -67,7 +67,7 @@ function getMinLength() {
/**
*/
function setMinLength($min_length) {
- assert('$min_length >= 0');
+ assert($min_length >= 0);
$this->_min_length = (int) $min_length;
}
diff --git a/src/adodb5/session/adodb-compress-gzip.php b/src/adodb5/session/adodb-compress-gzip.php
index 300e6c9f..58b7d5cf 100644
--- a/src/adodb5/session/adodb-compress-gzip.php
+++ b/src/adodb5/session/adodb-compress-gzip.php
@@ -36,8 +36,8 @@ function getLevel() {
/**
*/
function setLevel($level) {
- assert('$level >= 0');
- assert('$level <= 9');
+ assert($level >= 0);
+ assert($level <= 9);
$this->_level = (int) $level;
}
@@ -50,7 +50,7 @@ function getMinLength() {
/**
*/
function setMinLength($min_length) {
- assert('$min_length >= 0');
+ assert($min_length >= 0);
$this->_min_length = (int) $min_length;
}
@@ -90,4 +90,4 @@ function read($data, $key) {
return 1;
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/session/adodb-cryptsession.php b/src/adodb5/session/adodb-cryptsession.php
index 13fe77bc..2dfa9ac8 100644
--- a/src/adodb5/session/adodb-cryptsession.php
+++ b/src/adodb5/session/adodb-cryptsession.php
@@ -17,11 +17,11 @@
*/
if (!defined('ADODB_SESSION')) {
- require_once dirname(__FILE__) . '/adodb-session.php';
+ require_once __DIR__ . '/adodb-session.php';
}
require_once ADODB_SESSION . '/adodb-encrypt-md5.php';
ADODB_Session::filter(new ADODB_Encrypt_MD5());
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/session/adodb-cryptsession2.php b/src/adodb5/session/adodb-cryptsession2.php
index d53f5a1a..9183e9e6 100644
--- a/src/adodb5/session/adodb-cryptsession2.php
+++ b/src/adodb5/session/adodb-cryptsession2.php
@@ -17,11 +17,11 @@
*/
if (!defined('ADODB_SESSION')) {
- require_once dirname(__FILE__) . '/adodb-session2.php';
+ require_once __DIR__ . '/adodb-session2.php';
}
require_once ADODB_SESSION . '/adodb-encrypt-md5.php';
ADODB_Session::filter(new ADODB_Encrypt_MD5());
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/session/adodb-encrypt-secret.php b/src/adodb5/session/adodb-encrypt-secret.php
index ed185a8b..e962e903 100644
--- a/src/adodb5/session/adodb-encrypt-secret.php
+++ b/src/adodb5/session/adodb-encrypt-secret.php
@@ -10,7 +10,7 @@
*/
-@define('HORDE_BASE', dirname(dirname(dirname(__FILE__))) . '/horde');
+@define('HORDE_BASE', dirname(__FILE__, 3) . '/horde');
if (!is_dir(HORDE_BASE)) {
trigger_error(sprintf('Directory not found: \'%s\'', HORDE_BASE), E_USER_ERROR);
diff --git a/src/adodb5/session/adodb-session-clob.php b/src/adodb5/session/adodb-session-clob.php
index 664a39af..71e61c0c 100644
--- a/src/adodb5/session/adodb-session-clob.php
+++ b/src/adodb5/session/adodb-session-clob.php
@@ -17,8 +17,8 @@
*/
if (!defined('ADODB_SESSION')) {
- require_once dirname(__FILE__) . '/adodb-session.php';
+ require_once __DIR__ . '/adodb-session.php';
}
ADODB_Session::clob('CLOB');
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/session/adodb-session-clob2.php b/src/adodb5/session/adodb-session-clob2.php
index 7e8eb6cb..c8e30492 100644
--- a/src/adodb5/session/adodb-session-clob2.php
+++ b/src/adodb5/session/adodb-session-clob2.php
@@ -17,8 +17,8 @@
*/
if (!defined('ADODB_SESSION')) {
- require_once dirname(__FILE__) . '/adodb-session2.php';
+ require_once __DIR__ . '/adodb-session2.php';
}
ADODB_Session::clob('CLOB');
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/session/adodb-session.php b/src/adodb5/session/adodb-session.php
index a787e988..e97707e7 100644
--- a/src/adodb5/session/adodb-session.php
+++ b/src/adodb5/session/adodb-session.php
@@ -26,12 +26,12 @@
*/
if (!defined('_ADODB_LAYER')) {
- require realpath(dirname(__FILE__) . '/../adodb.inc.php');
+ require realpath(__DIR__ . '/../adodb.inc.php');
}
if (defined('ADODB_SESSION')) return 1;
-define('ADODB_SESSION', dirname(__FILE__));
+define('ADODB_SESSION', __DIR__);
/*
@@ -47,7 +47,7 @@ function adodb_unserialize( $serialized_string )
{
$variables = array( );
$a = preg_split( "/(\w+)\|/", $serialized_string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
- for( $i = 0; $i < count( $a ); $i = $i+2 ) {
+ for( $i = 0; $i < (is_countable($a) ? count( $a ) : 0); $i = $i+2 ) {
$variables[$a[$i]] = unserialize( $a[$i+1] );
}
return( $variables );
@@ -59,6 +59,7 @@ function adodb_unserialize( $serialized_string )
*/
function adodb_session_regenerate_id()
{
+ $ck = [];
$conn = ADODB_Session::_conn();
if (!$conn) return false;
@@ -66,9 +67,9 @@ function adodb_session_regenerate_id()
if (function_exists('session_regenerate_id')) {
session_regenerate_id();
} else {
- session_id(md5(uniqid(rand(), true)));
+ session_id(md5(uniqid(random_int(0, mt_getrandmax()), true)));
$ck = session_get_cookie_params();
- setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']);
+ setcookie(session_name(), session_id(), ['expires' => false, 'path' => $ck['path'], 'domain' => $ck['domain'], 'secure' => $ck['secure']]);
//@session_start();
}
$new_id = session_id();
@@ -78,7 +79,7 @@ function adodb_session_regenerate_id()
if (!$ok) {
session_id($old_id);
if (empty($ck)) $ck = session_get_cookie_params();
- setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']);
+ setcookie(session_name(), session_id(), ['expires' => false, 'path' => $ck['path'], 'domain' => $ck['domain'], 'secure' => $ck['secure']]);
return false;
}
@@ -672,8 +673,8 @@ function write($key, $val)
$expirevar = '';
if ($expire_notify) {
$var = reset($expire_notify);
- if (isset($$var)) {
- $expirevar = $$var;
+ if (isset(${$var})) {
+ $expirevar = ${$var};
}
}
@@ -692,8 +693,8 @@ function write($key, $val)
$arr = array('sesskey' => $key, 'expiry' => $expiry, $data => $val, 'expireref' => '');
if ($expire_notify) {
$var = reset($expire_notify);
- if (isset($$var)) {
- $arr['expireref'] = $$var;
+ if (isset(${$var})) {
+ $arr['expireref'] = ${$var};
}
}
@@ -929,4 +930,4 @@ function adodb_sess_gc($t)
return ADODB_Session::gc($t);
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/session/adodb-session2.php b/src/adodb5/session/adodb-session2.php
index 37c1264f..b483d323 100644
--- a/src/adodb5/session/adodb-session2.php
+++ b/src/adodb5/session/adodb-session2.php
@@ -56,12 +56,12 @@
*/
if (!defined('_ADODB_LAYER')) {
- require realpath(dirname(__FILE__) . '/../adodb.inc.php');
+ require realpath(__DIR__ . '/../adodb.inc.php');
}
if (defined('ADODB_SESSION')) return 1;
-define('ADODB_SESSION', dirname(__FILE__));
+define('ADODB_SESSION', __DIR__);
define('ADODB_SESSION2', ADODB_SESSION);
/*
@@ -77,7 +77,7 @@ function adodb_unserialize( $serialized_string )
{
$variables = array( );
$a = preg_split( "/(\w+)\|/", $serialized_string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
- for( $i = 0; $i < count( $a ); $i = $i+2 ) {
+ for( $i = 0; $i < (is_countable($a) ? count( $a ) : 0); $i = $i+2 ) {
$variables[$a[$i]] = unserialize( $a[$i+1] );
}
return( $variables );
@@ -89,6 +89,7 @@ function adodb_unserialize( $serialized_string )
*/
function adodb_session_regenerate_id()
{
+ $ck = [];
$conn = ADODB_Session::_conn();
if (!$conn) return false;
@@ -96,9 +97,9 @@ function adodb_session_regenerate_id()
if (function_exists('session_regenerate_id')) {
session_regenerate_id();
} else {
- session_id(md5(uniqid(rand(), true)));
+ session_id(md5(uniqid(random_int(0, mt_getrandmax()), true)));
$ck = session_get_cookie_params();
- setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']);
+ setcookie(session_name(), session_id(), ['expires' => false, 'path' => $ck['path'], 'domain' => $ck['domain'], 'secure' => $ck['secure']]);
//@session_start();
}
$new_id = session_id();
@@ -108,7 +109,7 @@ function adodb_session_regenerate_id()
if (!$ok) {
session_id($old_id);
if (empty($ck)) $ck = session_get_cookie_params();
- setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']);
+ setcookie(session_name(), session_id(), ['expires' => false, 'path' => $ck['path'], 'domain' => $ck['domain'], 'secure' => $ck['secure']]);
return false;
}
@@ -444,7 +445,7 @@ static function encryptionKey($encryption_key = null) {
/*!
*/
static function _conn($conn=null) {
- return isset($GLOBALS['ADODB_SESS_CONN']) ? $GLOBALS['ADODB_SESS_CONN'] : false;
+ return $GLOBALS['ADODB_SESS_CONN'] ?? false;
}
/*!
@@ -657,6 +658,7 @@ static function read($key)
*/
static function write($key, $oval)
{
+ $qkey = null;
global $ADODB_SESSION_READONLY;
if (!empty($ADODB_SESSION_READONLY)) return;
@@ -693,8 +695,8 @@ static function write($key, $oval)
$expirevar = '';
if ($expire_notify) {
$var = reset($expire_notify);
- if (isset($$var)) {
- $expirevar = $$var;
+ if (isset(${$var})) {
+ $expirevar = ${$var};
}
}
@@ -713,8 +715,8 @@ static function write($key, $oval)
$expireref = '';
if ($expire_notify) {
$var = reset($expire_notify);
- if (isset($$var)) {
- $expireref = $$var;
+ if (isset(${$var})) {
+ $expireref = ${$var};
}
}
@@ -940,4 +942,4 @@ function adodb_sess_gc($t)
return ADODB_Session::gc($t);
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/session/adodb-sessions.oracle.clob.sql b/src/adodb5/session/adodb-sessions.oracle.clob.sql
deleted file mode 100644
index c5c4f2d0..00000000
--- a/src/adodb5/session/adodb-sessions.oracle.clob.sql
+++ /dev/null
@@ -1,15 +0,0 @@
--- $CVSHeader$
-
-DROP TABLE adodb_sessions;
-
-CREATE TABLE sessions (
- sesskey CHAR(32) DEFAULT '' NOT NULL,
- expiry INT DEFAULT 0 NOT NULL,
- expireref VARCHAR(64) DEFAULT '',
- data CLOB DEFAULT '',
- PRIMARY KEY (sesskey)
-);
-
-CREATE INDEX ix_expiry ON sessions (expiry);
-
-QUIT;
diff --git a/src/adodb5/session/adodb-sessions.oracle.sql b/src/adodb5/session/adodb-sessions.oracle.sql
deleted file mode 100644
index 8fd5a342..00000000
--- a/src/adodb5/session/adodb-sessions.oracle.sql
+++ /dev/null
@@ -1,16 +0,0 @@
--- $CVSHeader$
-
-DROP TABLE adodb_sessions;
-
-CREATE TABLE sessions (
- sesskey CHAR(32) DEFAULT '' NOT NULL,
- expiry INT DEFAULT 0 NOT NULL,
- expireref VARCHAR(64) DEFAULT '',
- data VARCHAR(4000) DEFAULT '',
- PRIMARY KEY (sesskey),
- INDEX expiry (expiry)
-);
-
-CREATE INDEX ix_expiry ON sessions (expiry);
-
-QUIT;
diff --git a/src/adodb5/session/crypt.inc.php b/src/adodb5/session/crypt.inc.php
index 41cb06a5..3769459a 100644
--- a/src/adodb5/session/crypt.inc.php
+++ b/src/adodb5/session/crypt.inc.php
@@ -16,8 +16,8 @@ function keyED($txt,$encrypt_key)
function Encrypt($txt,$key)
{
- srand((double)microtime()*1000000);
- $encrypt_key = md5(rand(0,32000));
+ mt_srand((double)microtime()*1_000_000);
+ $encrypt_key = md5(random_int(0,32000));
$ctr=0;
$tmp = "";
for ($i=0;$i= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
{
- $randnumber = rand(48,120);
+ $randnumber = random_int(48,120);
}
$randomPassword .= chr($randnumber);
@@ -86,8 +86,8 @@ function keyED($txt,$encrypt_key)
function Encrypt($txt,$key)
{
- srand((double)microtime()*1000000);
- $encrypt_key = sha1(rand(0,32000));
+ mt_srand((double)microtime()*1_000_000);
+ $encrypt_key = sha1(random_int(0,32000));
$ctr=0;
$tmp = "";
@@ -136,16 +136,16 @@ function Decrypt($txt,$key)
function RandPass()
{
$randomPassword = "";
- srand((double)microtime()*1000000);
+ mt_srand((double)microtime()*1_000_000);
for($i=0;$i<8;$i++)
{
- $randnumber = rand(48,120);
+ $randnumber = random_int(48,120);
while (($randnumber >= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
{
- $randnumber = rand(48,120);
+ $randnumber = random_int(48,120);
}
$randomPassword .= chr($randnumber);
@@ -158,4 +158,4 @@ function RandPass()
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/session/old/adodb-cryptsession.php b/src/adodb5/session/old/adodb-cryptsession.php
index 600d184e..fdc53bff 100644
--- a/src/adodb5/session/old/adodb-cryptsession.php
+++ b/src/adodb5/session/old/adodb-cryptsession.php
@@ -6,18 +6,18 @@
the BSD license will take precedence.
Made table name configurable - by David Johnson djohnson@inpro.net
Encryption by Ari Kuorikoski
-
+
Set tabs to 4 for best viewing.
-
+
Latest version of ADODB is available at http://php.weblogs.com/adodb
======================================================================
-
+
This file provides PHP4 session management using the ADODB database
wrapper library.
-
+
Example
=======
-
+
include('adodb.inc.php');
#---------------------------------#
include('adodb-cryptsession.php');
@@ -28,12 +28,12 @@
print "
-- \$_SESSION['AVAR']={$_SESSION['AVAR']}";
-
+
Installation
============
1. Create a new database in MySQL or Access "sessions" like
so:
-
+
create table sessions (
SESSKEY char(32) not null,
EXPIRY int(11) unsigned not null,
@@ -41,17 +41,17 @@
DATA CLOB,
primary key (sesskey)
);
-
+
2. Then define the following parameters. You can either modify
this file, or define them before this file is included:
-
+
$ADODB_SESSION_DRIVER='database driver, eg. mysql or ibase';
$ADODB_SESSION_CONNECT='server to connect to';
$ADODB_SESSION_USER ='user';
$ADODB_SESSION_PWD ='password';
$ADODB_SESSION_DB ='database';
$ADODB_SESSION_TBL = 'sessions'
-
+
3. Recommended is PHP 4.0.2 or later. There are documented
session bugs in earlier versions of PHP.
@@ -61,7 +61,7 @@
include_once('crypt.inc.php');
if (!defined('_ADODB_LAYER')) {
- include (dirname(__FILE__).'/adodb.inc.php');
+ include (__DIR__.'/adodb.inc.php');
}
/* if database time and system time is difference is greater than this, then give warning */
@@ -70,7 +70,7 @@
if (!defined('ADODB_SESSION')) {
define('ADODB_SESSION',1);
-
+
GLOBAL $ADODB_SESSION_CONNECT,
$ADODB_SESSION_DRIVER,
$ADODB_SESSION_USER,
@@ -84,7 +84,7 @@
$ADODB_SESSION_TBL;
//$ADODB_SESS_DEBUG = true;
-
+
/* SET THE FOLLOWING PARAMETERS */
if (empty($ADODB_SESSION_DRIVER)) {
$ADODB_SESSION_DRIVER='mysql';
@@ -127,11 +127,11 @@ function adodb_sess_open($save_path, $session_name)
$ADODB_SESSION_DB,
$ADODB_SESS_CONN,
$ADODB_SESS_DEBUG;
-
+
$ADODB_SESS_INSERT = false;
-
+
if (isset($ADODB_SESS_CONN)) return true;
-
+
$ADODB_SESS_CONN = ADONewConnection($ADODB_SESSION_DRIVER);
if (!empty($ADODB_SESS_DEBUG)) {
$ADODB_SESS_CONN->debug = true;
@@ -139,7 +139,7 @@ function adodb_sess_open($save_path, $session_name)
}
return $ADODB_SESS_CONN->PConnect($ADODB_SESSION_CONNECT,
$ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);
-
+
}
function adodb_sess_close()
@@ -167,7 +167,7 @@ function adodb_sess_read($key)
return $v;
}
else $ADODB_SESS_INSERT = true;
-
+
return '';
}
@@ -180,11 +180,11 @@ function adodb_sess_write($key, $val)
// encrypt session data..
$val = $Crypt->Encrypt(rawurlencode($val), ADODB_Session_Key());
-
+
$arr = array('sesskey' => $key, 'expiry' => $expiry, 'data' => $val);
if ($ADODB_SESSION_EXPIRE_NOTIFY) {
$var = reset($ADODB_SESSION_EXPIRE_NOTIFY);
- $arr['expireref'] = $$var;
+ $arr['expireref'] = ${$var};
}
$rs = $ADODB_SESS_CONN->Replace($ADODB_SESSION_TBL,
$arr,
@@ -196,7 +196,7 @@ function adodb_sess_write($key, $val)
} else {
// bug in access driver (could be odbc?) means that info is not commited
// properly unless select statement executed in Win2000
-
+
if ($ADODB_SESS_CONN->databaseType == 'access') $rs = $ADODB_SESS_CONN->Execute("select sesskey from $ADODB_SESSION_TBL WHERE sesskey='$key'");
}
return isset($rs);
@@ -205,7 +205,7 @@ function adodb_sess_write($key, $val)
function adodb_sess_destroy($key)
{
global $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;
-
+
if ($ADODB_SESSION_EXPIRE_NOTIFY) {
reset($ADODB_SESSION_EXPIRE_NOTIFY);
$fn = next($ADODB_SESSION_EXPIRE_NOTIFY);
@@ -251,7 +251,7 @@ function adodb_sess_gc($maxlifetime) {
$rs->MoveNext();
}
$rs->Close();
-
+
$ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE expiry < $t");
$ADODB_SESS_CONN->CommitTrans();
}
@@ -259,12 +259,12 @@ function adodb_sess_gc($maxlifetime) {
$qry = "DELETE FROM $ADODB_SESSION_TBL WHERE expiry < " . time();
$ADODB_SESS_CONN->Execute($qry);
}
-
+
// suggested by Cameron, "GaM3R"
if (defined('ADODB_SESSION_OPTIMIZE'))
{
global $ADODB_SESSION_DRIVER;
-
+
switch( $ADODB_SESSION_DRIVER ) {
case 'mysql':
case 'mysqlt':
@@ -276,13 +276,13 @@ function adodb_sess_gc($maxlifetime) {
break;
}
}
-
+
if ($ADODB_SESS_CONN->dataProvider === 'oci8') $sql = 'select TO_CHAR('.($ADODB_SESS_CONN->sysTimeStamp).', \'RRRR-MM-DD HH24:MI:SS\') from '. $ADODB_SESSION_TBL;
else $sql = 'select '.$ADODB_SESS_CONN->sysTimeStamp.' from '. $ADODB_SESSION_TBL;
-
+
$rs = $ADODB_SESS_CONN->SelectLimit($sql,1);
if ($rs && !$rs->EOF) {
-
+
$dbts = reset($rs->fields);
$rs->Close();
$dbt = $ADODB_SESS_CONN->UnixTimeStamp($dbts);
@@ -295,7 +295,7 @@ function adodb_sess_gc($maxlifetime) {
-- $msg");
}
}
-
+
return true;
}
diff --git a/src/adodb5/session/old/adodb-session-clob.php b/src/adodb5/session/old/adodb-session-clob.php
index c31d0dc0..2cd1d35f 100644
--- a/src/adodb5/session/old/adodb-session-clob.php
+++ b/src/adodb5/session/old/adodb-session-clob.php
@@ -87,7 +87,7 @@ function NotifyFn($expireref, $sesskey)
*/
if (!defined('_ADODB_LAYER')) {
- include (dirname(__FILE__).'/adodb.inc.php');
+ include (__DIR__.'/adodb.inc.php');
}
if (!defined('ADODB_SESSION')) {
@@ -219,15 +219,15 @@ function adodb_sess_read($key)
$v = '';
} else
$v = rawurldecode(reset($rs->fields));
-
+
$rs->Close();
-
+
// new optimization adodb 2.1
$ADODB_SESSION_CRC = strlen($v).crc32($v);
-
+
return $v;
}
-
+
return ''; // thx to Jorma Tuomainen, webmaster#wizactive.com
}
@@ -238,6 +238,7 @@ function adodb_sess_read($key)
\****************************************************************************************/
function adodb_sess_write($key, $val)
{
+ $err = null;
global
$ADODB_SESS_CONN,
$ADODB_SESS_LIFE,
@@ -264,7 +265,7 @@ function adodb_sess_write($key, $val)
$arr = array('sesskey' => $key, 'expiry' => $expiry, 'data' => $val);
if ($ADODB_SESSION_EXPIRE_NOTIFY) {
$var = reset($ADODB_SESSION_EXPIRE_NOTIFY);
- $arr['expireref'] = $$var;
+ $arr['expireref'] = ${$var};
}
@@ -353,6 +354,8 @@ function adodb_sess_destroy($key)
function adodb_sess_gc($maxlifetime)
{
+ $qry = null;
+ $opt_qry = null;
global $ADODB_SESS_DEBUG, $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;
if ($ADODB_SESSION_EXPIRE_NOTIFY) {
diff --git a/src/adodb5/session/old/adodb-session.php b/src/adodb5/session/old/adodb-session.php
index 45327003..8385d2f1 100644
--- a/src/adodb5/session/old/adodb-session.php
+++ b/src/adodb5/session/old/adodb-session.php
@@ -97,7 +97,7 @@ function NotifyFn($expireref, $sesskey)
*/
if (!defined('_ADODB_LAYER')) {
- include (dirname(__FILE__).'/adodb.inc.php');
+ include (__DIR__.'/adodb.inc.php');
}
if (!defined('ADODB_SESSION')) {
@@ -112,6 +112,7 @@ function NotifyFn($expireref, $sesskey)
*/
function adodb_session_regenerate_id()
{
+ $ck = [];
$conn = ADODB_Session::_conn();
if (!$conn) return false;
@@ -119,9 +120,9 @@ function adodb_session_regenerate_id()
if (function_exists('session_regenerate_id')) {
session_regenerate_id();
} else {
- session_id(md5(uniqid(rand(), true)));
+ session_id(md5(uniqid(random_int(0, mt_getrandmax()), true)));
$ck = session_get_cookie_params();
- setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']);
+ setcookie(session_name(), session_id(), ['expires' => false, 'path' => $ck['path'], 'domain' => $ck['domain'], 'secure' => $ck['secure']]);
//@session_start();
}
$new_id = session_id();
@@ -131,7 +132,7 @@ function adodb_session_regenerate_id()
if (!$ok) {
session_id($old_id);
if (empty($ck)) $ck = session_get_cookie_params();
- setcookie(session_name(), session_id(), false, $ck['path'], $ck['domain'], $ck['secure']);
+ setcookie(session_name(), session_id(), ['expires' => false, 'path' => $ck['path'], 'domain' => $ck['domain'], 'secure' => $ck['secure']]);
return false;
}
@@ -252,15 +253,15 @@ function adodb_sess_read($key)
$v = '';
} else
$v = rawurldecode(reset($rs->fields));
-
+
$rs->Close();
-
+
// new optimization adodb 2.1
$ADODB_SESSION_CRC = strlen($v).crc32($v);
-
+
return $v;
}
-
+
return ''; // thx to Jorma Tuomainen, webmaster#wizactive.com
}
@@ -295,7 +296,7 @@ function adodb_sess_write($key, $val)
$arr = array('sesskey' => $key, 'expiry' => $expiry, 'data' => $val);
if ($ADODB_SESSION_EXPIRE_NOTIFY) {
$var = reset($ADODB_SESSION_EXPIRE_NOTIFY);
- $arr['expireref'] = $$var;
+ $arr['expireref'] = ${$var};
}
$rs = $ADODB_SESS_CONN->Replace($ADODB_SESSION_TBL,$arr,
'sesskey',$autoQuote = true);
@@ -342,6 +343,7 @@ function adodb_sess_destroy($key)
function adodb_sess_gc($maxlifetime)
{
+ $opt_qry = null;
global $ADODB_SESS_DEBUG, $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;
if ($ADODB_SESSION_EXPIRE_NOTIFY) {
@@ -434,4 +436,4 @@ function adodb_sess_gc($maxlifetime)
-- \$_SESSION['AVAR']={$_SESSION['AVAR']}",false);
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/session/old/crypt.inc.php b/src/adodb5/session/old/crypt.inc.php
index b99bbba5..c4da9b06 100644
--- a/src/adodb5/session/old/crypt.inc.php
+++ b/src/adodb5/session/old/crypt.inc.php
@@ -16,8 +16,8 @@ function keyED($txt,$encrypt_key)
function Encrypt($txt,$key)
{
- srand((double)microtime()*1000000);
- $encrypt_key = md5(rand(0,32000));
+ mt_srand((double)microtime()*1_000_000);
+ $encrypt_key = md5(random_int(0,32000));
$ctr=0;
$tmp = "";
for ($i=0;$i= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
{
- $randnumber = rand(48,120);
+ $randnumber = random_int(48,120);
}
$randomPassword .= chr($randnumber);
@@ -61,4 +61,4 @@ function RandPass()
}
}
-?>
\ No newline at end of file
+?>
diff --git a/src/adodb5/toexport.inc.php b/src/adodb5/toexport.inc.php
index a9017dd4..ff4c6bd6 100644
--- a/src/adodb5/toexport.inc.php
+++ b/src/adodb5/toexport.inc.php
@@ -62,6 +62,7 @@ function rs2tabout(&$rs,$addtitles=true)
function _adodb_export(&$rs,$sep,$sepreplace,$fp=false,$addtitles=true,$quote = '"',$escquote = '"',$replaceNewLine = ' ')
{
+ $elements = [];
if (!$rs) return '';
//----------
// CONSTANTS
@@ -100,7 +101,7 @@ function _adodb_export(&$rs,$sep,$sepreplace,$fp=false,$addtitles=true,$quote =
if ($escquote) $v = str_replace($quote,$escquotequote,$v);
$v = strip_tags(str_replace("\n", $replaceNewLine, str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v))));
- if (strpos($v,$sep) !== false || strpos($v,$quote) !== false) $elements[] = "$quote$v$quote";
+ if (strpos($v,(string) $sep) !== false || strpos($v,(string) $quote) !== false) $elements[] = "$quote$v$quote";
else $elements[] = $v;
}
} else { // ASSOCIATIVE ARRAY
@@ -108,7 +109,7 @@ function _adodb_export(&$rs,$sep,$sepreplace,$fp=false,$addtitles=true,$quote =
if ($escquote) $v = str_replace($quote,$escquotequote,trim($v));
$v = strip_tags(str_replace("\n", $replaceNewLine, str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v))));
- if (strpos($v,$sep) !== false || strpos($v,$quote) !== false) $elements[] = "$quote$v$quote";
+ if (strpos($v,(string) $sep) !== false || strpos($v,(string) $quote) !== false) $elements[] = "$quote$v$quote";
else $elements[] = $v;
}
}
diff --git a/src/googleTranslate-1.7/LICENSE b/src/googleTranslate-1.7/LICENSE
deleted file mode 100644
index d511905c..00000000
--- a/src/googleTranslate-1.7/LICENSE
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 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.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, 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 or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-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 give any other recipients of the Program a copy of this License
-along with the Program.
-
-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 Program or any portion
-of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-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 Program, 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 Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) 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; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, 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 executable. However, as a
-special exception, the source code 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.
-
-If distribution of executable or 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 counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program 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.
-
- 5. 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 Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program 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 to
-this License.
-
- 7. 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 Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program 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 Program.
-
-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.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program 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.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the 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 Program
-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 Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, 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
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- , 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/src/googleTranslate-1.7/docs/GoogleTranslateWrapper/GoogleTranslateWrapper.html b/src/googleTranslate-1.7/docs/GoogleTranslateWrapper/GoogleTranslateWrapper.html
deleted file mode 100644
index 08d89675..00000000
--- a/src/googleTranslate-1.7/docs/GoogleTranslateWrapper/GoogleTranslateWrapper.html
+++ /dev/null
@@ -1,751 +0,0 @@
-
-
-
-
- Docs For Class GoogleTranslateWrapper
-
-
-
-
-
-
-
-
-
- Class GoogleTranslateWrapper
-
(line 39)
-
-
-
-
-Description
-
-
-
- Located in File: /googleTranslate.class.php
-
-
-GoogleTranslateWrapper Main Class
-
- - author: - Sameer Borate
- - version: - 1.7
- - copyright: - 2010 Sameer Borate
- - link: - http://www.codediesel.com
-
-
-
-
-
-
-Class Variables
-
-Summary:
-
- string
- $_apiKey
-
-
- array
- $_chunks
-
-
- string
- $_currentChunk
-
-
- string
- $_detectedSourceLanguage
-
-
- string
- $_fromLang
-
-
- string
- $_googleDetectUrl
-
-
- string
- $_googleTranslateUrl
-
-
- string
- $_ip
-
-
- string
- $_postFields
-
-
- string
- $_serviceError
-
-
- string
- $_siteUrl
-
-
- integer
- $_stringLimit
-
-
- boolean
- $_success
-
-
- string
- $_text
-
-
- string
- $_toLang
-
-
- integer
- $_totalChunks
-
-
- string
- $_translatedText
-
-
- string
- $_version
-
-
-
-
-
-
-
-
-
- $_currentChunk = 0 (line 136)
-
-Data type : string
-
-Current data chunk
-
- - access: - private
-
-
-
-
-
- $_detectedSourceLanguage = "" (line 148)
-
-Data type : string
-
-Detected source language
-
- - access: - private
-
-
-
-
-
- $_fromLang = '' (line 57)
-
-Data type : string
-
-Language to translate from
-
- - access: - private
-
-
-
-
-
- $_googleDetectUrl = 'http://ajax.googleapis.com/ajax/services/language/detect' (line 51)
-
-Data type : string
-
-URL of Google language detection
-
- - access: - private
-
-
-
-
-
- $_googleTranslateUrl = 'http://ajax.googleapis.com/ajax/services/language/translate' (line 45)
-
-Data type : string
-
-URL of Google translate
-
- - access: - private
-
-
-
-
-
-
-
-
-
-
-
- $_siteUrl = '' (line 81)
-
-Data type : string
-
-Site url using the code
-
- - access: - private
-
-
-
-
-
- $_stringLimit = 5000 (line 124)
-
-Data type : integer
-
-Translation character limit.
-Currently the limit set by Google is 5000
-
- - access: - private
-
-
-
-
-
- $_success = false (line 117)
-
-Data type : boolean
-
-Translation success
-
- - access: - private
-
-
-
-
-
-
-
- $_toLang = '' (line 63)
-
-Data type : string
-
-Language to translate to
-
- - access: - private
-
-
-
-
-
-
-
-
-
-
-
-
-Class Constants
-
-Summary:
-
- DETECT
-
-
- TRANSLATE
-
-
-
-
-
- DETECT = 1 (line 150)
-
-
-
-
-
-
-
-
- TRANSLATE = 2 (line 151)
-
-
-
-
-
-
-
-
-Method Detail
-
-Summary:
-
-
-
- String
- getDetectedSource
- ()
-
-
- String
- getLastError
- ()
-
-
- boolean
- isSuccess
- ()
-
-
- boolean
- selfTest
- ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method detectLanguage (line 383)
-
-boolean detectLanguage(
-string
-$text)
-
-
-Detect the language of the given text
- Parameters
-
- - string $text: text language to detect
-
-
- Info
-
- - return - | string
- - access - public
-
-
-
-
- Method getDetectedSource (line 276)
-
-String getDetectedSource(
-)
-
-
-Get the detected source language, if the source is not provided during query
-
- Info
-
- - access - public
-
-
-
-
- Method getLastError (line 264)
-
-String getLastError(
-)
-
-
-Get the last generated service error
-
- Info
-
- - access - public
-
-
-
-
- Method isSuccess (line 254)
-
-boolean isSuccess(
-)
-
-
-Check if the last translation was a success
-
- Info
-
- - access - public
-
-
-
-
- Method selfTest (line 236)
-
-boolean selfTest(
-)
-
-
-Self test the class
-
- Info
-
- - access - public
-
-
-
-
- Method setCredentials (line 287)
-
-void setCredentials(
-string
-$apiKey,
-$ip)
-
-
-Set credentials (optional) when accessing Google translation services
- Parameters
-
- - string $apiKey: your google api key
- - $ip:
-
-
- Info
-
- - access - public
-
-
-
-
- Method setReferrer (line 299)
-
-void setReferrer(
-string
-$siteUrl)
-
-
-Set Referrer header
- Parameters
-
- - string $siteUrl: your website url
-
-
- Info
-
- - access - public
-
-
-
-
- Method translate (line 312)
-
-boolean translate(
-[string
-$text = ''], string
-$to, [string
-$from = ''])
-
-
-Translate the given text
- Parameters
-
- - string $text: text to translate
- - string $to: language to translate to
- - string $from: optional language to translate from
-
-
- Info
-
- - return - | string
- - access - public
-
-
-
-
- Method _composeUrl (line 158)
-
-void _composeUrl(
-
-$type)
-
-
-Build a POST url to query Google
- Parameters
-
- - $type:
-
-
- Info
-
- - access - private
-
-
-
-
- Method _remoteQuery (line 185)
-
-string _remoteQuery(
-string
-$query)
-
-
-Process the built query using cURL and POST
- Parameters
-
- - string $query: POST fields
-
-
- Info
-
- - return - response
- - access - private
-
-
-
-
- Method _remoteQueryDetect (line 213)
-
-string _remoteQueryDetect(
-string
-$query)
-
-
-Process the built query using cURL and GET
- Parameters
-
- - string $query: GET fields
-
-
- Info
-
- - return - response
- - access - private
-
-
-
-
-
-
-
-
-
- Documentation generated on Wed, 23 Jun 2010 12:15:23 +0000 by phpDocumentor 1.4.1
-
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/GoogleTranslateWrapper/_example.php.html b/src/googleTranslate-1.7/docs/GoogleTranslateWrapper/_example.php.html
deleted file mode 100644
index 9d5eb5cb..00000000
--- a/src/googleTranslate-1.7/docs/GoogleTranslateWrapper/_example.php.html
+++ /dev/null
@@ -1,171 +0,0 @@
-
-
-
-
- Docs for page example.php
-
-
-
-
-
-
-
-File: /example.php
-
-
-
-
-Description
-
-
- - filesource: - Source Code for this file
-
-
-
-Classes defined in this file
-
-
-
- CLASS NAME
DESCRIPTION
-
-
-
-
-
-
-
-
-
-
-Global Variables
-
-
-
-
-
-
-
-
-Functions
-
-
-
-
-
-
-
-
- Documentation generated on Mon, 22 Mar 2010 12:42:32 +0000 by phpDocumentor 1.4.1
-
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/GoogleTranslateWrapper/_googleTranslate.class.php.html b/src/googleTranslate-1.7/docs/GoogleTranslateWrapper/_googleTranslate.class.php.html
deleted file mode 100644
index 1344a3fc..00000000
--- a/src/googleTranslate-1.7/docs/GoogleTranslateWrapper/_googleTranslate.class.php.html
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
- Docs for page googleTranslate.class.php
-
-
-
-
-
-
-
-File: /googleTranslate.class.php
-
-
-
-
-Description
-
-GoogleTranslateWrapper: PHP wrapper for Google Translation services Copyright (C) 2010 Sameer Borate
-GoogleTranslateWrapper is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
GoogleTranslateWrapper is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GoogleTranslateWrapper; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- - author: - Sameer Borate
- - copyright: - 2010 Sameer Borate
- - filesource: - Source Code for this file
-
-
-
-Classes defined in this file
-
-
-
- CLASS NAME
DESCRIPTION
-
-
-
- GoogleTranslateWrapper
- GoogleTranslateWrapper Main Class
-
-
-
-
-
-
-
-
-Include/Require Statements
-
-
-
-
-
-
-
-Global Variables
-
-
-
-
-
-
-
-
-Functions
-
-
-
-
-
-
-
-
- Documentation generated on Wed, 23 Jun 2010 12:15:22 +0000 by phpDocumentor 1.4.1
-
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/__filesource/fsource_GoogleTranslateWrapper__example.php.html b/src/googleTranslate-1.7/docs/__filesource/fsource_GoogleTranslateWrapper__example.php.html
deleted file mode 100644
index 308fcd4c..00000000
--- a/src/googleTranslate-1.7/docs/__filesource/fsource_GoogleTranslateWrapper__example.php.html
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
- File Source for example.php
-
-
-Source for file example.php
-Documentation is available at example.php
-
-
-
-
-
-- $gt = new GoogleTranslateWrapper();
-
-
-
-
-
-
-
-
-
-
-- print_r($gt->detectLanguage($text));
-
-
-
-
-
-
-
- Documentation generated on Mon, 22 Mar 2010 12:42:32 +0000 by phpDocumentor 1.4.1
-
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/__filesource/fsource_GoogleTranslateWrapper__googleTranslate.class.php.html b/src/googleTranslate-1.7/docs/__filesource/fsource_GoogleTranslateWrapper__googleTranslate.class.php.html
deleted file mode 100644
index 39e0d22c..00000000
--- a/src/googleTranslate-1.7/docs/__filesource/fsource_GoogleTranslateWrapper__googleTranslate.class.php.html
+++ /dev/null
@@ -1,444 +0,0 @@
-
-
-
-
- File Source for googleTranslate.class.php
-
-
-Source for file googleTranslate.class.php
-Documentation is available at googleTranslate.class.php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-- class GoogleTranslateWrapper
-
-
-
-
-
-- private $_googleTranslateUrl = 'http://ajax.googleapis.com/ajax/services/language/translate';
-
-
-
-
-
-- private $_googleDetectUrl = 'http://ajax.googleapis.com/ajax/services/language/detect';
-
-
-
-
-
-- private $_fromLang = '';
-
-
-
-
-
-- private $_toLang = '';
-
-
-
-
-
-- private $_version = '1.0';
-
-
-
-
-
-- private $_text = '';
-
-
-
-
-
-- private $_siteUrl = '';
-
-
-
-
-
-- private $_apiKey = '';
-
-
-
-
-
-- private $_ip = '';
-
-
-
-
-
-- private $_postFields;
-
-
-
-
-
-- private $_translatedText;
-
-
-
-
-
-- private $_serviceError = "";
-
-
-
-
-
-- private $_success = false;
-
-
-
-
-
-
-- private $_stringLimit = 5000;
-
-
-
-
-
-- private $_chunks = 0;
-
-
-
-
-
-- private $_currentChunk = 0;
-
-
-
-
-
-- private $_totalChunks = 0;
-
-
-
-
-
-- private $_detectedSourceLanguage = "";
-
-
-
-
-
-
-
-
-
-- private function _composeUrl($type)
-
-
-
-- $fields = array('v' => $this->_version,
-- 'q' => $this->_text,
-
-
-
-
-- $fields = array('v' => $this->_version,
-- 'q' => $this->_text);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-- private function _remoteQuery($query)
-
-- if(!function_exists('curl_init'))
-
-
-
-
-
-- $ch = curl_init();
-
-
-- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-- curl_setopt($ch, CURLOPT_TIMEOUT, 15);
-- curl_setopt($ch, CURLOPT_POST, 1);
-- curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
-
-- $response = curl_exec($ch);
-
-
-
-
-
-
-
-
-
-
-
-- private function _remoteQueryDetect($query)
-
-- if(!function_exists('curl_init'))
-
-
-
-
-- $ch = curl_init();
-- $url = $this->_googleDetectUrl . "?" . $query;
-- curl_setopt($ch, CURLOPT_URL, $url);
-- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-
-
-- $response = curl_exec($ch);
-
-
-
-
-
-
-
-
-
-- public function selfTest()
-
-- if(!function_exists('curl_init'))
-
-
-
-
-
-- $testText = $this->translate("hello", "fr", "en");
-
-
-
-
-
-
-
-
-
-- public function isSuccess()
-
-- return $this->_success;
-
-
-
-
-
-
-
-- public function getLastError()
-
-- return $this->_serviceError;
-
-
-
-
-
-
-
-
-
-- public function getDetectedSource()
-
-- return $this->_detectedSourceLanguage;
-
-
-
-
-
-
-
-
-- public function setCredentials($apiKey, $ip)
-
-- $this->_apiKey = $apiKey;
-- $this->_ip = $ip;
-
-
-
-
-
-
-
-
-- public function setReferrer($siteUrl)
-
-- $this->_siteUrl = $siteUrl;
-
-
-
-
-
-
-
-
-
-
-- public function translate($text = '', $to, $from = '')
-
-- $this->_success = false;
-
-
-
-
-
-
-
-- if($this->_chunks == 0)
-
-
-
-- $this->_currentChunk = 0;
-
-
-- $this->_toLang = $to;
-- $this->_fromLang = $from;
-
-
-
-- $this->_text = $text;
-- $this->_toLang = $to;
-- $this->_fromLang = $from;
-
-
-
-- $this->_composeUrl(self::TRANSLATE);
-
-
-
-
-- $json = json_decode($contents, true);
-
-
-
-- $this->_translatedText .= $json['responseData']['translatedText'];
-
-
-- $this->_detectedSourceLanguage = $json['responseData']['detectedSourceLanguage'];
-
-
-- $this->_currentChunk++;
-
-
-- $this->_success = true;
-- return $this->_translatedText;
-
-
-
-
-
-
-
-
-- $this->_serviceError = $json['responseDetails'];
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-- public function detectLanguage($text)
-
-
-
-
-
-
-
-
-- $this->_text = $text;
-
-
-
-- $this->_composeUrl(self::DETECT);
-
-
-
-
-
-- $json = json_decode($contents, true);
-
-
-
-
-
-
-
-- $this->_serviceError = $json['responseDetails'];
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Documentation generated on Wed, 23 Jun 2010 12:15:23 +0000 by phpDocumentor 1.4.1
-
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/blank.html b/src/googleTranslate-1.7/docs/blank.html
deleted file mode 100644
index ba4c3e72..00000000
--- a/src/googleTranslate-1.7/docs/blank.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
- GoogleTranslateWrapper v1.7
-
-
-
-
-GoogleTranslateWrapper v1.7
-Welcome to GoogleTranslateWrapper!
-
-This documentation was generated by phpDocumentor v1.4.1
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/classtrees_GoogleTranslateWrapper.html b/src/googleTranslate-1.7/docs/classtrees_GoogleTranslateWrapper.html
deleted file mode 100644
index 09514770..00000000
--- a/src/googleTranslate-1.7/docs/classtrees_GoogleTranslateWrapper.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-Root class GoogleTranslateWrapper
-
-
-
-
- Documentation generated on Wed, 23 Jun 2010 12:15:22 +0000 by phpDocumentor 1.4.1
-
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/elementindex.html b/src/googleTranslate-1.7/docs/elementindex.html
deleted file mode 100644
index e73e45fd..00000000
--- a/src/googleTranslate-1.7/docs/elementindex.html
+++ /dev/null
@@ -1,214 +0,0 @@
-
-
-
-
-
-
-
-
-Index of All Elements
-
-Indexes by package:
-
-
- d
- g
- i
- s
- t
- _
-
-
-
-
-
- d
-
- top
-
-
-
-
- DETECT
- in file googleTranslate.class.php, class constant GoogleTranslateWrapper::DETECT
-
-
- detectLanguage
- in file googleTranslate.class.php, method GoogleTranslateWrapper::detectLanguage()
Detect the language of the given text
-
-
-
-
- g
-
- top
-
-
-
-
- getDetectedSource
- in file googleTranslate.class.php, method GoogleTranslateWrapper::getDetectedSource()
Get the detected source language, if the source is not provided during query
-
-
- getLastError
- in file googleTranslate.class.php, method GoogleTranslateWrapper::getLastError()
Get the last generated service error
-
-
- googleTranslate.class.php
- procedural page googleTranslate.class.php
-
-
- GoogleTranslateWrapper
- in file googleTranslate.class.php, class GoogleTranslateWrapper
GoogleTranslateWrapper Main Class
-
-
-
-
- i
-
- top
-
-
-
-
- isSuccess
- in file googleTranslate.class.php, method GoogleTranslateWrapper::isSuccess()
Check if the last translation was a success
-
-
-
-
- s
-
- top
-
-
-
-
- selfTest
- in file googleTranslate.class.php, method GoogleTranslateWrapper::selfTest()
Self test the class
-
-
- setCredentials
- in file googleTranslate.class.php, method GoogleTranslateWrapper::setCredentials()
Set credentials (optional) when accessing Google translation services
-
-
- setReferrer
- in file googleTranslate.class.php, method GoogleTranslateWrapper::setReferrer()
Set Referrer header
-
-
-
-
- t
-
- top
-
-
-
-
- translate
- in file googleTranslate.class.php, method GoogleTranslateWrapper::translate()
Translate the given text
-
-
- TRANSLATE
- in file googleTranslate.class.php, class constant GoogleTranslateWrapper::TRANSLATE
-
-
-
-
- _
-
- top
-
-
-
-
- $_apiKey
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_apiKey
Google API key
-
-
- $_chunks
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_chunks
Chunk array
-
-
- $_currentChunk
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_currentChunk
Current data chunk
-
-
- $_detectedSourceLanguage
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_detectedSourceLanguage
Detected source language
-
-
- $_fromLang
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_fromLang
Language to translate from
-
-
- $_googleDetectUrl
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_googleDetectUrl
URL of Google language detection
-
-
- $_googleTranslateUrl
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_googleTranslateUrl
URL of Google translate
-
-
- $_ip
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_ip
Host IP address
-
-
- $_postFields
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_postFields
POST fields
-
-
- $_serviceError
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_serviceError
Service Error
-
-
- $_siteUrl
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_siteUrl
Site url using the code
-
-
- $_stringLimit
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_stringLimit
Translation character limit.
-
-
- $_success
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_success
Translation success
-
-
- $_text
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_text
Text to translate
-
-
- $_toLang
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_toLang
Language to translate to
-
-
- $_totalChunks
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_totalChunks
Total chunks
-
-
- $_translatedText
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_translatedText
Translated Text
-
-
- $_version
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_version
API version
-
-
- _composeUrl
- in file googleTranslate.class.php, method GoogleTranslateWrapper::_composeUrl()
Build a POST url to query Google
-
-
- _remoteQuery
- in file googleTranslate.class.php, method GoogleTranslateWrapper::_remoteQuery()
Process the built query using cURL and POST
-
-
- _remoteQueryDetect
- in file googleTranslate.class.php, method GoogleTranslateWrapper::_remoteQueryDetect()
Process the built query using cURL and GET
-
-
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/elementindex_GoogleTranslateWrapper.html b/src/googleTranslate-1.7/docs/elementindex_GoogleTranslateWrapper.html
deleted file mode 100644
index 067e5421..00000000
--- a/src/googleTranslate-1.7/docs/elementindex_GoogleTranslateWrapper.html
+++ /dev/null
@@ -1,212 +0,0 @@
-
-
-
-
-
-
-
-
-Element Index, Package GoogleTranslateWrapper
-
-
-Index of all elements
-
- d
- g
- i
- s
- t
- _
-
-
-
-
-
- _
-
- top
-
-
-
-
- $_apiKey
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_apiKey
Google API key
-
-
- $_chunks
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_chunks
Chunk array
-
-
- $_currentChunk
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_currentChunk
Current data chunk
-
-
- $_detectedSourceLanguage
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_detectedSourceLanguage
Detected source language
-
-
- $_fromLang
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_fromLang
Language to translate from
-
-
- $_googleDetectUrl
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_googleDetectUrl
URL of Google language detection
-
-
- $_googleTranslateUrl
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_googleTranslateUrl
URL of Google translate
-
-
- $_ip
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_ip
Host IP address
-
-
- $_postFields
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_postFields
POST fields
-
-
- $_serviceError
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_serviceError
Service Error
-
-
- $_siteUrl
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_siteUrl
Site url using the code
-
-
- $_stringLimit
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_stringLimit
Translation character limit.
-
-
- $_success
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_success
Translation success
-
-
- $_text
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_text
Text to translate
-
-
- $_toLang
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_toLang
Language to translate to
-
-
- $_totalChunks
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_totalChunks
Total chunks
-
-
- $_translatedText
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_translatedText
Translated Text
-
-
- $_version
- in file googleTranslate.class.php, variable GoogleTranslateWrapper::$_version
API version
-
-
- _composeUrl
- in file googleTranslate.class.php, method GoogleTranslateWrapper::_composeUrl()
Build a POST url to query Google
-
-
- _remoteQuery
- in file googleTranslate.class.php, method GoogleTranslateWrapper::_remoteQuery()
Process the built query using cURL and POST
-
-
- _remoteQueryDetect
- in file googleTranslate.class.php, method GoogleTranslateWrapper::_remoteQueryDetect()
Process the built query using cURL and GET
-
-
-
-
- d
-
- top
-
-
-
-
- DETECT
- in file googleTranslate.class.php, class constant GoogleTranslateWrapper::DETECT
-
-
- detectLanguage
- in file googleTranslate.class.php, method GoogleTranslateWrapper::detectLanguage()
Detect the language of the given text
-
-
-
-
- g
-
- top
-
-
-
-
- getDetectedSource
- in file googleTranslate.class.php, method GoogleTranslateWrapper::getDetectedSource()
Get the detected source language, if the source is not provided during query
-
-
- getLastError
- in file googleTranslate.class.php, method GoogleTranslateWrapper::getLastError()
Get the last generated service error
-
-
- googleTranslate.class.php
- procedural page googleTranslate.class.php
-
-
- GoogleTranslateWrapper
- in file googleTranslate.class.php, class GoogleTranslateWrapper
GoogleTranslateWrapper Main Class
-
-
-
-
- i
-
- top
-
-
-
-
- isSuccess
- in file googleTranslate.class.php, method GoogleTranslateWrapper::isSuccess()
Check if the last translation was a success
-
-
-
-
- s
-
- top
-
-
-
-
- selfTest
- in file googleTranslate.class.php, method GoogleTranslateWrapper::selfTest()
Self test the class
-
-
- setCredentials
- in file googleTranslate.class.php, method GoogleTranslateWrapper::setCredentials()
Set credentials (optional) when accessing Google translation services
-
-
- setReferrer
- in file googleTranslate.class.php, method GoogleTranslateWrapper::setReferrer()
Set Referrer header
-
-
-
-
- t
-
- top
-
-
-
-
- translate
- in file googleTranslate.class.php, method GoogleTranslateWrapper::translate()
Translate the given text
-
-
- TRANSLATE
- in file googleTranslate.class.php, class constant GoogleTranslateWrapper::TRANSLATE
-
-
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/errors.html b/src/googleTranslate-1.7/docs/errors.html
deleted file mode 100644
index b17b8bb7..00000000
--- a/src/googleTranslate-1.7/docs/errors.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
- phpDocumentor Parser Errors and Warnings
-
-
-Post-parsing
-
-googleTranslate.class.php
-Warnings:
-Warning on line 36 - package GoogleTranslateWrapper v1.7 is already in category , will now replace with category GoogleTranslateWrapper
-
-
- Documentation generated on Wed, 23 Jun 2010 12:15:24 +0000 by phpDocumentor 1.4.1
-
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/index.html b/src/googleTranslate-1.7/docs/index.html
deleted file mode 100644
index 500c9ade..00000000
--- a/src/googleTranslate-1.7/docs/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
- GoogleTranslateWrapper v1.7
-
-
-
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/li_GoogleTranslateWrapper.html b/src/googleTranslate-1.7/docs/li_GoogleTranslateWrapper.html
deleted file mode 100644
index b067ed1c..00000000
--- a/src/googleTranslate-1.7/docs/li_GoogleTranslateWrapper.html
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-Navigation: GoogleTranslateWrapper
-
-
-
-
-phpDocumentor v 1.4.1
-
-HTML layout inspired by PHPEdit
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/media/images/Class.gif b/src/googleTranslate-1.7/docs/media/images/Class.gif
deleted file mode 100644
index ada36bbb19ec43993b6ec39a4accc163f6465c8f..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1078
zcmeHGOKTKC5H1%Fji)v-GD_5Rj9CX1Ga%?{e641qF`8rr5fzCJ2r`O~_Mr4dwD8&B
zCXNzhBAX>EUKT|3pcqKdtfCMXkvYi{;$xE2C0zn`VXbJR$^bi1rp-G5QRFS}#Qa&ZVVfY5~l`5ALWfhf`3MdW2Fo-l%pi~&}FsKy5FbbnUr!a~_
zrJ=Vz+WHn%Lg^JLEjp%rU-@NK4pdN9L7*j6s2QR{n(0%@QA)p}Vyg|ci5An;|MBl1
zSW%gP$}9l+4V#udJ3Cc9u;%3I?#@#X8)&(`v8MgUl~QfPiTT@3ZNBg--qPFrYx?ok
zO#hk%O?BC(y6f4F+x5F1eQ51kwDP1;`><~FXs)H_(DUvF^L_P(s%GN?9Va8L2i|zp
zno9R9YIr%1of&PXkTaVwd!2TnHWCZm3x8h-9I~XBgsAS)Uk=z
z?8U&vnk9XcFw*s@*tq>*@xgTIi>zL9`EDuOvvjm^N7LHleMi2&%FNrccO2?J&$`u?
zX*@q&RqTlGT9+!(DmzxQ^WMhk#6)l_yL;=MZ07rLTkqBz-{_n{a$sk)y`-K_cE%f54(QF5X}D=j7k8>J`GiHq+Tf6oLIfEE9s`Rc}aex>)cQ
zNrxJ>au-5iQi0V?1Vuz!=+YRw30~;t#k6q>f>R5Bp6B>04AlT%}mbCQpt23Qwmecgj-3wPTFE8nXxC2wf{9fSDE>uR7m(v?VtSEhS?Waf1H
q>S!u9z9~J_IKNi6dpm#dVs)%|vfRD=p}k@K$J|X4tM}KS{eJ*ogzM=5
diff --git a/src/googleTranslate-1.7/docs/media/images/Constants.gif b/src/googleTranslate-1.7/docs/media/images/Constants.gif
deleted file mode 100644
index eba8d08fed5a8942dcd32a61086e4bf10f4ee3c3..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1068
zcmeH`&1(}u7{;d+b<=7aE0nFY*wi*OL7`%-Mg?Pp#1tbnUdmolQ>c2FB;KEWQnek1R;h+%rQc3!YBdIqG5z(X^3%iEDlUJDmt@uPIZUtO6dx9
z#Dr}mn4JJfD48;il$}onVM;VoQl=1h)3M#u$XZ60*Rr9=he2M*yuwN&s0dM!!rwp`$%bu}}==tCUju(O_T@TS;
z=DtULkNcwLOV3x!KFYwSL0|?U1j-8oD->=h-A1F<5Fi?^5K$?iYC;79LxDmdO2MQ6
zDP$8Rq>>UHiIFOasG@-Ml#(g}YYKgZp~9$-k`6X+giY7nDffPL
zjwB&HQN9I{Quzc26xGyEPX}$EWqh
zja%n?Nq;%Z#fI6=?YWD?&s(5(s6F|)erD+Ejm;hD$0ND^6Aybx^2fwrp|!2OJ3Tx-
zPHqnLY)ba6(aH4?Z|efRzyA8(%2@i*mbK3>+O*ELH&c6x#cFA9dUnf)#Oi%*-M5vs
z#RZLs_viy^?H?wO)L6C~Z#{tK~z^i;17Bvzxc=sb>>fTA7m0x&Tg46M(o%ge2HM4LTjL?F*>|?*x0a-y_C~In2R6N
zCOTBwSROpM)qS7Rp5O2JI6d$TpC1~)
z*I8h}gTG*a0lx$efCoST0)Pl00Vn_}fF8^l1sEgPViksUSdOrq!g40Vxg4)@e2wRA
z4p|7*5OR@V2ttV$OeC0Cum!=!f-7JHVH0CZz!t_8gdHqauxR@fB~6l6WXTjIOO|X&
zazuIErz}@w*_Mbwh>;~lLQI*MgwzPJrEF2jIwYs%a(XsrW)(|OHJ_?#sOpNQmUOkE
zYKE$nlyzD%1DX~!E3{Ihj!kPewH?oMXwC5rbsXxtE_FRWIlj8ob7>G>0P6V@-%?70
zZczK;$AA3m7dRe#K=2E|{DQ63gD1c18_ApR^{%IR{avcD0n*D!J>7r%%`JY$iZns%
zm)X=ewynD#Vrw0-Og*}I_~WYurZ5<47%ktAjP&qllG(=8zL=lyK-Vmd-@dmx32iT{
zyBjy=KIg~Evp?E_lf1n_~!Of>dK)zm&Z3Bgqpjr
zu1&<7=AsWr?;ha`iRqb^&VkIt-iy|y)KLEQZoNJ|6*|y=?#W(#`z;DzoXreQrCXX4
z$<^LMXC!)zNq=3w6x({#etK*tJyMN4?`v8N;py=3{L#U)KX-cb%tAb3>Yut;IQ0id
Cb;vsa
diff --git a/src/googleTranslate-1.7/docs/media/images/Destructor.gif b/src/googleTranslate-1.7/docs/media/images/Destructor.gif
deleted file mode 100644
index bf3d62b37aa22bdc5cbef5a34af62a0e9ebecc8a..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1043
zcmeHG!Alfj6o0zzI;PZQR%3^7Ov6#Z{j@`0MQjsRP99=}kWZs@O^byNO$T8vrsHb0
zkj7{kUW~Te1_=vYMwDQTR;Icvo(9Zx@HB^r@%Hsie@67<_ulWvd++q%ceU%vSvvm(d;FFm)rR
zS2OI??GUJ!V+=uy{Wp8CE|{eU%(sZRr+h7~ZdF;hxuIAWH$u>RxU
z_&{rzfG`Wd?Za22NlT2^a
z!l9FKj<4$$p4@e2&Qy#&{xa9MYPN1S?yk4it&i?4M-LoriCWWpgS(Y$#>ktE%?}OA
zrS$OX*w&Aos`*oG?fbohlg|om!|x5eJ$e0ktU0kdTAF=2*U{5I+*P0LoQR&d`SxD*
zvR?z6W)+vk^H`UX$p*CQcO0j!xs_=J&PIk_gv)XL_sT{;Q_4Zlf0sz*Mw8ZZ<9b
xF3g`UzxZt?0aFL7FARN-_snb@Yl*y|@rOIH%ErXF{pj2fH=Dl|dtJf7`9Hr4%liNT
diff --git a/src/googleTranslate-1.7/docs/media/images/Disk.gif b/src/googleTranslate-1.7/docs/media/images/Disk.gif
deleted file mode 100644
index 7ab08fd085b5f14fb5e098c4938b0898f23f61fd..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 941
zcmZ?wbhEHb6ky)z#H4Akfp&
zGNq@dXUdc*b3kD0(xpq+u3fuz>(;${_Z~ZT>>LQ(yLRo`y?ghbKY#xI{rm6VzyBWv
zqaiTJLO_QB2tav(fnySbCx^(##>4FbvQ{+`iUA260@6}C7ZjR~92S%{D@j=KkeP#z
zU%QLJP^pETQ^YA^!-7U;juv^Vf)xyj2Uyqz3{qAIFgCaGiK@7HFg!Ta%&Mf}@}NP{
ziG_nz${}IFg9b(pF-wOG2S(>+24+41hYbwO9F58@4895r4@7WDI~n9y2)MM(lXW?>
O)Z0AQbsr-mgEauW@A@SG
diff --git a/src/googleTranslate-1.7/docs/media/images/FolderClosed.gif b/src/googleTranslate-1.7/docs/media/images/FolderClosed.gif
deleted file mode 100644
index 68c6563cf367cbf4e1c789e264b6e4fac1304488..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 963
zcmZ?wbhEHb6kyi%~o!!#X($mv3Cz)YRHp9|vj-|yMYl{WeRts#cme|@N
zvA0EWZ;#@!9?fG@G|x>jJU7Si+_`htmRerBcJ1C;r+fGAJ>Tl}es9qC@8AC)Oa6Z@
z`Tw=-|Ie%cKX3W}zUBY-p8wyc{Qp1a|0oy@fx#C7It)Mn$_oq}D;V5+Iv5@@vT#eX
zXvIh*E@bB96z9s(P-@{2RF*J^*x=B})S|4=!r(Y*$q^Q2ot7^T9yT&h*ON9$Sg>Gm
zE4!?WN6d@FBaMvw77jZ+wya2na0L@bEAri-*L-gG{Z*
NCnyIyNC+@k0|2eA4(I>?
diff --git a/src/googleTranslate-1.7/docs/media/images/FolderOpened.gif b/src/googleTranslate-1.7/docs/media/images/FolderOpened.gif
deleted file mode 100644
index 8b012d553cb34beaf5c60529ef44c1e829f33be5..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 957
zcmZ?wbhEHb6kyOp`TxD=|Mw~Xzt8#qf6D*=KyvB-|KI31`iUO_=QbY
zg=9K7GVyULaJ0<$z}&^iB$VS(kl1o`zN8Be$AkxtOu|Z&w0x}^85tLG%T4*g@Q68d
zwY-)J!vy2TRv}rN7TMbm4+5<<>br1YTkdUUe_0m=hwbZPcg4si1Slvp+~428YU9$V
T*u=!%F05R(K-|@Vfx#L8{1XpQ
diff --git a/src/googleTranslate-1.7/docs/media/images/Functions.gif b/src/googleTranslate-1.7/docs/media/images/Functions.gif
deleted file mode 100644
index bc2def806f4c68db186f2739e6aa1b6d0cd5c670..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1064
zcmeH`&r20i6vyvq*^A6ZF|w?1&?ke&5%{YF00sal03ZMq00!bgA_4T06FLGq1x5}S2pA+`7EM#snZh)EXa
zxste&x{A1p7XnuF?4sbFV4lQYSP&i;!Vx|bk_%}ICH$!1D=vK^eI{j521Ev2szMO@
zLBzta7)D+gMWGU*lA%&j=*AS4q#`9EteK;k#3*JgS*@(TmgRr^1V=z3#M<-Th(byL-gbmqixYj6I*q2?>2XWrFr
z>8k^eE4%Kmo&Pd>>Vdpu()Ij@fr|NsC*_aw^_@50Z@z%ZN&aw1ADTTmRWo-O?@C(B
zKl{L7SL@cBr?)GotJ^1^8$H1u(0}#!tF6^VF;QFHUHfvV?~^uovF6v_d5x7<9PhZi
zeHX5OYngi6dFS4(&tqi=+XgoEAE3Em{K(SE>$z^NtfKwG_k6jwm>l1zOlZTqwVLGF
zkrT!)@S-)pGkSOoj6ciK{6%`g178e&67#J8C85tTH8XFrM
z92^`S9UUGX9v>ecARr(iAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7
zEiEoCE-x=HFfcGNF)=bSGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}?
zK0iM{KtMo2K|w-7LPJACL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuy
zP*6}&QBhJ-Qd3h?R8&+|RaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?Wj
zVPRroVq;@tWMpJzWo2e&W@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2T
za&vQYbaZreb#-=jc6WDoczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyD
zgoK2Jg@uNOhKGlTh=_=ZiHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z}
zm6ev3mY0{8n3$NEnVFiJnwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5(
zrl+T;sHmu^si~@}s;jH3tgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#p
zxVX5vxw*Q!y1To(yu7@dCU$jHda
z$;ryf%FD~k%*@Qq&CSlv&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4
z?Ck9A?d|UF?(gsK@bK{Q@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg=
z{r_{{R2~EC2ui01yBW000R70RP?7r|+LWc<{tb;V{91K7RNN3Vf$e9`EoE>kF!KtPG!KYZ@y%I
diff --git a/src/googleTranslate-1.7/docs/media/images/I.png b/src/googleTranslate-1.7/docs/media/images/I.png
deleted file mode 100644
index e8512fb911f40ec90e7cbf057ace91404573df37..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 148
zcmeAS@N?(olHy`uVBq!ia0vp^!ayv*$P6UUaa~gcQtTz3zOL*Scz79AwQm3V5DFCH
zEbxddW?AMyVi9{#UaQ0r%7Fss&l*vy)E6e!K$>FVdQ&MBb@0CA5htN;K2
diff --git a/src/googleTranslate-1.7/docs/media/images/L.png b/src/googleTranslate-1.7/docs/media/images/L.png
deleted file mode 100644
index eb334edaeac52e2f473ffd92a49b025fb6148ec3..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 153
zcmeAS@N?(olHy`uVBq!ia0vp^!ayv*$P6UUaa~gcQtTz3zOL*Scz79Am98pQqyvRG
z3p^r=85p=efH0%e8j~47LAC&&5ZCE_)&Kwh7Y~}?0Tf{>3Gxg6&+v4+fftY`;pyTS
tQgJK!NBsYWhyUvpj=8p5Ib^(%U@*zon(m*SoDEdN;OXk;vd$@?2>{+EE2IDb
diff --git a/src/googleTranslate-1.7/docs/media/images/Lminus.png b/src/googleTranslate-1.7/docs/media/images/Lminus.png
deleted file mode 100644
index f7c43c0aa3bebb499e86eb744b1e47b9a9445ba7..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 219
zcmeAS@N?(olHy`uVBq!ia0vp^!ayv*!VDzYUPT51DfSXiUsv`EJiLsmQh${X`~(Vd
z7I;J!Gca&{0AWU_H6}BFf(8LTA+A9B|NsBf`>KHqVn8Lk#c`lIrjj7P;QtIyw;Ol?
zc?O;?jv*Ddk_A|pTm=*lC~zFVdQ&MBb@0OtiQr2qf`
diff --git a/src/googleTranslate-1.7/docs/media/images/Lplus.png b/src/googleTranslate-1.7/docs/media/images/Lplus.png
deleted file mode 100644
index 848ec2fc3bbaab6345864c303684ff8a86559cfb..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 224
zcmeAS@N?(olHy`uVBq!ia0vp^!ayv*!VDzYUPT51DfSXiUsv`EJiLtR`ZJfMMF533
z3p^r=85p=efH0%e8j~47L4yFF5LY1m|NsB#ebqn)F`$y&;y6$pQ%R6t@PCG<+YP*c
zJX22>$B>F!$pS1)t^$e&6gZd#)XV}^6#`leL>0XheB5$;*x1}$U0qr4a0#d>%dQ)bU--(louE{)-Wi#NJuy?IM~F*>BPaHz;Li#
zfR9T;U?D?8BR`wk8HtBU$GSy%EgU>HEM#C{l9Nc-uz;bdS6o?4WI@6~CN?e(34w}_
z&zP7Q3Vy{bU^v(?&rJ8;kEhXuauP}Q<5C1*OO9eDy1qZtv6)`OvyP#kyS;N6;)9*
zMOjo;SyokD)f80=R8w=ZuIaj-%~^(F*apd&rfrg(Wx1AZS;Vx7?GVQ$j_3PckcsON
z&m+EHEc(RriC^@+z!gJ~Vo(N_5aN?iLl?$>{1X>A6MjJW3xIyZw>F-O6v%~u{
zPxE8rDh%wcjK8p+bT+lF)7_h0V@Kot+ppR;<2ArZue;|PVjpWy-`qL5g%Z`Xr>;M%
z%6ut#bcE|0*mzetF;&MLIJ`o&rytM7Z)GBMGy&rWD=+4+txll1=ANBAC+wF`SJcLC
zP^-xg)m(ITZH7sAOqND!61$1ULVa^jp>An;d2*s8R;TSIo_EZ*41F5mmW0mo(n}BY
r?a{B1h4aI1=7-R>HWs^T{Tw;ek2caHdsUgyhaKw+lS59S0zvB^kI%vL
diff --git a/src/googleTranslate-1.7/docs/media/images/PrivateProperty.gif b/src/googleTranslate-1.7/docs/media/images/PrivateProperty.gif
deleted file mode 100644
index a21fffa0921356f4b6b181dc38b2645536875f24..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1063
zcmeHGK}%F&6#blXe5H*~t$3yrjuJTL!hxY?7#BK~)~uW%5@wTwEd)2id<45SN4Xv`Tjr;4OG?JPB>J8UqYp$!figPd`$bME8Z&v}4z$pzy=<6=AcuzyJ-<0R!*>0U!*-fCP{P1RwzucnQn_
z3&0|f2iAa1pa9r_azdS;|M)jA&|3U};x91mH=Em9&YX))w#E;P!^ZDx)6KmHdu?qE
zEE>7}?5(F-W*<}-?z_#$YVz)>y4qm+S?6x4D|j_mAD_9u
zDv!9jW_rH4Ix7P=$FFC5KIOb6rPW5m&ZV)5rqsmir5sy+66qaHr#HGDKlk2Bm^uCP
zTW=!|Ev07X%g&r_x)FNR*U>i}u1bgEU#7Z8-F4ONA9hzg-jMIY`>Kigk%#)xSM9&z
iL*u8;*9V96=)K{@{)#%W?$6YXzi=Pl8~9kGv&bLMr$VDYh3DeNphg_^cHY9bye(Y0CRB&I^t|)a|
z`Y{B`Vn0l<2csS)C>+>D88^a#qy~CuS!-cJf)RYU_0s9i{uMp+Iq<#bd(OEp2Ts??
z&Zg!8j4=PYsdk)Z$8osBxdWUBIS+9j;XKAUr0B{TPqoM~8
z1c(4c0b&3Oz&wBsU;vl^7C;8T25`h5G5Vi>Z36-K0^D0b(jWBs$z=Ull&0W@uXziWy#z4)r$p;1TiX#`+m+qh5-|cHW_;TX)>d=;Pudm_+
z{D+5@6N*6+j|b3eRt-{VDgl&r0)$|8%?&AdWxqO%ImU&+dSvfQh0a~J@k1!
zGX9oYtSmsD()81gBJA&=C6gPTWP8hv+S0eFnelkd(d%=+vWL6(W+aO?4_3kTK;(DZWr
vak6Q|@J`q4Zk2GKmqo|=!%O{bxy4}?U)hlxx%hR!UtIJ&_uf-mg;zmv0wNl=p8XU2@@06K`F@_m
zz<2*Z|5s$#1QQgzl>vGN3%~|&09*hMfC9t@Fn~nc)Dgn~Lqi6bfoVpjnc1c=HDtw>
zB`ix?wgGl*+oiVaq^_gS%5|jUNY`xe
zcm?rF>Q&Se9_5ryQJN8&Q7Q-()NciT7Wjo91V)es!QC*(?4S(8Bn;CqY=vPKL@`7>
zj*=+Kqc|okHd$;j28`K^1&rH_GnR7JVyw_3aPD!f1bE`|l<_o4n3Hfw6JsiMr&7N)
z1+5m#FwZf|u`DnvB`LA0R9LA>2wO-luo5VwAW|h#NvV`nC^3{+O01-QLZzxi2~P=M
z2^}$%43%<~ij+cyk-|b@rBG;2UnoQr4oa%GpdzS3R3)kkl|Z$+Of!fC(MJpsBg7an
zMa&Tk#1gU6Jidi>?!Dgm1G`rnu-XMMR-kXuZv6G_?B20%`*VI~k^q5rP+JluX{uzvHqh4u4mzicREudFRPXn7_7WU(jipaI8j}s|_2T
zoVDwx=W4gRe{FtaKDXL-4h(MU_;l~%`i1=L$47s7bN~0{ynn1?>%rM=;q`+vjj`8n
zW>2?GjJI#-{`og}(ceYV8?^^^gRg5_XAa%#4fzh5mRousc)yIV`Q#&hZ>hO(eIVI*
zk<@4Q^R~Vp&t3Xsxv#dAY}opIQ|~F*{MkF-RxBsoa)sTDr&-6E@J8=;nn`duu3=;qCCj#oX6{SjSt_;EOJ&citzcp94OL*Z7H
zsf^g)P?*A)qA=A%WqyVERi=6PnWnL}HV-9kvAE@B!-^}G#Vkv+xXLZYxrf5JpL2tA
zlk*rCj0>HMsNhU+RdB!Hn&7(NVIi0hst{gb3Y*!&L$`%#d$nyiw%>6S$1xly>^P>A
zWKPmZ+H7*%O1VbLjk~Vyx`yjI(v3;imQt6}kTNV~RLYo?kfccpONvW!Ntz_1Bsobz
zQW7yDKaobH6NQOPB2FZT#)&407KoO}Q;|0bLNg&sXd}2F6{Ld)J
zSR*0@pZg}RXP4DJpB?V55lTks$V^r&$o`hxfiUCRL)1fC@rOD9!yuPU%0VH+a1cRxZ1c{P
zd-onYcI@1_bNBAud;a|S`}gm^fB*h}6pV(z&<_C}P!0g)1qP1!4C)+n6cQC2n^<}M
z8VU@W4mEKqnu*M~@Q|fjlv^S}Ls98apD>?ELI8u~(Pj>Qm4pKe8kv~bgcjLsSa7gu
znvS@F#D##==J{s1auNaz4_TPZA|Is`EMRD86yoz>$hz#<$i%`T;iB~+t$8&IpN;Ad
z1;-XPVJVLUhRF?=J6I)re0MKc8Qdr)uh6kmVeRdWMv77rzqYP$>T=s`R01^78UT+K
BA4mWI
diff --git a/src/googleTranslate-1.7/docs/media/images/PublicMethod.gif b/src/googleTranslate-1.7/docs/media/images/PublicMethod.gif
deleted file mode 100644
index 571fd9ce186a1ca0c1f98d075768b232782a2eaf..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1038
zcmeHG!E4iS82x6~l67@NEH1Ev3#)TsMg8rxABxV{RhkW{QKtNQQCmf*hmKqZ5t&_v
zL+e2awaN|(R&Y@CGW4)`=w{SW!swyL$f^<*A)<$P`o+VX644D{&v1m!?#-O={>zqd2hZ#!asI
zi7RGew^QT8js63n_1s#sy08DxrD!;IBH3GspL>*e*q$tvZv~8WZ2j}wyF;h+qd%I#
z-p2mq%-OBkT)4cLG1J0IaH=mjJpS^0GqD*RORrscF6N|guqR#_x%c$l{dnJt2KVbp
zC=l!&EL76<;GU6O@lSeoXra5SJCb<3B?e9(oDMC0EwqnAq~}PQ=_-CNkEX)c=C>zc
r=fGg$bpbuQS{XgFgZap7n~~_`+|P~Fm8l1NkIhFLV}Mvu$B3-Bv-R47I6YrJ_p3
zlEKfpd07`Oh5n@Ab}K+1~R});5Co~mVrEA0}9Tf|M=G~
zu!lL=`~}AUu&>|Z&({}{jRTYVgE#MwC2QP${+4TP(Tc{{7TMvj)2RxLi6KK=dX!$9BR?5V*cZxh9yk1sB+
zZTIXfJCqGfpDP^QQSPa48mcO2yIt3C<>cd$%v^DSd+fsb+2#^&b=TB-cByrClr?>-
z);?tB$|}3A4rSxb!@2#J_!M_fCcJf(4F~tSRu;5C&HQ-zz12iwTcvL|A6~nY3V4sF
zPZ&ixZz-?!@w@SMf550s|2Asd3w^FfXJ(S)yu$ETw`E-}R&oDw{d~>RM(4!7c*ecU
H$Jv3u*#hmj
diff --git a/src/googleTranslate-1.7/docs/media/images/T.png b/src/googleTranslate-1.7/docs/media/images/T.png
deleted file mode 100644
index 30173254061a6fc4f1488a0133b2704b0e5eea18..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 152
zcmeAS@N?(olHy`uVBq!ia0vp^!ayv*$P6UUaa~gcQtTz3zOL*Scz79=t)B~&gM>H>
zJR*x37`Q%wFr(8NlNmrkwg8_H*Xe!L|Ns9N51QZs6k#d}@(cdY@N~O@7mz3J>Eakt
raVz;p{QriB|LYZwxwcz9n9R-~pRXx?mgVYJpb`d8S3j3^P6rbI<(#&TZ~<-se5543rqm0{B1xe4Ln=`1C(982E?_^XLhT!@Uy2%Ud$_E(sw|dP!2p|DS
z0WyFbpa2#F^Z*nA3>82P&;Yam4?qVn0LuVIfC*p*mI5pQE5Hq~0m}h)fCJzJxPTP^
zFCYxa1AM?rfFBS51OXvH1ds+q0Wm-vkN_kBDL@8T4afp=z$yThRRxF@fi+YAUJJ3(
z)aQBh>i(8n-H367|6Ji+C}SKTcERj{Co%g#havoI^Qf$RFRT`M6Z9;n3=ba(?ffK(
z-r-yV0cHW-^anB9Ytc^L1bXl0kZW_e9Y@Ue*(RPQM+si=NA)8cdW8%P0xG+62`K+~
zZ~^3p(S6M3TF8D6Bj*hPr9~gn<3QKI+CTCM$On9F|HyujUuXorwtwV9kPkrikNgAj
z0m%MQn(6kB`~va;Y`}7W9pC__+doQ!d
z2taAJKx_h-0%pKgz#P~HSOAuQ6<`gZvWU{yLc9a81CYts0}g;A-~>1WF2F7T$-6=9
z4tM~&0c6ddfETbA@CJMUUtk|V4xlnX0tH~=>BI{R<$4u$6$~B}s;%e-C+fjOhzJOY
z2nmRY2#JV^i58Mll9G~;kSTldC*1hh>3|w7n0JDlG5-n(J}G-aG1D-p;`!KjuIb_9kYN651$Heq6n2E
zJVLlzbi-2tZvj5sFY!VWQZf+801L$6r8zPe@2W0Mg#@J%)gakb1eu8X_7Ub7FSq
zC8GPo&Mo9vn^s7>v8sntY@3T82`L>t10xgH3T_@=K5+?2DQOv5rFF_Gs%q-%b@evs
z8*DZ-vaqzW-fm;NW0$L&yT|T5o(B&4A37XxBryE=iHOLklc%E3U$_{5>GJOhiPx^D
zXJlq&-^jUrr|53+y^_+hN7XftpVU5mR@dCp`m*iS>o@Hky?y=f2L^|RM@CV;@G$tF
zvh_JWDyh8!OcULHObRKT4(^VE}`cF39qc3)Yh
zsi>E;D6=c!w^zo-X+df}W!w79EuTA>u5)?L8I#{>a8|W7!1aTBRFTi7be{O=E``mv
z@VQ;W4Sgw^^7P#=_qay;y6dVxRj3|o?B5mRD_F>D~W
zbqeHLCQG8tCWTt4>$Jf-ZNVZ@En|gQHyN9Q7qJ3M-UfeNpf$4{B#_O2YWW~V?A;EeoFM*GL!tH&nCqkz)_%Pp+5E6y8l3%3`lWeqzoVA|dCo2X7XOgNpo05H
zz?R=-P@v~W`ThT@e^9?^F5zd|-%Oy8Z_a)#NKe`lZuR`-@Vm8;}1|hB~{iwY-
zm+&+BNBz|0Q~FU~buIzvCxQ#0w)$-IzXoKn`Tq~MKi(h77q>}!YZM!lR8+UKr$OD3
zqA1*_#Uz!6t5{M>x8Gbv#w~Sav#P&D3R$abUGQk3JzuyGM*sZ8;DL(Do%>0hZNFwuGeEW#;DS_XrO4j=eT$8adb$W)$YTaUR*N!>ZbmV=)
zxn6PM`qEw5Pv2zGiUffM=PF;
z@Ss8LW2gOxyzL%MSETCo4@PS{^gTbXs<~dTW;suVWOdGy_V)vdGnvk$+r`=s8V|zR
z56*u6Mf(|wW7r*H%&2%hy)|?Ep<2IaH{}Ite9UfZE@S+adQ7$%F!2Yz;;o;;#5-
zOZDHgb95%{a_KG!y6N*yzit1rQez+9s&~)zqO`AN8b58zRO8&gg)?wd%puL^yp<<+
zg-lR}`npF_Dj%N@mENf)#Ms$_@4T%?H~if+7GV&!HplyI574P)jz?$rg?`e!pQ~?>4$H&
zPd>k}cn$Lj!OoJWjEvmXA(|VbS`JEjO2&Kp+R}CLaYc{T@rK4RWjd|xdKO7qPJC+k
z33rei{eo
zdrc|>2D~<2FLTv6d$g6yVxw-iUq%12&3(>&iQ8UX&|23}KVme2dFgcTtxK_7{WIeY
zL$j-Y2!B!igXYQR5`L!tvjG%RP4$1!82wxV(vRjW(45L_`#;7YOF5-qW-iJh?a$=j
z2GTW74)dWo&biHi5kdY*;d;mq&o=+AAS*VN|Je`2**w^nzI)&AK82Cu%$^k)2y$mo=;I1AxOYPFIQwovUow8dka;|#A?
zZ)_>G_U5&4yGd7dic9kjb09|J5(%;6%36kz<7N3w%B{?rc#iCchK;vS3qO35>UwXWyt+kr36}I{&LZ`6t&YMXFt}
zX1=CiNOHTY*v0exU9XBFTYkat^Es3*$)XfWmyFlg*@V?AE#VRK4_*+G@3-&!?QU!(
zf~`Ne|D*K>S~KDY590uE5by^M0f&JA;0O>11OZ2ZU?2oQ>5f4h28090ffGOk5D7#9
zCxKHyG;kU~Y0f|#3&a6ufpfrl-~wTcA#fW&X^J4e3lszQfD)h-CTSNMO%ue=ffqnC&;qmqFM&4T74RAu0NQ~L;4RPz
zbOGJKJD>;X1^R$~;5~q@4@)dCL-2VR7y(9s55O2O4txYAC(1w$xBg`o3w!>d@e9@<
zqiTubQ_ZK1BeSA(qopq&6YS(nwov9^73TH|i(SWMd>H117Rs+@-SlLP#m$+s)=2#5
z)!bD4qLjAGhoTD(X|LuE6|-U1rfF@GesaY=pS^wuQ>TZd%N@@w>U$XV6$kweV=Nf;
zHb2&&xN=o$d9dZMmr=p#mYb<5%}HKwKeW3sa)$73(+l5y(IQW#K8<9p`c~n*u)yB@
z^zkf-ocfnO$H(_C?tE@up1;hlz1OV3&bIyGS4|9ZC`(X`Fl*iazmS{@3$3pty;WGcsm3w&LU#3e
z)^^JD#O^h&+PXV={iHm&6&^=9TeS$#wb-o^)D+avZVpS8zcu_c5%1PLW!4a%h%*Vc
zKD@OplJwPYdW|bHrECuR`@K^ssq{VOW1a6FywqDVBB!Ifp!{9To7~)wBgF}CGX}++xnSdxe2-D?G-u8`?cPNZ9&X#WHw$R!
z?9<{*@NnE^lfdR-D^2}dvPd>>S;(4V6^dP^627!{P1H|ZPdhH?=)Lb{C2>tWDpF2K
zmUg4FbIbzOHT9P<29>vCxi$=Xj-DY4ue&}Ao5I@9D6am&?H`$GW6VF)e;yZ9m+&%^
zl#|ny)}uC+FP8buUx_-IDxg@EMb2WWPO6>JmBZUYM!P#0Q)tF_3bA=O85+D~=PYEt
z{=h|S^N@bi@+vMb3Q0}gF7|CD)%^QQWE3T(xiO1xC!S$7>0Nf&oal;VbmXyeF1LL$
zLI+|feH*WwzSG>>V=H0r=3(~AV}q+n;{=AtcNS(cV?z#WKlHz-{*m|_`X7vtJ0@VZ
z{hv&b<(TS!NX}jVvA`iSB0hfyz74X!ZKDi
zx?d(uC;5?S*XUrMbmEgDFDoXeA<*en>hh+b#5w|1JcWMTGp{6e;g6=~--bFd}$#+@ch
zZ!;JUXzc68{BTnQYd>^QAK?1Gxb^S<;`;ZlJk8V{Jv-{+0wYJ&-UllTk2p_YY|4*j
zW?o}(*!F?F$UNfW?rzE4{N{WGU3)LOh(x0unYX=24yIA7sH`DyXX`gr?mc}gGdNd2
z@OGaDk)c9Eqz66cIqL?q5|uigBQEs@awo4lG?eFExuce6vAua9H;}p6(Mc_H^I7Yy
zzu&_f9jrgPe@vre<)M5&*NbQoO@G&DtUEXT#uJZ@GMl)*%b0oJ6*QqH1KQ)QG`UNA
z7o5Q`eJ{5td{2O6ruK4Me3nvy(;IfeX%AoT{^kc^!f7d#K+XZKiq0oNXR}Pdx**6A
zeMk1s_d@(lX%~zeoIT+Rn!enLE)3EOr=?g2cZ=?1CV5VfCHX?$7Ua>s^)Gj~lTMRC
z`FHt~W^^Sqql0~J*04K%CupC(16~}yMxF~RGyRF8x8Vr7t>6hy*N$>TF)fWXNMYZC
zEj$DCtiRTQW>&tXLko7}TY>!7I?!8L{6!i!kV4PbcJlgPz7=#wl+&bDF*cKT?g~e4
zpnd;emngJX6wPyC@94|31<;uSu9H{zGT*Y00QC^QoeJy!(R>un|Kt4szv%xvUAugZ
zG9Qb_Ez#QDXSk!*JiIZ3H|D;*$K8u7YVN$eU7FvJ9?+JruJEywRW-YJ+Z*>+jx^$w
zb&HG!StIEEd~8bj6<=_TZ>Tb)FIem)mer(3K)z$$
z=lKVQUu1tWb02@0JkxC%WOKITKZ794IW_(uJjWBT(EbOcm-Pqq6TpHMktzKmf0KT;
zAJ9(?`uV5yi~ddem;Zo%Hqbu|2m>O3C?E!i0}_BFAO%PRG5|`a3$Z+~3QzzPfz`koU@f2otOJw*6+jh0
z>C_=!4`=|t0h+)DKnu_YbbyTjlHCgNCO{uB05$`LfDvE}YynIFQ@{*BX}lob23P==
zfE8d3YzJ%rTVMxZ2kZpw0hG=WVkf{EZ~=A!u7Dfh4tM~&fjxjHfYL-l><#z;zQ8^J
zH-7P-9lz+dS70+Xtk@A*7vFR)wXE-+mv!Qhb*=fbUH2UraBc7#8N%pGp
zsRa#1@dxL!sEsHdel_S2@v=#vDs{{(skGUfH-24Y?Kq$M1s?vYLS4>4ClA&aS}m&<
zHFnF7N#ZqkeR#IYF{!|py-mU4@C+62C-()dWYjyF={zme_C+J(GuOb__AfdQ1=s$?
zwSWJ`_HTFRUJr7b+X8MY?~m_1HGxUD*D-zD8ALBuD$abolq#pwBrmHc*+1!QPh9YT
zw})A^Jx8@5Q=OK?m5bi1Ql3=MipJgSH(@z-boV-bCv`dZ#|1$&ZzZF5G#K(%#Pi8E
zk=c}oUuxcW7sFLea3Cw*
zl?-S1=({Yfg3*FSLM$*E61*}s(_}EKogncDq0eyS4S*E^sS%u6&sV~Wi}qlUFAull4Rv0a539&;fh1b0c}xU
zD)pHITjj40`8b>;%1de?I^)|~u}5C)LMdCOoym|R=guH&R?m^}<%LbE4NCXjM?A7e
zm@R})mOQ-JaJH$dai}Y+BVScDmnUeB~0pr-Hs`StB
z|G?Dvi{vlRuLt^Tru4(O8Seb-`FVc!Xkd%pA*pcvO~Grdt))qcH)?Krlp&|7|5VFD
zIGWu#?AV$i;;=1_caIF5UL_&OA8Gw4Qp&i{o-tgnK_vSuLC)4=?tM3%Lr=*kHD5Fp
zN$(joxku5HmCb3)uPr95XR&YG%f5K^N3H?dJ7%=98`lflyNwKvYst|BC9Jnqp-9c~
zsC%C9{m%I;%-VWVMjHMypiiGq&Hkgk^1Tsup3mdwaHc!1|BgGq{@Vxh|1;~4M-4XB
z7-%W$naOr+8PV=8?sVgvz>tQ#9tp?0o!x6RIb9`@Cux!L-i%L(V5};9v+pg9A#R(b
zy7$z<8y^fCtFOwV)Fcn0BNH49&a&^gwP$
zmr}mI_~zbH%I2)FAa(bUvdSJ_c
z$vi3llo;IaCw%%{m-)Z{>r#?!&~?pplU!#~id^^Bwxt$3TH7;x4#XQKkINRVGUC}=>7P`R?NPK=dZu45>MDH9&HtL6>p85D>r8AA~;#aXNk`5
ztUul);{n4!dl>$(4tp3Wa)6a#XuZ;xzdM5VIs75#^tt_o&QqKp^Cvj_nQlK)zo7qV
z4*k!iQ~hu0x$FPo-+yxe{n-6CGJlhP)SX6S5Xe0KD(nUQaM1H)5T5+y!oNx}^Y=e9
z{&58K3r*>t&+Uip+IcquN1L8JXkxq=DZ{nG@TmFPB`guwe4I!0m@J3%ha_|CAE)Hm
z4Z7PjF=qAn(-ZDZ$A1?R2h=BVxy;;_=Yx~3db)8G=8kKT6XJ^+&ZOedu$Ia(|*~1>wQ9pSi+2cShq%Xc77P!
z{+K`O?{WTfy8rw?wI6*)|BM6P+b@oY7@sD)kLPA9FG`ay%u%2tB7o!@MwupoyyHI}3Yt1{6n*_Ugt`9T2n3b6Kv
z&cm4>?U%pz_owzlUEl{C01g8Fz#-r;5CEWcV}TF{0Y`ygAOr{njsamnIB*;|0Ym^O
z%|(b$0;hmz;4}~eoB?8iIN&UB4mb~708l!_CHQ<9_#H?95`iQj8At(Afhz!##f7;&
z0o?h2zwG?KAps@bn(aA`*Pd&T2a6vow6a@j&k@jYK}PVR8^M51i0oq%t$UAb>Ij>X
z5)D^xyQ(>)Q|RO8+eI;Lh~Kp%nmfQc+yAwSm$zVxjb(^o
z-t%y^LKaEi)-u(h-EnkgO&vbuy|gi=EWH{XO#VqqOYF{VNwz!MwdDkH%z#9xXJD73
z@12hf7iQOLLGJZa!1_;)|ET}O+0QStpZ8j!X0(<2?G4ncj(Y@LS>C@4k3e4{bUfWp@62-{Z(qz0h}_as%&0q7)Uw
zzGYlftrUG2w?w}bYd*P72kmzIW8WOw5r_6SU|TewWIwfMu=e+}>*qv%LH{!f>h3@G
zKZt#DBtQB0XZpYKpg(hJ{`)7@evxc?4gAFy|I$C^q96DB-MHWHp5d3tKW~hf;rF}W
zPhgIiQL6fjCk(7Sqgs0EVsz8}4f~dR9bi7eZy0t}R8(uV^vi*ib9?QpCA7#oWE=F$
zdfS~z9M6*9m*wTh+r--zzE+HonswKf=XV=LR~hx%b63eLt?D`$wN~=5TJ)>NM|(W7
zqS%x8ZfGWQ)_pXq=%XXm4X7HE6le7x{dnBAc>+V*@U|``fd+n!DLyy`|C+>zw9bti
zt2|@Nq95$uy|p^%}w^3h^4cY6IKUV)@a
ziMaVA-1_Bzcm49{%=1Tyb=x|t?dcsF)*f(Z%pOr?sLLL;H#^(Dn$G5Y;1`F4{0~&=
B{O#nkpi;(?AirP+hi5m^fE-m%
z7srr_TgeFwOpI(f46|1#2yiGY`Di?KiU>FVdQ
I&MBb@06e2A@c;k-
diff --git a/src/googleTranslate-1.7/docs/media/images/Tplus.png b/src/googleTranslate-1.7/docs/media/images/Tplus.png
deleted file mode 100644
index 2c8d8f4fd38259b2ef70fc63fad505fb0a0f55a4..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 222
zcmeAS@N?(olHy`uVBq!ia0vp^!ayv*!VDzYUPT51DfSXiUsv`EJiLtRLI=-jc>;wv
z3p^r=85p=efH0%e8j~47L4yFF5LY1m|NsB#ebqn)F`$y&;y6$pQ%R6t@PCG<+YP*c
zJY!E6$B>F!$pS1)t^$e&6gZd#)XV}^6#`leL>0XheB5$;*x1}$U0qr4a0#d>%86hy4NT6+w`tp00i_>zopr0L}p{>Hq)$
diff --git a/src/googleTranslate-1.7/docs/media/images/Types.gif b/src/googleTranslate-1.7/docs/media/images/Types.gif
deleted file mode 100644
index 7c13fd59a3c0609f76cf8bd61ac9b922f05cfc83..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1049
zcmeH`!An#@9LHyM&9`Z;X_OU&iY^u#n35Pl=&o5C9>P;CSjI~U)b>M#w}chmeI3L^z9Z4&yAwCN3Kb
zV~8=rBu6kN#3BR|f(QvcA+~7~WD{)L$hJcg+p!$SavjHYT-PPkbtxs3I*d|A8DoSo
zn=ywmmxY;Q&IAw1ZO&cJDd&ub5?F8{LJA^;Ed&jN@GRj$;UOWRC%ETvPZCeso^+%q
zWk^Y-kEL%*-;n|Keb)~hKcGRt0!0JGR1l~@tI#N}lvFBEN-ItEZW}tSh1Qp8T7K`IZ!lHa8@CO}>6OR+pRv-P`NW
zJr%2w^k^Rdl~H5r9QgfnZtTR}%(KLN
J8bu=D>|g!c_R;_V
diff --git a/src/googleTranslate-1.7/docs/media/images/Variable.gif b/src/googleTranslate-1.7/docs/media/images/Variable.gif
deleted file mode 100644
index 63b3f553003ca037323cea629d914602fb03f3ce..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1051
zcmeH`!Ap~I7{|X`29IvSBf0q=OkUlVvz9a=Fgr9?sCyYTB19`BS%F~0Qg7?9*~DTa
zibi!9L4x4LSb=20z-CHFj7|eDqeXMx-W`Hpr+&T5KchaE@Au*1c@AIr4hM$%&rC8H
z0tO5yKqt@xcmWN#3|s}mz%&pA5Ou-#3Q-k87j>lgyEjxw
zX$(^82V%JY{0j+q4k}=jfPUk>uiSMj+1h)3C0L%R?AT9?+B
z9{b|Y$oC(O_TEeDQ@i;Fmrb?IxYeZ=r~TNq^&5AW)cm8S0rga^oY;AKa(Jcnq4$3N
zuvNLZABy|&Jagq<_C?5XzS(+uqQB<#b+&b%>-d_Dm_997Y(Z!C18Zhi`|aSbT6{iX
zBeVL&U-4O8Ll@?1zRmc&+4MRT_`LbR>NuJjnNl4l6X=!N($^4RSFf5K$qpW}dB%C5
zJh{28j-E3t~REx%#;rcA`}%wc`Ud-FGwN8ICgXrpUu^5eprCyRT1TUz?~sM%!3
F**_P)xa`Z7f#eL0AQKK-;)M
zje}6!i?|1ES&iU=NCO^RP^sIX5)jLRmx1=ORKZ1*P7dn0p?`xnfAeE_Z{EOz2k*$p
za9`vU1`HgwzyK0J2p|Fw1sDfN0Hgq900N)^=m0hV18@NWpeTYp2qFj!gaDQ4MJR$0
zMMy=+LdZtQK^PDw7!nwTFiK+NVy`EbFiv1BW2{P;NSI2J62gWoCuLcYWkV*tL{1S|
zA!MA86!9V@sZh@pB{Ee!2~`xTP^xH@9;Gx%y%Hsqswz#XR8}cbRZqpsHSd$EXnIoD
ziD9t3naZ2Y%o}E&nP$>7g=vkOR>HJo)1sECS(c|^c@*WM<*5}dy=bRwyU3Wqn8}#U
zm|%{|9Gy9~!wiR6j-xv+bzI$b6}Nl~m*-tUxodKlajtQ0ac*<&aPIOl!aH0D;R?as
za#&7uA&NrSLNFnmt(y1xpMN@m?(zndcLC5J`2F+v^5e;cfw@hzUf&gHJ8w>S6o#6lG{_dB5BV{qxPFB9-LpNj=w
zkM3-O&CZ954rKf-ySjVg>myAsvr|%bTRPL|ufdbEJu}r)Et!H+x?AzKvbME&;_Sq7
z^ug{+uT}$->9IMOd9$=J&7Q2Gb{}%$Tr>Xz|
diff --git a/src/googleTranslate-1.7/docs/media/images/blank.png b/src/googleTranslate-1.7/docs/media/images/blank.png
deleted file mode 100644
index cee9cd37a10ebe8d7fe6a6ed0d8d74a2889f6e9f..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 144
zcmeAS@N?(olHy`uVBq!ia0vp^!ayv*$P6UUaa~gcQtTz3zOL*Scz7A*wL3%Pb^(Pr
z3p^r=85p=efH0%e8j~47LAC&&5LY1m|NsA`H|O64vY1MO{DS{8Jl$^K1?2I2x;TbZ
j+)DoO|34!$s|3ToYTbu_uiJV9r5HS2{an^LB{Ts5Dp4nx
diff --git a/src/googleTranslate-1.7/docs/media/images/classFolder.gif b/src/googleTranslate-1.7/docs/media/images/classFolder.gif
deleted file mode 100644
index 5492345f26cdda50757283033c57e4a329e37132..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1069
zcmeH`&r20i6vwZodHqq2S~2v)n*0HR3n#&R8f0c_FAI6Oh__Oo88{New1{pCp(|wF
zF|iA2Ouv)|E}Rz8EFbuzh9VrQ#bBFRL^#oA$`+R(Jk6`Wpnacn7Uvwk=esy?x=wdC
z#|9)MA%Xs)B8(8m2*;u!lG>3RLuw-Gv$F^ZOGuTlEMZlWu_P<9maJ3iR3ycc@tCgY
zB%yPKAVi2ps74r}M5ZJ`Nsb5fpTc`oz3D7ojEzHj;g
z^@Fr85`jm8AQ6a6n07)}3w=Edc_>6EAcRZ^UI<|bLMXDZn6PybBt&Qm!G*B1sw@zN
z002`5i-1GHHNm6cncy?&6R~n_#+k5N!
z7S~t1N*^0D%^M%pSH<^R&owW;pTD$LGhvMGS65FN<&9^?=#%BS@jD$xvhP7&;fLy@
zqwCd!FBYbY3yikjqMO509OvcstZ$wwDMm(b_u-0#j;96NcQ$;Rt9@JaqG{KGuT`IW
zw&j)A_xI0jT&~^0H#$xqq3!u{pEI?zsVqO*J-u~o;(X0Xc4Tt@!|tlVrAKAAu3tEj
zJKkN^a<}B?yF|-9BR=*EO`lvSoZNZf*`ZHLTd7fYd`O=CuDs4KJ2quEfY-4FC~iDX0Jd
diff --git a/src/googleTranslate-1.7/docs/media/images/file.png b/src/googleTranslate-1.7/docs/media/images/file.png
deleted file mode 100644
index 0bb2427f8afe94b50835b0a6fb2f7fc4b6624bb9..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 462
zcmeAS@N?(olHy`uVBq!ia0vp^{6H+o!2~3GGZMc6DV-A6h!W?b)Wnj^{5*w_%-mFl
zkkV8IBTEIZ#5@Hf0|O%FdgViBVQqh^b}u-UUD*
z&H|6fVg?4j!ywFfJby(BP>?0v(btiIVPik{pF~y$21Zp+7srr_TgiX^|F>tp*udH$
zEiL_V#ftUo-3uDh%uP)G{Qt|SZB_7q!9$E~2FI`q8Re^|Ns4w54;**JyG{r3reJX3bz{Zf3vmrZqg`n}6P+S5*tz>i^H*
z#2~u%W)Z8#mr%xxhMwd+SvmjaL%%Odb!ew<(5(2Ban^6jjOpAT8-5&KS>(Rw-29d%
zNdZfFap?uEMT+k<(v+DOT$Z%I^ZS1lw?N{?lj=*DIus0-A5UO#>EQ|b(2@MtwUbVx|CCuD_3M1(}kL@rTAt`?@NJD7g1T-cVt+{lozLxII0fq`Ms9dUP2
S4@VK8*$kepelF{r5}E+oVobaM
diff --git a/src/googleTranslate-1.7/docs/media/images/minus.gif b/src/googleTranslate-1.7/docs/media/images/minus.gif
deleted file mode 100644
index 9e998f1b737a63fda6e7fc27521ec539bb540640..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 64
zcmZ?wbhEHb$k6o0aS1$00pNS=X7u%~~K_OaJ-+)NSHsnb3#
Jlow&J1_04p503x<
diff --git a/src/googleTranslate-1.7/docs/media/images/msgError.gif b/src/googleTranslate-1.7/docs/media/images/msgError.gif
deleted file mode 100644
index 93c6d36a82266e869e09e25b8306c04bb48b3c77..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 997
zcmZ?wbhEHb6krfw_|5|33$!_y6Am5l{#y50L;#j)Kt;7(yYS1IhuQyuiS5ib2xmLIYzn8wZE6
zfC)!qBO5y(R~CbV;DJNjd~y;;0vH(>xy6kl6c`p9I@TeL}|32rOiBWM@#wkXZ0gk(HB6$Ya5S
z1=@_Q3_MvI92A>aIK{RkZHNe4+RP)wC$nI}!gq(;88f0b1RP*!-NDCH-a6sN>xYL0
vST0=gDtP2RL5wXTM0#UUTbJ1Xq=p{_Uk*=54gP;sYGeBSQ*#wrSQxAU@(?F`
diff --git a/src/googleTranslate-1.7/docs/media/images/msgFatalError.gif b/src/googleTranslate-1.7/docs/media/images/msgFatalError.gif
deleted file mode 100644
index 6257bbe5679aef76cac20e5bd85aa60456f40a15..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1040
zcmeH`ziSg=7{{MWbIo%tF;6Qgub8Cwrb|z1Np)#Rk+hYFi$ie`acC<-28(fUu!GzY
z2^}IhI5=cz>f%y}U>EhE@yFSrgcc-Zkh7A)iOU;7x$*V#H+1cX&oh0$(-)p=*9)`R
z6#@bufCCr+GXPnD1%M@hs=;gAs2RpKW82)=G5C%#Vpmc2MII
zkLT_;x4u48)RYM$^C(MeB6Rykr&0ejs9jcnb>4If*3jAI
z4<`Int6F^M=%7B4SI?xc>~GHBtwiFfbeJZOER2uSx7QYgwUJo3S5)+7BzmscY0M9l
zD={rpD_XDem1t&_W%L23qAd;o)_3)?O5@Wn8_z98NnYG|a)Nebx9;5wL_l!t*xqYEd<+E6UAuPf{rl(d-@pI<{{Q#y@4th<|L_0bgNX0{
z|AR4*8U>>vFsMR62b2Rqd4YlB5Q961h~c7U4nY|=1rZA+7e{_2qXG^Fg@&dkB`X7w
z6ON7y+`Q@x0Su28whPKIG~5w5)O?to%Vge_2MUKec;#3mBnpiVxi-o&q~z>qVD#oy
zVlZF{P)y{QrXyQ)V8NB$-!YL078}m98LlPh7tmniV|L$icZh({eS-a
z|9cSl{~d_FzyA&b|NjFK7z3$MFd70wGz4@QfB=*i7&uliC+G*!-E~-sv#?0Bq*>p3X2Ebd6Ce>(jg+1u|#3xA!Y`4Ew2R2f#KgkdWn{szk*Q?~
zp9q6SL&BRwjmEo$rUZmMbLSGRcY9H}<-wiJEZQY&EH)aPUT3MRwnkw)03qb
zp#%v80H#VXO^~W2*e2MjJK#u&(TTAVV>QNljB!kL#0KI5;xdwlR7Ir_A`zia*d`hy
z^3+7c#5VC5u}AC^H;9*sQOU&2Hgi!elTC)dT0$h!*-`7s-cc~9ow~NQ-P$Ry>PGcjG2ei;
zHU4{eyVuurak;tw)`7$e>!N8F*MzP^VZOHEZl@>+x^h-C|
gEWb_{9=-3ZB|cf_3TIPqj{p96-bsC!u}rxB4R
diff --git a/src/googleTranslate-1.7/docs/media/images/openfoldericon.png b/src/googleTranslate-1.7/docs/media/images/openfoldericon.png
deleted file mode 100644
index 15fcd567111e13cfd9e6f1c0cd8103ca0e2d76ff..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 232
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFKheKdVb6i#4OEw{M26cw_Gj{yv63W{1!+$*s*N3f2
zemsk&HQ&u~&f!%4#A(caCa+!4-!jYT%bH^M9p4*PZTkKrpyj95hk2~iCLLVQKL3cY
Ud_U9dR-h#ep00i_>zopr03|O{b^rhX
diff --git a/src/googleTranslate-1.7/docs/media/images/plus.gif b/src/googleTranslate-1.7/docs/media/images/plus.gif
deleted file mode 100644
index cade83c7f9634e275e6ae4efc8f7265a2f917448..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 67
zcmZ?wbhEHb$k6o0aS1$00pNS=X7q^Ez8_O=aknoc!VM^_Y{
MKUcyL#K2$;02xgZ8~^|S
diff --git a/src/googleTranslate-1.7/docs/media/images/spacer.gif b/src/googleTranslate-1.7/docs/media/images/spacer.gif
deleted file mode 100644
index 1fa6d01f01faa218d0af23cad7a0b5606a49c2ed..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 55
zcmZ?wbhEHb=2) {
- this.childNodes[this.childNodes.length -2]._last = false;
- }
- while (root.parentNode) { root = root.parentNode; }
- if (root.rendered) {
- if (this.childNodes.length >= 2) {
- document.getElementById(this.childNodes[this.childNodes.length -2].id + '-plus').src = ((this.childNodes[this.childNodes.length -2].folder)?webFXTreeConfig.tMinusIcon:webFXTreeConfig.tIcon);
- if (this.childNodes[this.childNodes.length -2].folder) {
- this.childNodes[this.childNodes.length -2].plusIcon = webFXTreeConfig.tPlusIcon;
- this.childNodes[this.childNodes.length -2].minusIcon = webFXTreeConfig.tMinusIcon;
- }
- this.childNodes[this.childNodes.length -2]._last = false;
- }
- this._last = true;
- var foo = this;
- while (foo.parentNode) {
- for (var i = 0; i < foo.parentNode.childNodes.length; i++) {
- if (foo.id == foo.parentNode.childNodes[i].id) { break; }
- }
- if (++i == foo.parentNode.childNodes.length) { foo.parentNode._last = true; }
- else { foo.parentNode._last = false; }
- foo = foo.parentNode;
- }
- document.getElementById(this.id + '-cont').insertAdjacentHTML("beforeEnd", node.toString());
- if ((!this.folder) && (!this.openIcon)) {
- this.icon = webFXTreeConfig.folderIcon;
- this.openIcon = webFXTreeConfig.openFolderIcon;
- }
- this.folder = true;
- this.indent();
- this.expand();
- }
- return node;
-}
-
-WebFXTreeAbstractNode.prototype.toggle = function() {
- if (this.folder) {
- if (this.open) { this.collapse(); }
- else { this.expand(); }
- }
-}
-
-WebFXTreeAbstractNode.prototype.select = function() {
- document.getElementById(this.id + '-anchor').focus();
-}
-
-WebFXTreeAbstractNode.prototype.focus = function() {
- webFXTreeHandler.selected = this;
- if ((this.openIcon) && (webFXTreeHandler.behavior != 'classic')) { document.getElementById(this.id + '-icon').src = this.openIcon; }
- document.getElementById(this.id + '-anchor').style.backgroundColor = 'highlight';
- document.getElementById(this.id + '-anchor').style.color = 'highlighttext';
- document.getElementById(this.id + '-anchor').focus();
-}
-
-WebFXTreeAbstractNode.prototype.blur = function() {
- if ((this.openIcon) && (webFXTreeHandler.behavior != 'classic')) { document.getElementById(this.id + '-icon').src = this.icon; }
- document.getElementById(this.id + '-anchor').style.backgroundColor = 'transparent';
- document.getElementById(this.id + '-anchor').style.color = 'menutext';
-}
-
-WebFXTreeAbstractNode.prototype.doExpand = function() {
- if (webFXTreeHandler.behavior == 'classic') { document.getElementById(this.id + '-icon').src = this.openIcon; }
- if (this.childNodes.length) { document.getElementById(this.id + '-cont').style.display = 'block'; }
- this.open = true;
- webFXTreeHandler.cookies.setCookie(this.id.substr(18,this.id.length - 18), '1');
-}
-
-WebFXTreeAbstractNode.prototype.doCollapse = function() {
- if (webFXTreeHandler.behavior == 'classic') { document.getElementById(this.id + '-icon').src = this.icon; }
- if (this.childNodes.length) { document.getElementById(this.id + '-cont').style.display = 'none'; }
- this.open = false;
- webFXTreeHandler.cookies.setCookie(this.id.substr(18,this.id.length - 18), '0');
-}
-
-WebFXTreeAbstractNode.prototype.expandAll = function() {
- this.expandChildren();
- if ((this.folder) && (!this.open)) { this.expand(); }
-}
-
-WebFXTreeAbstractNode.prototype.expandChildren = function() {
- for (var i = 0; i < this.childNodes.length; i++) {
- this.childNodes[i].expandAll();
-} }
-
-WebFXTreeAbstractNode.prototype.collapseAll = function() {
- if ((this.folder) && (this.open)) { this.collapse(); }
- this.collapseChildren();
-}
-
-WebFXTreeAbstractNode.prototype.collapseChildren = function() {
- for (var i = 0; i < this.childNodes.length; i++) {
- this.childNodes[i].collapseAll();
-} }
-
-WebFXTreeAbstractNode.prototype.indent = function(lvl, del, last, level) {
- /*
- * Since we only want to modify items one level below ourself,
- * and since the rightmost indentation position is occupied by
- * the plus icon we set this to -2
- */
- if (lvl == null) { lvl = -2; }
- var state = 0;
- for (var i = this.childNodes.length - 1; i >= 0 ; i--) {
- state = this.childNodes[i].indent(lvl + 1, del, last, level);
- if (state) { return; }
- }
- if (del) {
- if (level >= this._level) {
- if (this.folder) {
- document.getElementById(this.id + '-plus').src = (this.open)?webFXTreeConfig.lMinusIcon:webFXTreeConfig.lPlusIcon;
- this.plusIcon = webFXTreeConfig.lPlusIcon;
- this.minusIcon = webFXTreeConfig.lMinusIcon;
- }
- else { document.getElementById(this.id + '-plus').src = webFXTreeConfig.lIcon; }
- return 1;
- }
- }
- var foo = document.getElementById(this.id + '-indent-' + lvl);
- if (foo) {
- if ((del) && (last)) { foo._last = true; }
- if (foo._last) { foo.src = webFXTreeConfig.blankIcon; }
- else { foo.src = webFXTreeConfig.iIcon; }
- }
- return 0;
-}
-
-/*
- * WebFXTree class
- */
-
-function WebFXTree(sText, sAction, sBehavior, sIcon, sOpenIcon) {
- this.base = WebFXTreeAbstractNode;
- this.base(sText, sAction);
- this.icon = sIcon || webFXTreeConfig.rootIcon;
- this.openIcon = sOpenIcon || webFXTreeConfig.openRootIcon;
- /* Defaults to open */
- this.open = (webFXTreeHandler.cookies.getCookie(this.id.substr(18,this.id.length - 18)) == '0')?false:true;
- this.folder = true;
- this.rendered = false;
- if (!webFXTreeHandler.behavior) { webFXTreeHandler.behavior = sBehavior || webFXTreeConfig.defaultBehavior; }
- this.targetWindow = 'right';
-}
-
-WebFXTree.prototype = new WebFXTreeAbstractNode;
-
-WebFXTree.prototype.setBehavior = function (sBehavior) {
- webFXTreeHandler.behavior = sBehavior;
-};
-
-WebFXTree.prototype.getBehavior = function (sBehavior) {
- return webFXTreeHandler.behavior;
-};
-
-WebFXTree.prototype.getSelected = function() {
- if (webFXTreeHandler.selected) { return webFXTreeHandler.selected; }
- else { return null; }
-}
-
-WebFXTree.prototype.remove = function() { }
-
-WebFXTree.prototype.expand = function() {
- this.doExpand();
-}
-
-WebFXTree.prototype.collapse = function() {
- this.focus();
- this.doCollapse();
-}
-
-WebFXTree.prototype.getFirst = function() {
- return null;
-}
-
-WebFXTree.prototype.getLast = function() {
- return null;
-}
-
-WebFXTree.prototype.getNextSibling = function() {
- return null;
-}
-
-WebFXTree.prototype.getPreviousSibling = function() {
- return null;
-}
-
-WebFXTree.prototype.keydown = function(key) {
- if (key == 39) { this.expand(); return false; }
- if (key == 37) { this.collapse(); return false; }
- if ((key == 40) && (this.open)) { this.childNodes[0].select(); return false; }
- return true;
-}
-
-WebFXTree.prototype.toString = function() {
- var str = "";
- str += "" + this.text + "";
- str += "";
- for (var i = 0; i < this.childNodes.length; i++) {
- str += this.childNodes[i].toString(i, this.childNodes.length);
- }
- str += "";
- this.rendered = true;
- return str;
-};
-
-/*
- * WebFXTreeItem class
- */
-
-function WebFXTreeItem(sText, sAction, eParent, sIcon, sOpenIcon) {
- this.base = WebFXTreeAbstractNode;
- this.base(sText, sAction);
- /* Defaults to close */
- this.open = (webFXTreeHandler.cookies.getCookie(this.id.substr(18,this.id.length - 18)) == '1')?true:false;
- if (eParent) { eParent.add(this); }
- if (sIcon) { this.icon = sIcon; }
- if (sOpenIcon) { this.openIcon = sOpenIcon; }
-}
-
-WebFXTreeItem.prototype = new WebFXTreeAbstractNode;
-
-WebFXTreeItem.prototype.remove = function() {
- var parentNode = this.parentNode;
- var prevSibling = this.getPreviousSibling(true);
- var nextSibling = this.getNextSibling(true);
- var folder = this.parentNode.folder;
- var last = ((nextSibling) && (nextSibling.parentNode) && (nextSibling.parentNode.id == parentNode.id))?false:true;
- this.getPreviousSibling().focus();
- this._remove();
- if (parentNode.childNodes.length == 0) {
- parentNode.folder = false;
- parentNode.open = false;
- }
- if (last) {
- if (parentNode.id == prevSibling.id) {
- document.getElementById(parentNode.id + '-icon').src = webFXTreeConfig.fileIcon;
- }
- else { }
- }
- if ((!prevSibling.parentNode) || (prevSibling.parentNode != parentNode)) {
- parentNode.indent(null, true, last, this._level);
- }
- if (document.getElementById(prevSibling.id + '-plus')) {
- if (nextSibling) {
- if ((parentNode == prevSibling) && (parentNode.getNextSibling)) { document.getElementById(prevSibling.id + '-plus').src = webFXTreeConfig.tIcon; }
- else if (nextSibling.parentNode != prevSibling) { document.getElementById(prevSibling.id + '-plus').src = webFXTreeConfig.lIcon; }
- }
- else { document.getElementById(prevSibling.id + '-plus').src = webFXTreeConfig.lIcon; }
- }
-}
-
-WebFXTreeItem.prototype._remove = function() {
- for (var i = this.childNodes.length - 1; i >= 0; i--) {
- this.childNodes[i]._remove();
- }
- for (var i = 0; i < this.parentNode.childNodes.length; i++) {
- if (this.id == this.parentNode.childNodes[i].id) {
- for (var j = i; j < this.parentNode.childNodes.length; j++) {
- this.parentNode.childNodes[i] = this.parentNode.childNodes[i+1]
- }
- this.parentNode.childNodes.length = this.parentNode.childNodes.length - 1;
- if (i + 1 == this.parentNode.childNodes.length) { this.parentNode._last = true; }
- }
- }
- webFXTreeHandler.all[this.id] = null;
- if (document.getElementById(this.id)) {
- document.getElementById(this.id).innerHTML = "";
- document.getElementById(this.id).removeNode();
- }
-}
-
-WebFXTreeItem.prototype.expand = function() {
- this.doExpand();
- document.getElementById(this.id + '-plus').src = this.minusIcon;
-}
-
-WebFXTreeItem.prototype.collapse = function() {
- this.focus();
- this.doCollapse();
- document.getElementById(this.id + '-plus').src = this.plusIcon;
-}
-
-WebFXTreeItem.prototype.getFirst = function() {
- return this.childNodes[0];
-}
-
-WebFXTreeItem.prototype.getLast = function() {
- if (this.childNodes[this.childNodes.length - 1].open) { return this.childNodes[this.childNodes.length - 1].getLast(); }
- else { return this.childNodes[this.childNodes.length - 1]; }
-}
-
-WebFXTreeItem.prototype.getNextSibling = function() {
- for (var i = 0; i < this.parentNode.childNodes.length; i++) {
- if (this == this.parentNode.childNodes[i]) { break; }
- }
- if (++i == this.parentNode.childNodes.length) { return this.parentNode.getNextSibling(); }
- else { return this.parentNode.childNodes[i]; }
-}
-
-WebFXTreeItem.prototype.getPreviousSibling = function(b) {
- for (var i = 0; i < this.parentNode.childNodes.length; i++) {
- if (this == this.parentNode.childNodes[i]) { break; }
- }
- if (i == 0) { return this.parentNode; }
- else {
- if ((this.parentNode.childNodes[--i].open) || (b && this.parentNode.childNodes[i].folder)) { return this.parentNode.childNodes[i].getLast(); }
- else { return this.parentNode.childNodes[i]; }
-} }
-
-WebFXTreeItem.prototype.keydown = function(key) {
- if ((key == 39) && (this.folder)) {
- if (!this.open) { this.expand(); return false; }
- else { this.getFirst().select(); return false; }
- }
- else if (key == 37) {
- if (this.open) { this.collapse(); return false; }
- else { this.parentNode.select(); return false; }
- }
- else if (key == 40) {
- if (this.open) { this.getFirst().select(); return false; }
- else {
- var sib = this.getNextSibling();
- if (sib) { sib.select(); return false; }
- } }
- else if (key == 38) { this.getPreviousSibling().select(); return false; }
- return true;
-}
-
-WebFXTreeItem.prototype.toString = function (nItem, nItemCount) {
- var foo = this.parentNode;
- var indent = '';
- if (nItem + 1 == nItemCount) { this.parentNode._last = true; }
- var i = 0;
- while (foo.parentNode) {
- foo = foo.parentNode;
- indent = "" + indent;
- i++;
- }
- this._level = i;
- if (this.childNodes.length) { this.folder = 1; }
- else { this.open = false; }
- if ((this.folder) || (webFXTreeHandler.behavior != 'classic')) {
- if (!this.icon) { this.icon = webFXTreeConfig.folderIcon; }
- if (!this.openIcon) { this.openIcon = webFXTreeConfig.openFolderIcon; }
- }
- else if (!this.icon) { this.icon = webFXTreeConfig.fileIcon; }
- var label = this.text;
- label = label.replace('<', '<');
- label = label.replace('>', '>');
- var str = "";
- str += indent;
- str += ""
- str += "" + label + "";
- str += "";
- for (var i = 0; i < this.childNodes.length; i++) {
- str += this.childNodes[i].toString(i,this.childNodes.length);
- }
- str += "";
- this.plusIcon = ((this.parentNode._last)?webFXTreeConfig.lPlusIcon:webFXTreeConfig.tPlusIcon);
- this.minusIcon = ((this.parentNode._last)?webFXTreeConfig.lMinusIcon:webFXTreeConfig.tMinusIcon);
- return str;
-}
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/docs/media/lib/tab.webfx.css b/src/googleTranslate-1.7/docs/media/lib/tab.webfx.css
deleted file mode 100644
index 337fd8a8..00000000
--- a/src/googleTranslate-1.7/docs/media/lib/tab.webfx.css
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-
-bright: rgb(234,242,255);
-normal: rgb(120,172,255);
-dark: rgb(0,66,174);
-
-*/
-
-
-
-
-.dynamic-tab-pane-control.tab-pane {
- position: relative;
- width: 100%;
-}
-
-.dynamic-tab-pane-control .tab-row .tab {
- font-family: Verdana, Helvetica, Arial;
- font-size: 12px;
- cursor: Default;
- display: inline;
- margin: 1px -5px 1px 5px;
- float: left;
- padding: 3px 6px 3px 6px;
- background: rgb(234,242,255);
- border: 1px solid;
- border-color: rgb(120,172,255);
- border-left: 0;
- border-bottom: 0;
- border-top: 0;
-
- cursor: hand;
- cursor: pointer;
-
- z-index: 1;
- position: relative;
- top: 0;
-}
-
-.dynamic-tab-pane-control .tab-row .tab.selected {
- border: 1px solid rgb(120,172,255);
- border-bottom: 0;
- z-index: 3;
- padding: 2px 6px 5px 6px;
- margin: 1px -6px -2px 0px;
- top: -2px;
- background: white;
-}
-
-.dynamic-tab-pane-control .tab-row .tab a {
- font-family: Verdana, Helvetica, Arial;
- font-size: 13px;
- color: rgb(0,66,174);
- text-decoration: none;
- cursor: hand;
- cursor: pointer;
-}
-
-.dynamic-tab-pane-control .tab-row .hover a {
- color: rgb(0,66,174);
-}
-
-.dynamic-tab-pane-control .tab-row .tab.selected a {
- font-weight: bold;
-}
-
-.dynamic-tab-pane-control .tab-page {
- clear: both;
- border: 1px solid rgb(120,172,255);
- background: White;
- z-index: 2;
- position: relative;
- top: -2px;
- color: Black;
- font-family: Verdana, Helvetica, Arial;
- font-size: 13px;
- padding: 10px;
-}
-
-.dynamic-tab-pane-control .tab-row {
- z-index: 1;
- white-space: nowrap;
- background: rgb(234,242,255);
- height: 1.85em;
- width: 100%;
-}
diff --git a/src/googleTranslate-1.7/docs/media/lib/tabpane.js b/src/googleTranslate-1.7/docs/media/lib/tabpane.js
deleted file mode 100644
index f1418bee..00000000
--- a/src/googleTranslate-1.7/docs/media/lib/tabpane.js
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Tab Pane
- *
- * This script was created by Erik Arvidsson (erik(at)eae.net)
- * for WebFX (http://webfx.eae.net)
- * Copyright 2002
- *
- * For usage see license at http://webfx.eae.net/license.html
- *
- * Version: 1.0
- * Created: 2002-01-?? First working version
- * Updated: 2002-02-17 Cleaned up for 1.0 public version
- *
- * Dependencies: *.css - a css file to define the layout
- *
- */
-
-
-// This function is used to define if the browser supports the needed
-// features
-function hasSupport() {
-
- if (typeof hasSupport.support != "undefined")
- return hasSupport.support;
-
- var ie55 = /msie 5\.[56789]/i.test( navigator.userAgent );
-
- hasSupport.support = ( typeof document.implementation != "undefined" &&
- document.implementation.hasFeature( "html", "1.0" ) || ie55 )
-
- // IE55 has a serious DOM1 bug... Patch it!
- if ( ie55 ) {
- document._getElementsByTagName = document.getElementsByTagName;
- document.getElementsByTagName = function ( sTagName ) {
- if ( sTagName == "*" )
- return document.all;
- else
- return document._getElementsByTagName( sTagName );
- };
- }
-
- return hasSupport.support;
-}
-
-///////////////////////////////////////////////////////////////////////////////////
-// The constructor for tab panes
-//
-// el : HTMLElement The html element used to represent the tab pane
-// bUseCookie : Boolean Optional. Default is true. Used to determine whether to us
-// persistance using cookies or not
-//
-function WebFXTabPane( el, bUseCookie ) {
- if ( !hasSupport() || el == null ) return;
-
- this.element = el;
- this.element.tabPane = this;
- this.pages = [];
- this.selectedIndex = null;
- this.useCookie = bUseCookie != null ? bUseCookie : false;
-
- // add class name tag to class name
- this.element.className = this.classNameTag + " " + this.element.className;
-
- // add tab row
- this.tabRow = document.createElement( "div" );
- this.tabRow.className = "tab-row";
- el.insertBefore( this.tabRow, el.firstChild );
-
- var tabIndex = 0;
- if ( this.useCookie ) {
- tabIndex = Number( WebFXTabPane.getCookie( "webfxtab_" + this.element.id ) );
- if ( isNaN( tabIndex ) )
- tabIndex = 0;
- }
-
- this.selectedIndex = tabIndex;
-
- // loop through child nodes and add them
- var cs = el.childNodes;
- var n;
- for (var i = 0; i < cs.length; i++) {
- if (cs[i].nodeType == 1 && cs[i].className == "tab-page") {
- this.addTabPage( cs[i] );
- }
- }
-}
-
-WebFXTabPane.prototype = {
-
- classNameTag: "dynamic-tab-pane-control",
-
- setSelectedIndex: function ( n ) {
- if (this.selectedIndex != n) {
- if (this.selectedIndex != null && this.pages[ this.selectedIndex ] != null )
- this.pages[ this.selectedIndex ].hide();
- this.selectedIndex = n;
- this.pages[ this.selectedIndex ].show();
-
- if ( this.useCookie )
- WebFXTabPane.setCookie( "webfxtab_" + this.element.id, n ); // session cookie
- }
- },
-
- getSelectedIndex: function () {
- return this.selectedIndex;
- },
-
- addTabPage: function ( oElement ) {
- if ( !hasSupport() ) return;
-
- if ( oElement.tabPage == this ) // already added
- return oElement.tabPage;
-
- var n = this.pages.length;
- var tp = this.pages[n] = new WebFXTabPage( oElement, this, n );
- tp.tabPane = this;
-
- // move the tab out of the box
- this.tabRow.appendChild( tp.tab );
-
- if ( n == this.selectedIndex )
- tp.show();
- else
- tp.hide();
-
- return tp;
- }
-};
-
-// Cookie handling
-WebFXTabPane.setCookie = function ( sName, sValue, nDays ) {
- var expires = "";
- if ( nDays ) {
- var d = new Date();
- d.setTime( d.getTime() + nDays * 24 * 60 * 60 * 1000 );
- expires = "; expires=" + d.toGMTString();
- }
-
- document.cookie = sName + "=" + sValue + expires + "; path=/";
-};
-
-WebFXTabPane.getCookie = function (sName) {
- var re = new RegExp( "(\;|^)[^;]*(" + sName + ")\=([^;]*)(;|$)" );
- var res = re.exec( document.cookie );
- return res != null ? res[3] : null;
-};
-
-WebFXTabPane.removeCookie = function ( name ) {
- setCookie( name, "", -1 );
-};
-
-
-
-
-
-
-
-
-///////////////////////////////////////////////////////////////////////////////////
-// The constructor for tab pages. This one should not be used.
-// Use WebFXTabPage.addTabPage instead
-//
-// el : HTMLElement The html element used to represent the tab pane
-// tabPane : WebFXTabPane The parent tab pane
-// nindex : Number The index of the page in the parent pane page array
-//
-function WebFXTabPage( el, tabPane, nIndex ) {
- if ( !hasSupport() || el == null ) return;
-
- this.element = el;
- this.element.tabPage = this;
- this.index = nIndex;
-
- var cs = el.childNodes;
- for (var i = 0; i < cs.length; i++) {
- if (cs[i].nodeType == 1 && cs[i].className == "tab") {
- this.tab = cs[i];
- break;
- }
- }
-
- // insert a tag around content to support keyboard navigation
- var a = document.createElement( "A" );
- a.href = "javascript:void 0;";
- while ( this.tab.hasChildNodes() )
- a.appendChild( this.tab.firstChild );
- this.tab.appendChild( a );
-
-
- anchor = '';
- if ( document.URL.indexOf( '#' ) != -1 ) {
- anchor = document.URL.substr( document.URL.indexOf( '#' ) + 1);
- }
- j = 0;
- if ( anchor.length > 0 ) {
- finalList = new Array();
- listOfAnchors = el.getElementsByTagName('A');
- for (i=0; i
-
-
-
-
-
-
-Packages
-
-
-
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/example.php b/src/googleTranslate-1.7/example.php
deleted file mode 100644
index 91452652..00000000
--- a/src/googleTranslate-1.7/example.php
+++ /dev/null
@@ -1,22 +0,0 @@
-
-detectLanguage($test));
-
-/* Translate */
-echo $gt->translate($test, "fr", "en");
-
-/* Was translation successful */
-echo $gt->isSuccess();
-
-
-
-?>
\ No newline at end of file
diff --git a/src/googleTranslate-1.7/googleTranslate.class.php b/src/googleTranslate-1.7/googleTranslate.class.php
deleted file mode 100644
index b3b7b2fb..00000000
--- a/src/googleTranslate-1.7/googleTranslate.class.php
+++ /dev/null
@@ -1,424 +0,0 @@
- $this->_version,
- 'q' => $this->_text,
- 'langpair' => $this->_fromLang . "|" . $this->_toLang);
- }
- elseif($type == self::DETECT)
- {
- $fields = array('v' => $this->_version,
- 'q' => $this->_text);
- }
-
- if($this->_apiKey != "") $fields['key'] = $this->_apiKey;
- if($this->_ip != "") $fields['userip'] = $this->_ip;
-
- $this->_postFields = http_build_query($fields, '', "&");
- }
-
-
- /**
- * Process the built query using cURL and POST
- *
- * @param string POST fields
- * @return string response
- */
- private function _remoteQuery($query)
- {
- if(!function_exists('curl_init'))
- {
- return "";
- }
-
- /* Setup CURL and its options*/
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$this->_googleTranslateUrl);
- curl_setopt($ch, CURLOPT_REFERER, $this->_siteUrl);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_TIMEOUT, 15);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
-
- $response = curl_exec($ch);
-
- return $response;
- }
-
-
- /**
- * Process the built query using cURL and GET
- *
- * @param string GET fields
- * @return string response
- */
- private function _remoteQueryDetect($query)
- {
- if(!function_exists('curl_init'))
- {
- return "";
- }
-
- $ch = curl_init();
- $url = $this->_googleDetectUrl . "?" . $query;
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_REFERER, $this->_siteUrl);
-
- $response = curl_exec($ch);
- return $response;
- }
-
-
- /**
- * Self test the class
- *
- * @return boolean
- */
- public function selfTest()
- {
- if(!function_exists('curl_init'))
- {
- echo "cURL not installed.";
- }
- else
- {
- $testText = $this->translate("hello", "fr", "en");
- echo ($testText == "bonjour") ? "Test Ok." : "Test Failed.";
- }
- }
-
- /**
- * Check if the last translation was a success
- *
- * @return boolean
- */
- public function isSuccess()
- {
- return $this->_success;
- }
-
- /**
- * Get the last generated service error
- *
- * @return String
- */
- public function getLastError()
- {
- return $this->_serviceError;
- }
-
-
- /**
- * Get the detected source language, if the source is not provided
- * during query
- *
- * @return String
- */
- public function getDetectedSource()
- {
- return $this->_detectedSourceLanguage;
- }
-
-
- /**
- * Set credentials (optional) when accessing Google translation services
- *
- * @param string $apiKey your google api key
- */
- public function setCredentials($apiKey, $ip)
- {
- $this->_apiKey = $apiKey;
- $this->_ip = $ip;
- }
-
-
- /**
- * Set Referrer header
- *
- * @param string $siteUrl your website url
- */
- public function setReferrer($siteUrl)
- {
- $this->_siteUrl = $siteUrl;
- }
-
-
- /**
- * Translate the given text
- * @param string $text text to translate
- * @param string $to language to translate to
- * @param string $from optional language to translate from
- * @return boolean | string
- */
- public function translate($text = '', $to, $from = '')
- {
- $this->_success = false;
-
- if($text == '' || $to == '')
- {
- return false;
- }
- else
- {
- if($this->_chunks == 0)
- {
- $this->_chunks = str_split($text, $this->_stringLimit);
- $this->_totalChunks = count($this->_chunks);
- $this->_currentChunk = 0;
-
- $this->_text = $this->_chunks[$this->_currentChunk];
- $this->_toLang = $to;
- $this->_fromLang = $from;
- }
- else
- {
- $this->_text = $text;
- $this->_toLang = $to;
- $this->_fromLang = $from;
- }
- }
-
- $this->_composeUrl(self::TRANSLATE);
-
- if($this->_text != '' && $this->_postFields != '')
- {
- $contents = $this->_remoteQuery($this->_postFields);
- $json = json_decode($contents, true);
-
- if($json['responseStatus'] == 200)
- {
- $this->translatedText .= $json['responseData']['translatedText'];
- if(isset($json['responseData']['detectedSourceLanguage']))
- {
- $this->_detectedSourceLanguage = $json['responseData']['detectedSourceLanguage'];
- }
-
- $this->_currentChunk++;
-
- if($this->_currentChunk >= $this->_totalChunks) {
- $this->_success = true;
- return $this->translatedText;
- }
- else {
- return $this->translate($this->_chunks[$this->_currentChunk], $to, $from);
- }
-
- }
- else
- {
- $this->_serviceError = $json['responseDetails'];
- return false;
- }
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Detect the language of the given text
- * @param string $text text language to detect
- * @return boolean | string
- */
- public function detectLanguage($text)
- {
-
- if($text == '')
- {
- return false;
- }
- else
- {
- $this->_text = $text;
- }
-
-
- $this->_composeUrl(self::DETECT);
-
- if($this->_text != '' && $this->_postFields != '')
- {
-
- $contents = $this->_remoteQueryDetect($this->_postFields);
- $json = json_decode($contents, true);
-
- if($json['responseStatus'] == 200)
- {
- return $json['responseData'];
- }
- else
- {
- $this->_serviceError = $json['responseDetails'];
- return false;
- }
- }
- else
- {
- return false;
- }
-
- }
-
-}
-
-
-?>
\ No newline at end of file