Table of Contents

Reference Manual

ADOdb6 Reference Guide

See the Feature Comparison Matrix

Class Variables

The following items are set inside the ADOConnectionDefinitions class

$countRecords In database drivers that do not support native recordset counting, controls whether to emulate the functionality
$forceType Changes the behavior of empty and null field handling when updating or creating records
$fetchMode Sets the global array type (numeric or associative) for returned recordsets
$getOneEOF Sets the returned value if a valid SQL statement does not match any record when the method getOne() is executed.
$language Sets the language for error messages
$quoteFieldNames Quotes, and optionally controls the casing of field name in constructed SQL statements
$assocCase Controls the case-specifity of recordset keys returned as associative arrays
$defaultMetaType Controls the default value returned if an unknown data type is tested

The Database Connection Object

Establishing Connections

The ADOConnection Class Create a new connection object
connect() Establishes a non-persistent connection with a database
isConnected() Indicates if a connection has been established
nConnect() Forces the establishment of a new connection with a database
pConnect() Establishes a persistent connection with a database
selectDb() Select which database to connect to
close() Closes a database connection

Working With Cached Recordsets

ADOdb supports the ability to work with cached query results via the use of memory based cache servers. All of the core record retrieval methods work the same as their non-caching equivalents, but also check for the availability of cached results first. This can help reduce database load.

Memcached Setup Configuring a memcached server connection
cacheFlush() Flushes a cached result set

Executing SQL

autoExecute() Automatically prepares and executes Insert and Update statements based on supplied parameters
execute() Executes a provided SQL statement and returns a handle to the result
getAll() Executes a provided SQL statement and returns the entire recordset into an array
getAssoc() Executes a provided SQL statement and returns the entire recordset into an associatitive array with the value of the first column as a key
getCol() Executes a provided SQL statement and returns the first column of each row of he entire recordset into an array
getMedian() Returns the median value of a column in a table
getOne() Retrieves the first column of the first matching row of an executed SQL statement
getRow() Retrieves the first matching row of an executed SQL statement
replace() Provides a simple single record replacement function
selectLimit Executes a provided SQL statement and returns a handle to the result, with the ability to supply a starting offset and record count

Prepared Statements

inParameter() Sets an input parameter to a stored procedure
outParameter() Receives an output parameter from a stored procedure
param() Returns a database specific parameter placeholder
prepare() Prepares an SQL statement and returns a handle to use
prepareSp() Access a stored procedure and returns a handle to the procedure

Generating Database Independent SQL strings

addQ() Quotes a string, without prefixing nor appending quotes
charMax() Returns the largest length of data that can be inserted into a character field
concat() Returns a database-specific concatenation of strings
getUpdateSQL() Creates a database-specific SQL UPDATE statement based on supplied parameters
getInsertSQL() Creates a database-specific SQL INSERT statement based on supplied parameters
ifNull() Replaces a null value with a specified replacement
quote() Is a pseudonym for the function qStr
qStr() Appropriately quotes strings with ' characters for insertion into the database
textMax() Returns the largest length of data that can be inserted into a text field

Handling Blobs

blobDecode() Decodes an encoded blob
blobEncode() Encodes a blob field in preparation for database insertion
updateBlob() Updates a blob field in a table using a syntax similar to autoexecute
updateBlobFile() Updates a blob field in a table directly from a disk file using a syntax similar to autoexecute
updateClob() Updates a clob field in a table using a syntax similar to autoexecute

Paging/Scrolling

absolutePage() gets or sets the current page number in a paged recordset
atFirstPage() gets or sets whether at the first page in a paged recordset
atLastPage() gets or sets whether at the last page in a paged recordset
lastPageNo() Returns the page number of the last page in a paged recordset
maxRecordCount() Returns the maximum number of records that can be returned when paging
pageExecute() Returns a requested page from a recordset

Transaction Scoping

See the Transaction Management Guide

beginTrans() Begins a granular transaction
commitTrans() Commits a granular transaction
completeTrans() Completes a smart transaction
failTrans() Forces a smart transaction to fail
hasFailedTrans() Reports if a granular transaction has failed
rollbackTrans() Rollback a smart transaction
setTransactionMode() Sets the isolation level of a transaction.
startTrans() Starts a smart transaction
getTransCnt() Returns the nesting level of smart transactions

Fetching Data

getFetchMode()Get the array type for return data
setFetchMode()Set the array type for return data

Manipulating Dates & Times

bindDate() Creates a portable date field, for use in bind statements
bindTimeStamp() Creates a portable timestamp field, for use in bind statements
dbDate() Creates a portable date field, for use in SQL statements
dbTimeStamp() Creates a portable timestamp field, for use in SQL statements
offsetDate() Creates a portable date offset field, for use in SQL statements
setDateLocale() Changes the SQL connection to a specified Locale
sqlDate() Returns a portably-formatted date string from a timestamp database column
unixDate() Uses the database connection to create date strings
unixTimeStamp() Uses the database connection to create date/time strings

Row Management

affected_rows()Returns the number of rows affected by the last operation
createSequence()Creates a sequence in the database
dropSequence()Drops a sequence in the database
genId()A portable method of creating sequence numbers
insert_id()Returns the last auto-increment number for an SQL statement
rowLock()Lock a table row for a duration of a transaction

Error Handling

errorMsg()Returns a database specific error message
ignoreErrors()Overrides the built-in transaction and error handling status
metaError()Returns a portable error number based on a database specific error
metaErrorMsg()Returns a portable error message based on a portable error number. The language of the message may be controlled by $ADODB_LANG
debugLogMarker() Writes a user defined message into the debug log

Query Rewriting

fnExecute and fnCacheExecute A reference to a function that overrides the execute function

The Recordset Object

Returns one field

fields()Returns a single field in a single row of the current recordset

PEAR Compatibility

This series of functions is designed to duplicate the commands and emulate the functionality provided by the now deprecated PEAR DB module. ADOdb also provides an unsupported PEAR Auth connection plugin in the /adodb/pear/auth directory.

fetchInto() Fetches a recordset into an array
fetchNextObj() Returns the current row as an object for convenience and advances the record pointer
fetchNextObject This is a pseudonym for fetchNextObj
fetchObj() Returns the current row as an object for convenience
fetchObject() This is a pseudonym for fetchObj
fetchRow() Reads a row of a result set and advances the recordset pointer
free() Is a pseudonym for close()
getRowAssoc() Reads a row in associative mode if the recordset fetch mode is numeric
numCols() Returns the number of columns in a row of a returned recordset
numRows() Returns the number of rows in a returned recordset

Returns all rows

getArray()Returns a complete recordset as an array
getAssoc()Returns an associate key/value array, with other options
getRows()This function is a pseudonym for getArray()
getRandRow()Returns a random record from a recordset

Scrolling

move() Move to the nth record of a recordset
moveNext() Moves the cursor to the next record of the recordset from the current position
moveFirst() Moves the cursor to the first record of the recordset
moveLast() Moves to the last record of a recordset
AbsolutePosition() absolutePosition() is a pseudonym for currentRow()
currentRow() Returns the current row number of a recordset
getMenu() Creates a string containing a single or multi select HTML select box
getMenu2() (deprecated) Creates a string containing a basic HTML select box with alternate comparison criteria to getMenu()
getMenu3() Creates a string containing a grouped (optgroup) HTML single or muilti-select box

Dates

$dateLocale Sets a default date and time format for the ADOdb date/time library
unixDate() Uses the DBMS to return a timestamp from a date string
unixTimeStamp() Uses the DBMS to return a timestamp from a date/time string
userDate() Returns a formatted date string for a user supplied timestamp
userTimeStamp() Returns a formatted date/time string for a user supplied timestamp

Recordset Info

nextRecordSet() In databases that allow accessing of recordsets, retrieves the next set
po_recordCount() A Portable record count supported by all databases
recordCount() Interface to the native driver recordCount function
rowCount()Is a synonym for recordCount()

Field Info

fetchField() Returns raw, database specific information about a field
fieldCount() Returns the the number of fields in a row of a recordset
fieldTypesArray() Returns an array of all the ADOFieldObjects columns in a row

Recordset Cleanup

close()Closes both the recordset and database connection