ADOConnection Class Reference

Inheritance diagram for ADOConnection:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 ADOConnection ()
 Version ()
 ServerInfo ()
 IsConnected ()
 _findvers ($str)
 outp ($msg, $newline=true)
 Time ()
 Connect ($argHostname="", $argUsername="", $argPassword="", $argDatabaseName="", $forceNew=false)
 _nconnect ($argHostname, $argUsername, $argPassword, $argDatabaseName)
 NConnect ($argHostname="", $argUsername="", $argPassword="", $argDatabaseName="")
 PConnect ($argHostname="", $argUsername="", $argPassword="", $argDatabaseName="")
 SQLDate ($fmt, $col=false)
 Prepare ($sql)
 PrepareSP ($sql, $param=true)
 Quote ($s)
 QMagic ($s)
 q (&$s)
 ErrorNative ()
 nextId ($seq_name)
 RowLock ($table, $where)
 CommitLock ($table)
 RollbackLock ($table)
 SetFetchMode ($mode)
Query ($sql, $inputarr=false)
LimitQuery ($sql, $offset, $count, $params=false)
 Disconnect ()
 Param ($name, $type='C')
 InParameter (&$stmt, &$var, $name, $maxLen=4000, $type=false)
 OutParameter (&$stmt, &$var, $name, $maxLen=4000, $type=false)
 Parameter (&$stmt, &$var, $name, $isOutput=false, $maxLen=4000, $type=false)
 IgnoreErrors ($saveErrs=false)
 StartTrans ($errfn= 'ADODB_TransMonitor')
 CompleteTrans ($autoComplete=true)
 FailTrans ()
 HasFailedTrans ()
Execute ($sql, $inputarr=false)
_Execute ($sql, $inputarr=false)
 CreateSequence ($seqname='adodbseq', $startID=1)
 DropSequence ($seqname='adodbseq')
 GenID ($seqname='adodbseq', $startID=1)
 Insert_ID ($table='', $column='')
 PO_Insert_ID ($table="", $id="")
 Affected_Rows ()
 ErrorMsg ()
 ErrorNo ()
 MetaError ($err=false)
 MetaErrorMsg ($errno)
 MetaPrimaryKeys ($table, $owner=false)
 MetaForeignKeys ($table, $owner=false, $upper=false)
 SelectDB ($dbName)
SelectLimit ($sql, $nrows=-1, $offset=-1, $inputarr=false, $secs2cache=0)
SerializableRS (&$rs)
_rs2rs (&$rs, $nrows=-1, $offset=-1, $close=true)
GetAll ($sql, $inputarr=false)
GetAssoc ($sql, $inputarr=false, $force_array=false, $first2cols=false)
CacheGetAssoc ($secs2cache, $sql=false, $inputarr=false, $force_array=false, $first2cols=false)
 GetOne ($sql, $inputarr=false)
 CacheGetOne ($secs2cache, $sql=false, $inputarr=false)
 GetCol ($sql, $inputarr=false, $trim=false)
 CacheGetCol ($secs, $sql=false, $inputarr=false, $trim=false)
Transpose (&$rs)
 OffsetDate ($dayFraction, $date=false)
GetArray ($sql, $inputarr=false)
CacheGetAll ($secs2cache, $sql=false, $inputarr=false)
CacheGetArray ($secs2cache, $sql=false, $inputarr=false)
GetRow ($sql, $inputarr=false)
CacheGetRow ($secs2cache, $sql=false, $inputarr=false)
 Replace ($table, $fieldArray, $keyCol, $autoQuote=false, $has_autoinc=false)
CacheSelectLimit ($secs2cache, $sql, $nrows=-1, $offset=-1, $inputarr=false)
 CacheFlush ($sql=false, $inputarr=false)
 _dirFlush ($dir, $kill_top_level=false)
 xCacheFlush ($sql=false, $inputarr=false)
 _gencachename ($sql, $createdir, $memcache=false)
CacheExecute ($secs2cache, $sql=false, $inputarr=false)
AutoExecute ($table, $fields_values, $mode= 'INSERT', $where=FALSE, $forceUpdate=true, $magicq=false)
 GetUpdateSQL (&$rs, $arrFields, $forceUpdate=false, $magicq=false, $force=null)
 GetInsertSQL (&$rs, $arrFields, $magicq=false, $force=null)
 UpdateBlob ($table, $column, $val, $where, $blobtype='BLOB')
 UpdateBlobFile ($table, $column, $path, $where, $blobtype='BLOB')
 BlobDecode ($blob)
 BlobEncode ($blob)
 SetCharSet ($charset)
 IfNull ($field, $ifNull)
 LogSQL ($enable=true)
 GetCharSet ()
 UpdateClob ($table, $column, $val, $where)
 MetaType ($t, $len=-1, $fieldobj=false)
 SetDateLocale ($locale= 'En')
GetActiveRecordsClass ($class, $table, $whereOrderBy=false, $bindarr=false, $primkeyArr=false)
GetActiveRecords ($table, $where=false, $bindarr=false, $primkeyArr=false)
 Close ()
 BeginTrans ()
 SetTransactionMode ($transaction_mode)
 MetaTransaction ($mode, $db)
 CommitTrans ($ok=true)
 RollbackTrans ()
 MetaDatabases ()
MetaTables ($ttype=false, $showSchema=false, $mask=false)
 _findschema (&$table, &$schema)
MetaColumns ($table, $normalize=true)
MetaIndexes ($table, $primary=false, $owner=false)
MetaColumnNames ($table, $numIndexes=false, $useattnum=false)
 Concat ()
 DBDate ($d)
 BindDate ($d)
 BindTimeStamp ($d)
 DBTimeStamp ($ts)
 UnixDate ($v)
 UnixTimeStamp ($v)
 UserDate ($v, $fmt='Y-m-d', $gmt=false)
 UserTimeStamp ($v, $fmt='Y-m-d H:i:s', $gmt=false)
 escape ($s, $magic_quotes=false)
 addq ($s, $magic_quotes=false)
 qstr ($s, $magic_quotes=false)
PageExecute ($sql, $nrows, $page, $inputarr=false, $secs2cache=0)
CachePageExecute ($secs2cache, $sql, $nrows, $page, $inputarr=false)

Public Attributes

 $dataProvider = 'native'
 $databaseType = ''
 $database = ''
 RDBMS currently in use, eg. odbc, mysql, mssql.
 $host = ''
 Name of database to be used.
 $user = ''
 The hostname of the database server.
 $password = ''
 The username which is used to connect to the database server.
 $debug = false
 Password for the username. For security, we no longer store it.
 $maxblobsize = 262144
 if set to true will output sql statements
 $concat_operator = '+'
 maximum size of blobs or large text fields (262144 = 256K)-- some db's die otherwise like foxpro
 $substr = 'substr'
 default concat operator -- change to || for Oracle/Interbase
 $length = 'length'
 substring operator
 $random = 'rand()'
 string length ofperator
 $upperCase = 'upper'
 random function
 $fmtDate = "'Y-m-d'"
 uppercase function
 $fmtTimeStamp = "'Y-m-d, h:i:s A'"
 used by DBDate() as the default date format used by the database
 $true = '1'
 used by DBTimeStamp as the default timestamp fmt.
 $false = '0'
 string that represents TRUE for a database
 $replaceQuote = "\\'"
 string that represents FALSE for a database
 $nameQuote = '"'
 string to use to replace quotes
 $charSet = false
 string to use to quote identifiers and names
 $metaDatabasesSQL = ''
 character set to use - only for interbase, postgres and oci8
 $metaTablesSQL = ''
 $uniqueOrderBy = false
 $emptyDate = ' '
 All order by columns have to be unique.
 $emptyTimeStamp = ' '
 $lastInsID = false
 $hasInsertID = false
 $hasAffectedRows = false
 supports autoincrement ID?
 $hasTop = false
 supports affected rows for update/delete?
 $hasLimit = false
 support mssql/access SELECT TOP 10 * FROM TABLE
 $readOnly = false
 support pgsql/mysql SELECT * FROM TABLE LIMIT 10
 $hasMoveFirst = false
 this is a readonly database - used by phpLens
 $hasGenID = false
 has ability to run MoveFirst(), scrolling backwards
 $hasTransactions = true
 can generate sequences using GenID();
 $genID = 0
 has transactions
 $raiseErrorFn = false
 sequence id used by GenID();
 $isoDates = false
 error function to call
 $cacheSecs = 3600
 accepts dates in ISO format
 $memCache = false
 cache for 1 hour
 $memCacheHost
 should we use memCache instead of caching in files
 $memCachePort = 11211
 memCache host
 $memCacheCompress = false
 memCache port
 $sysDate = false
 Use 'true' to store the item compressed (uses zlib).
 $sysTimeStamp = false
 name of function that returns the current date
 $arrayClass = 'ADORecordSet_array'
 name of function that returns the current timestamp
 $noNullStrings = false
 name of class used to generate array recordsets, which are pre-downloaded recordsets
 $numCacheHits = 0
 oracle specific stuff - if true ensures that '' is converted to ' '
 $numCacheMisses = 0
 $pageExecuteCountRows = true
 $uniqueSort = false
 $leftOuter = false
 indicates that all fields in order by must be unique
 $rightOuter = false
 operator to use for left outer join in WHERE clause
 $ansiOuter = false
 operator to use for right outer join in WHERE clause
 $autoRollback = false
 whether ansi outer join syntax supported
 $poorAffectedRows = false
 $fnExecute = false
 $fnCacheExecute = false
 $blobEncodeType = false
 $rsPrefix = "ADORecordSet_"
 $autoCommit = true
 $transOff = 0
 do not modify this yourself - actually private
 $transCnt = 0
 temporarily disable transactions
 $fetchMode = false
 count of nested transactions
 $null2null = 'null'
 $_oldRaiseFn = false
 $_transOK = null
 $_connectionID = false
 $_errorMsg = false
 The returned link identifier whenever a successful database connection is made.
 $_errorCode = false
 then returned by the errorMsg() function
 $_queryID = false
 Last error code, not guaranteed to be used - only by oci8.
 $_isPersistentConnection = false
 This variable keeps the last created result link identifier.
 $_bindInputArray = false
 A boolean variable to state whether its a persistent connection or normal connection. */.
 $_evalAll = false
 set to true if ADOConnection.Execute() permits binding of array parameters.
 $_affected = false
 $_logsql = false
 $_transmode = ''


Detailed Description

Connection object. For connecting to databases, and executing queries.

Definition at line 235 of file adodb.inc.php.


Member Function Documentation

ADOConnection.ADOConnection (  ) 

Constructor

Definition at line 336 of file adodb.inc.php.

ADOConnection.Version (  ) 

Definition at line 341 of file adodb.inc.php.

ADOConnection.ServerInfo (  ) 

Get server version info...

Returns:
An array with 2 elements: $arr['string'] is the description string, and $arr[version] is the version (also a string).

Reimplemented in ADODB_ado, ADODB_ado, ADODB_borland_ibase, ADODB_db2, ADODB_firebird, ADODB_ibase, ADODB_ldap, ADODB_mysql, ADODB_oci8, ADODB_odbc, ADODB_ODBC_DB2, ADODB_odbc_mssql, ADODB_odbtp, ADODB_pdo_base, ADODB_pdo, ADODB_pdo_mssql, ADODB_pdo_mysql, ADODB_pdo_pgsql, ADODB_postgres64, ADODB_SAPDB, and ADODB_sqlite.

Definition at line 354 of file adodb.inc.php.

Referenced by ADODB_pdo_mssql.ServerInfo(), ADODB_pdo_base.ServerInfo(), ADODB_odbc.ServerInfo(), and ADODB_db2.ServerInfo().

ADOConnection.IsConnected (  ) 

Definition at line 359 of file adodb.inc.php.

ADOConnection._findvers ( str  ) 

ADOConnection.outp ( msg,
newline = true 
)

All error messages go through this bottleneck function. You can define your own handler by defining the function name in ADODB_OUTP.

Definition at line 374 of file adodb.inc.php.

References $ADODB_FLUSH.

Referenced by _adodb_debug_execute(), _affectedrows(), ADODB_odbc._connect(), _connect(), ADODB_ldap._connect(), ADODB_db2._connect(), ADODB_ado._connect(), ADODB2_oci8._CreateSuffix(), ADODB2_access._CreateSuffix(), ADORecordSet_ado._fetch(), _gencachename(), ADODB_DataDict._GenFields(), _insertid(), ADODB_odbc._pconnect(), ADODB_oci8._query(), _query(), ADODB_ibase._query(), adoSchema.addSQL(), adodb_log_sql(), adodb_sess_gc(), adodb_sess_write(), adodb_write_file(), ADOLoadCode(), ADONewConnection(), Affected_Rows(), ADODB2_postgres.AlterColumnSQL(), ADODB2_informix.AlterColumnSQL(), ADODB2_ibase.AlterColumnSQL(), ADODB2_generic.AlterColumnSQL(), ADODB2_db2.AlterColumnSQL(), ADODB2_access.AlterColumnSQL(), AutoExecute(), ADODB_mysql.BeginTrans(), ADODB_oci8.Bind(), CacheExecute(), CacheFlush(), CacheSelectLimit(), CompleteTrans(), Connect(), ADODB2_postgres.DropColumnSQL(), ADODB2_informix.DropColumnSQL(), ADODB2_ibase.DropColumnSQL(), ADODB2_generic.DropColumnSQL(), ADODB2_db2.DropColumnSQL(), ADODB2_access.DropColumnSQL(), ADODB_Active_Record.Error(), Execute(), ADODB_DataDict.ExecuteSQLArray(), FailTrans(), flushmemcache(), ADODB_Session.gc(), GetActiveRecordsClass(), Insert_ID(), ADODB_pdo_pgsql.MetaColumns(), NewDataDictionary(), ADODB_Session.open(), perf_mysql.optimizeTable(), adodb_perf.OptimizeTable(), ADODB_oci8.Parameter(), PConnect(), ADODB_mssqlpo.PrepareSP(), putmemcache(), SelectDB(), StartTrans(), ADODB_Active_Record.UpdateActiveTable(), ADODB_oci8.UpdateBlob(), ADODB_oci8.UpdateBlobFile(), ADODB_Session.write(), and xCacheFlush().

ADOConnection.Time (  ) 

Reimplemented in ADODB_access, ADODB_oci8, ADODB_pdo, and ADODB_vfp.

Definition at line 398 of file adodb.inc.php.

References $rs, _Execute(), and UnixTimeStamp().

Here is the call graph for this function:

ADOConnection.Connect ( argHostname = "",
argUsername = "",
argPassword = "",
argDatabaseName = "",
forceNew = false 
)

Connect to database

Parameters:
[argHostname] Host to connect to
[argUsername] Userid to login
[argPassword] Associated password
[argDatabaseName] database
[forceNew] force new connection
Returns:
true or false

Definition at line 417 of file adodb.inc.php.

References $rez, _connect(), _nconnect(), database, debug, ErrorMsg(), ErrorNo(), outp(), and password.

Referenced by NConnect(), and PConnect().

Here is the call graph for this function:

ADOConnection._nconnect ( argHostname,
argUsername,
argPassword,
argDatabaseName 
)

Reimplemented in ADODB_mysql, ADODB_oci8, and ADODB_postgres64.

Definition at line 447 of file adodb.inc.php.

References _connect().

Referenced by Connect().

Here is the call graph for this function:

ADOConnection.NConnect ( argHostname = "",
argUsername = "",
argPassword = "",
argDatabaseName = "" 
)

Always force a new connection to database - currently only works with oracle

Parameters:
[argHostname] Host to connect to
[argUsername] Userid to login
[argPassword] Associated password
[argDatabaseName] database
Returns:
true or false

Definition at line 463 of file adodb.inc.php.

References Connect().

Here is the call graph for this function:

ADOConnection.PConnect ( argHostname = "",
argUsername = "",
argPassword = "",
argDatabaseName = "" 
)

Establish persistent connect to database

Parameters:
[argHostname] Host to connect to
[argUsername] Userid to login
[argPassword] Associated password
[argDatabaseName] database
Returns:
return true or false

Definition at line 478 of file adodb.inc.php.

References $rez, _pconnect(), Connect(), database, debug, ErrorMsg(), ErrorNo(), outp(), and password.

Here is the call graph for this function:

ADOConnection.SQLDate ( fmt,
col = false 
)

ADOConnection.Prepare ( sql  ) 

Should prepare the sql statement and return the stmt resource. For databases that do not support this, we return the $sql. To ensure compatibility with databases that do not support prepare:

$stmt = $db->Prepare("insert into table (id, name) values (?,?)"); $db->Execute($stmt,array(1,'Jill')) or die('insert failed'); $db->Execute($stmt,array(2,'Joe')) or die('insert failed');

Parameters:
sql SQL to send to database
Returns:
return FALSE, or the prepared statement, or the original sql if if the database does not support prepare.

Reimplemented in ADODB_db2, ADODB_ibase, ADODB_odbc, ADODB_odbtp, and ADODB_pdo.

Definition at line 529 of file adodb.inc.php.

References $sql.

Referenced by Execute(), and PrepareSP().

ADOConnection.PrepareSP ( sql,
param = true 
)

Some databases, eg. mssql require a different function for preparing stored procedures. So we cannot use Prepare().

Should prepare the stored procedure and return the stmt resource. For databases that do not support this, we return the $sql. To ensure compatibility with databases that do not support prepare:

Parameters:
sql SQL to send to database
Returns:
return FALSE, or the prepared statement, or the original sql if if the database does not support prepare.

Definition at line 548 of file adodb.inc.php.

References $sql, and Prepare().

Here is the call graph for this function:

ADOConnection.Quote ( s  ) 

PEAR DB Compat

Definition at line 556 of file adodb.inc.php.

References $s, and qstr().

Referenced by ADODB_SAPDB.MetaColumnNames(), ADODB_SAPDB.MetaColumns(), ADODB_SAPDB.MetaIndexes(), and ADODB_SAPDB.MetaPrimaryKeys().

Here is the call graph for this function:

ADOConnection.QMagic ( s  ) 

Requested by "Karsten Dambekalns" <k.dambekalns@fishfarm.de>

Definition at line 564 of file adodb.inc.php.

References $s, and qstr().

Here is the call graph for this function:

ADOConnection.q ( &$  s  ) 

Definition at line 569 of file adodb.inc.php.

References $s, and qstr().

Here is the call graph for this function:

ADOConnection.ErrorNative (  ) 

PEAR DB Compat - do not use internally.

Definition at line 578 of file adodb.inc.php.

References ErrorNo().

Here is the call graph for this function:

ADOConnection.nextId ( seq_name  ) 

PEAR DB Compat - do not use internally.

Definition at line 587 of file adodb.inc.php.

References GenID().

Here is the call graph for this function:

ADOConnection.RowLock ( table,
where 
)

Lock a row, will escalate and lock the table if row locking not supported will normally free the lock at the end of the transaction

Parameters:
$table name of table to lock
$where where clause to use, eg: "WHERE row=12". If left empty, will escalate to table lock

Definition at line 599 of file adodb.inc.php.

ADOConnection.CommitLock ( table  ) 

Definition at line 604 of file adodb.inc.php.

References CommitTrans().

Here is the call graph for this function:

ADOConnection.RollbackLock ( table  ) 

Definition at line 609 of file adodb.inc.php.

References RollbackTrans().

Here is the call graph for this function:

ADOConnection.SetFetchMode ( mode  ) 

& ADOConnection.Query ( sql,
inputarr = false 
)

PEAR DB Compat - do not use internally.

Definition at line 639 of file adodb.inc.php.

References $rs, $sql, ADODB_PEAR_Error(), and Execute().

Here is the call graph for this function:

& ADOConnection.LimitQuery ( sql,
offset,
count,
params = false 
)

PEAR DB Compat - do not use internally

Definition at line 650 of file adodb.inc.php.

References $rs, $sql, ADODB_PEAR_Error(), and SelectLimit().

Here is the call graph for this function:

ADOConnection.Disconnect (  ) 

PEAR DB Compat - do not use internally

Definition at line 661 of file adodb.inc.php.

References Close().

Here is the call graph for this function:

ADOConnection.Param ( name,
type = 'C' 
)