$dest);
while ($s !== false) {
$data = str_replace($s,$d,$data);
$s = next($src);
$d = next($dest);
}
return $data;
}
function ADODB_Setup()
{
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_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_DEFAULT;
if (!isset($ADODB_CACHE_DIR)) {
$ADODB_CACHE_DIR = '/tmp';
} else {
// do not accept url based paths, eg. http:/ or ftp:/
if (strpos($ADODB_CACHE_DIR,'://') !== false)
die("Illegal path http:// or ftp://");
}
// Initialize random number generator for randomizing cache flushes
srand(((double)microtime())*1000000);
/**
* Name of last database driver loaded into memory. Set by ADOLoadCode().
*/
$ADODB_Database = '';
/**
* ADODB version as a string.
*/
$ADODB_vers = 'V3.60 16 June 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved. Released BSD & LGPL.';
/**
* Determines whether recordset->RecordCount() is used.
* Set to false for highest performance -- RecordCount() will always return -1 then
* for databases that provide "virtual" recordcounts...
*/
$ADODB_COUNTRECS = true;
}
//==============================================================================================
// CHANGE NOTHING BELOW UNLESS YOU ARE CODING
//==============================================================================================
ADODB_Setup();
//==============================================================================================
// CLASS ADOFieldObject
//==============================================================================================
/**
* Helper class for FetchFields -- holds info on a column
*/
class ADOFieldObject {
var $name = '';
var $max_length=0;
var $type="";
// additional fields by dannym... (danny_milo@yahoo.com)
var $not_null = false;
// actually, this has already been built-in in the postgres, fbsql AND mysql module? ^-^
// so we can as well make not_null standard (leaving it at "false" does not harm anyways)
var $has_default = false; // this one I have done only in
mysql and postgres for now ...
// others to come (dannym)
var $default_value; // default, if any, and supported. Check has_default first.
}
function ADODB_TransMonitor($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection)
{
//print "Errorno ($fn errno=$errno m=$errmsg) ";
$thisConnection->_transOK = false;
if ($thisConnection->_oldRaiseFn) {
$fn = $thisConnection->_oldRaiseFn;
$fn($dbms, $fn, $errno, $errmsg, $p1, $p2,$thisConnection);
}
}
//==============================================================================================
// CLASS ADOConnection
//==============================================================================================
/**
* Connection object. For connecting to databases, and executing queries.
*/
class ADOConnection {
//
// PUBLIC VARS
//
var $dataProvider = 'native';
var $databaseType = ''; /// RDBMS currently in use, eg. odbc, my
sql, mssql
var $database = ''; /// Name of database to be used.
var $host = ''; /// The hostname of the database server
var $user = ''; /// The username which is used to connect to the database server.
var $password = ''; /// Pass
word for the username. For security, we no longer store it.
var $debug = false; /// if set to true will output sql statements
var $maxblobsize = 256000; /// maximum size of blobs or large text fields -- some databases die otherwise like foxpro
var $concat_operator = '+'; /// default concat operator -- change to || for Oracle/Interbase
var $fmtDate = "'Y-m-d'"; /// used by DBDate() as the default