【php开源代码栏目提醒】:本文主要为网学会员提供adodb.inc.php,希望对需要adodb.inc.php网友有所帮助,学习一下!
<?php
/*
* Set tabs to 4 for best viewing.
*
* Latest version is available at http://php.weblogs.com
*
* This is the main include file for ADOdb.
* Database specific drivers are stored in the adodb/drivers/adodb-*.inc.php
*
* The ADOdb files are formatted so that doxygen can be used to generate documentation.
* Doxygen is a documentation generation tool and can be downloaded from http://doxygen.org/
*/
/**
\mainpage
@version V3.60 16 June 2003 (c) 2000-2003 John Lim (jlim\@natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
PHP's database access functions are not standardised. This creates a need for a database
class library to hide the differences between the different database API's (encapsulate
the differences) so we can easily switch databases.
We currently support MySQL, Oracle, Microsoft SQL Server, Sybase, Sybase SQL Anywhere,
Informix, PostgreSQL, FrontBase, Interbase (Firebird and Borland variants), Foxpro, Access,
ADO and ODBC. We have had successful reports of connecting to Progress and DB2 via ODBC.
We hope more people will contribute drivers to support other databases.
Latest Download at http://php.
weblogs.com/adodb<br>
Manual is at http://php.weblogs.com/adodb_manual
*/
if (!defined('_ADODB_LAYER')) {
define('_ADODB_LAYER',1);
//==============================================================================================
// CONSTANT DEFINITIONS
//==============================================================================================
define('ADODB_BAD_RS','<p>Bad $rs in %s. Connection or SQL invalid. Try using $connection->debug=true;</p>');
define('ADODB_FETCH_DEFAULT',0);
define('ADODB_FETCH_NUM',1);
define('ADODB_FETCH_ASSOC',2);
define('ADODB_FETCH_BOTH',3);
/*
Controls ADODB_FETCH_ASSOC field-name case. Default is 2, use native case-names.
This currently works only with mssql, odbc, oci8po and ibase derived drivers.
0 = assoc lowercase field names. $rs->fields['orderid']
1 = assoc uppercase field names. $rs->fields['ORDERID']
2 = use native-case field names. $rs->fields['OrderID']
*/
if (!defined('ADODB_ASSOC_CASE')) define('ADODB_ASSOC_CASE',2);
// allow [ ] @ ` and . in table names
define('ADODB_TABLE_REGEX','([]0-9a-z_\`\.\@\[-]*)');
if (!defined('ADODB_PREFETCH_ROWS')) define('ADODB_PREFETCH_ROWS',10);
/**
* 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('TIMESTAMP_FIRST_YEAR')) define('TIMESTAMP_FIRST_YEAR',100);
//==============================================================================================
// GLOBAL VARIABLES
//==============================================================================================
GLOBAL
$ADODB_vers, // database version
$ADODB_Database, // last database driver used
$ADODB_COUNTRECS, // count number of records returned - slows down query
$ADODB_CACHE_DIR, // directory to cache recordsets
$ADODB_EXTENSION, // ADODB extension installed
$ADODB_COMPAT_PATCH, // If $ADODB_COUNTRECS and this is true, $rs->fields is available on EOF
$ADODB_FETCH_MODE; // DEFAULT, NUM, ASSOC or BOTH. Default follows native driver default...
//==============================================================================================
// GLOBAL SETUP
//==============================================================================================
if (strnatcmp(PHP_VERSION,'4.3.0')>=0) {
define('ADODB_PHPVER',0x4300);
} else if (strnatcmp(PHP_VERSION,'4.2.0')>=0) {
define('ADODB_
PHPVER',0x4200);
} else if (strnatcmp(PHP_VERSION,'4.0.5')>=0) {
define('ADODB_PHPVER',0x4050);
} else {
define('ADODB_PHPVER',0x4000);
}
$ADODB_EXTENSION = defined('ADODB_EXTENSION');
//if (extension_loaded('dbx')) define('ADODB_DBX',1);
/**
Accepts $src and $dest arrays, replacing string $data
*/
function ADODB_str_replace($src, $dest, $data)
{
if (ADODB_PHPVER >= 0x4050) return str_replace($src,$dest,$data);
$s = reset($src);
$d = reset(