Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

(no description)

File Size: 5102 lines (139 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 9 files
 lib/adodb/adodb-csvlib.inc.php
 lib/adodb/toexport.inc.php
 lib/adodb/adodb-perf.inc.php
 lib/adodb/adodb-lib.inc.php
 lib/adodb/adodb-active-record.inc.php
 lib/adodb/adodb-datadict.inc.php
 lib/adodb/adodb-memcache.lib.inc.php
 lib/adodb/adodb-error.inc.php
 lib/adodb/adodb-time.inc.php

Defines 9 classes

ADOFieldObject:: (3 methods):
  _adodb_safedate()
  _adodb_safedateq()
  ADODB_TransMonitor()

ADODB_Cache_File:: (8 methods):
  __construct()
  writecache()
  readcache()
  flushall()
  flushcache()
  getdirname()
  createdir()
  _dirFlush()

ADOConnection:: (122 methods):
  setConnectionParameter()
  Version()
  ServerInfo()
  IsConnected()
  _findvers()
  outp()
  Time()
  parseHostNameAndPort()
  Connect()
  _nconnect()
  NConnect()
  PConnect()
  outp_throw()
  _CreateCache()
  SQLDate()
  Prepare()
  PrepareSP()
  Quote()
  QMagic()
  q()
  ErrorNative()
  nextId()
  RowLock()
  CommitLock()
  RollbackLock()
  SetFetchMode()
  Query()
  LimitQuery()
  Disconnect()
  Param()
  InParameter()
  OutParameter()
  Parameter()
  IgnoreErrors()
  StartTrans()
  CompleteTrans()
  FailTrans()
  HasFailedTrans()
  Execute()
  _Execute()
  CreateSequence()
  DropSequence()
  GenID()
  Insert_ID()
  PO_Insert_ID()
  Affected_Rows()
  ErrorMsg()
  ErrorNo()
  MetaError()
  MetaErrorMsg()
  MetaPrimaryKeys()
  MetaForeignKeys()
  SelectDB()
  SelectLimit()
  SerializableRS()
  _rs2rs()
  GetAll()
  GetAssoc()
  CacheGetAssoc()
  GetOne()
  GetMedian()
  CacheGetOne()
  GetCol()
  CacheGetCol()
  Transpose()
  OffsetDate()
  GetArray()
  CacheGetAll()
  CacheGetArray()
  GetRandRow()
  GetRow()
  CacheGetRow()
  Replace()
  CacheSelectLimit()
  CacheFlush()
  _gencachename()
  CacheExecute()
  AutoExecute()
  GetUpdateSQL()
  GetInsertSQL()
  UpdateBlob()
  UpdateBlobFile()
  BlobDecode()
  BlobEncode()
  GetCharSet()
  SetCharSet()
  IfNull()
  LogSQL()
  UpdateClob()
  MetaType()
  SetDateLocale()
  GetActiveRecordsClass()
  GetActiveRecords()
  Close()
  BeginTrans()
  SetTransactionMode()
  MetaTransaction()
  CommitTrans()
  RollbackTrans()
  MetaDatabases()
  MetaProcedures()
  MetaTables()
  _findschema()
  MetaColumns()
  MetaIndexes()
  MetaColumnNames()
  Concat()
  DBDate()
  BindDate()
  BindTimeStamp()
  DBTimeStamp()
  UnixDate()
  UnixTimeStamp()
  UserDate()
  UserTimeStamp()
  escape()
  addq()
  qstr()
  PageExecute()
  CachePageExecute()
  resetLastError()
  getChangedErrorMsg()

ADOFetchObj:: (0 methods):

ADODB_Iterator_empty:: (8 methods):
  __construct()
  rewind()
  valid()
  key()
  current()
  next()
  __call()
  hasMore()

ADORecordSet_empty:: (17 methods):
  RowCount()
  RecordCount()
  PO_RecordCount()
  Close()
  FetchRow()
  FieldCount()
  Init()
  getIterator()
  GetAssoc()
  GetArray()
  GetAll()
  GetArrayLimit()
  GetRows()
  GetRowAssoc()
  MaxRecordCount()
  NumRows()
  NumCols()

ADODB_Iterator:: (8 methods):
  __construct()
  rewind()
  valid()
  key()
  current()
  next()
  __call()
  hasMore()

ADORecordSet:: (53 methods):
  __construct()
  __destruct()
  getIterator()
  __toString()
  Init()
  getMenu()
  getMenuGrouped()
  getMenu2()
  getMenu3()
  GetArray()
  GetAll()
  NextRecordSet()
  GetArrayLimit()
  GetRows()
  GetAssoc()
  UserTimeStamp()
  UserDate()
  UnixDate()
  UnixTimeStamp()
  Free()
  NumRows()
  NumCols()
  FetchRow()
  FetchInto()
  MoveFirst()
  MoveLast()
  MoveNext()
  Move()
  Fields()
  AssocCaseConvertFunction()
  GetAssocKeys()
  GetRowAssoc()
  Close()
  RecordCount()
  MaxRecordCount()
  RowCount()
  PO_RecordCount()
  CurrentRow()
  AbsolutePosition()
  FieldCount()
  FetchField()
  FieldTypesArray()
  FetchObj()
  FetchObject()
  FetchNextObj()
  FetchNextObject()
  MetaType()
  _updatefields()
  _close()
  AbsolutePage()
  AtFirstPage()
  LastPageNo()
  AtLastPage()

ADORecordSet_array:: (21 methods):
  __construct()
  _transpose()
  InitArray()
  InitArrayFields()
  GetArray()
  _initrs()
  Fields()
  FetchField()
  _seek()
  MoveNext()
  _fetch()
  _close()
  ADOLoadDB()
  ADOLoadCode()
  NewADOConnection()
  ADONewConnection()
  _adodb_getdriver()
  NewPerfMonitor()
  NewDataDictionary()
  adodb_pr()
  adodb_backtrace()

Defines 21 functions


Class: ADOFieldObject  - X-Ref

Helper class for FetchFields -- holds info on a column

_adodb_safedate($s)   X-Ref
No description

_adodb_safedateq($s)   X-Ref
No description

ADODB_TransMonitor($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection)   X-Ref
No description

Class: ADODB_Cache_File  - X-Ref

__construct()   X-Ref
No description

writecache($filename, $contents, $debug, $secs2cache)   X-Ref
No description

readcache($filename, &$err, $secs2cache, $rsClass)   X-Ref
No description

flushall($debug=false)   X-Ref
No description

flushcache($f, $debug=false)   X-Ref
No description

getdirname($hash)   X-Ref
No description

createdir($hash, $debug)   X-Ref
No description

_dirFlush($dir, $kill_top_level = false)   X-Ref
Private function to erase all of the files and subdirectories in a directory.

Just specify the directory, and tell it if you want to delete the directory or just clear it out.
Note: $kill_top_level is used internally in the function to flush subdirectories.

Class: ADOConnection  - X-Ref

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

setConnectionParameter($parameter,$value)   X-Ref
Adds a parameter to the connection string.

These parameters are added to the connection string when connecting,
if the driver is coded to use it.

param: string    $parameter    The name of the parameter to set
param: string    $value        The value of the parameter
return: null

Version()   X-Ref
No description

ServerInfo()   X-Ref
No description

IsConnected()   X-Ref
No description

_findvers($str)   X-Ref
No description

outp($msg,$newline=true)   X-Ref
All error messages go through this bottleneck function.
You can define your own handler by defining the function name in ADODB_OUTP.


Time()   X-Ref
No description

parseHostNameAndPort()   X-Ref
Parses the hostname to extract the port.
Overwrites $this->host and $this->port, only if a port is specified.
The Hostname can be fully or partially qualified,
ie: "db.mydomain.com:5432" or "ldaps://ldap.mydomain.com:636"
Any specified scheme such as ldap:// or ldaps:// is maintained.


Connect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "", $forceNew = false)   X-Ref
Connect to database

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

_nconnect($argHostname, $argUsername, $argPassword, $argDatabaseName)   X-Ref
No description

NConnect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "")   X-Ref
Always force a new connection to database - currently only works with oracle

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

PConnect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "")   X-Ref
Establish persistent connect to database

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

outp_throw($msg,$src='WARN',$sql='')   X-Ref
No description

_CreateCache()   X-Ref
No description

SQLDate($fmt, $col=false)   X-Ref
No description

Prepare($sql)   X-Ref
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');

param: sql    SQL to send to database
return: return FALSE, or the prepared statement, or the original sql if

PrepareSP($sql,$param=true)   X-Ref
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:

param: sql    SQL to send to database
return: return FALSE, or the prepared statement, or the original sql if

Quote($s)   X-Ref
PEAR DB Compat


QMagic($s)   X-Ref
Requested by "Karsten Dambekalns" <k.dambekalns@fishfarm.de>


q(&$s)   X-Ref
No description

ErrorNative()   X-Ref
PEAR DB Compat - do not use internally.


nextId($seq_name)   X-Ref
PEAR DB Compat - do not use internally.


RowLock($table,$where,$col='1 as adodbignore')   X-Ref
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

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

CommitLock($table)   X-Ref
No description

RollbackLock($table)   X-Ref
No description

SetFetchMode($mode)   X-Ref
PEAR DB Compat - do not use internally.

The fetch modes for NUMERIC and ASSOC for PEAR DB and ADODB are identical
for easy porting :-)

param: mode    The fetchmode ADODB_FETCH_ASSOC or ADODB_FETCH_NUM
returns: The previous fetch mode

Query($sql, $inputarr=false)   X-Ref
PEAR DB Compat - do not use internally.


LimitQuery($sql, $offset, $count, $params=false)   X-Ref
PEAR DB Compat - do not use internally


Disconnect()   X-Ref
PEAR DB Compat - do not use internally


Param($name,$type='C')   X-Ref
Returns a placeholder for query parameters
e.g. $DB->Param('a') will return
- '?' for most databases
- ':a' for Oracle
- '$1', '$2', etc. for PostgreSQL

param: string $name parameter's name, false to force a reset of the
param: string $type (unused)
return: string query parameter placeholder

InParameter(&$stmt,&$var,$name,$maxLen=4000,$type=false)   X-Ref
No description

OutParameter(&$stmt,&$var,$name,$maxLen=4000,$type=false)   X-Ref
No description

Parameter(&$stmt,&$var,$name,$isOutput=false,$maxLen=4000,$type=false)   X-Ref
No description

IgnoreErrors($saveErrs=false)   X-Ref
No description

StartTrans($errfn = 'ADODB_TransMonitor')   X-Ref
Improved method of initiating a transaction. Used together with CompleteTrans().
Advantages include:

a. StartTrans/CompleteTrans is nestable, unlike BeginTrans/CommitTrans/RollbackTrans.
Only the outermost block is treated as a transaction.<br>
b. CompleteTrans auto-detects SQL errors, and will rollback on errors, commit otherwise.<br>
c. All BeginTrans/CommitTrans/RollbackTrans inside a StartTrans/CompleteTrans block
are disabled, making it backward compatible.

CompleteTrans($autoComplete = true)   X-Ref
No description

FailTrans()   X-Ref
No description

HasFailedTrans()   X-Ref
No description

Execute($sql,$inputarr=false)   X-Ref
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

_Execute($sql,$inputarr=false)   X-Ref
No description

CreateSequence($seqname='adodbseq',$startID=1)   X-Ref
No description

DropSequence($seqname='adodbseq')   X-Ref
No description

GenID($seqname='adodbseq',$startID=1)   X-Ref
Generates a sequence id and stores it in $this->genID;
GenID is only available if $this->hasGenID = true;

param: seqname        name of sequence to use
param: startID        if sequence does not exist, start at this ID
return: 0 if not supported, otherwise a sequence id

Insert_ID($table='',$column='')   X-Ref

param: $table string name of the table, not needed by all databases (eg. mysql), default ''
param: $column string name of the column, not needed by all databases (eg. mysql), default ''
return: the last inserted ID. Not all databases support this.

PO_Insert_ID($table="", $id="")   X-Ref
Portable Insert ID. Pablo Roca <pabloroca#mvps.org>

return: the last inserted ID. All databases support this. But aware possible

Affected_Rows()   X-Ref

return: # rows affected by UPDATE/DELETE

ErrorMsg()   X-Ref

return: the last error message

ErrorNo()   X-Ref

return: the last error number. Normally 0 means no error.

MetaError($err=false)   X-Ref
No description

MetaErrorMsg($errno)   X-Ref
No description

MetaPrimaryKeys($table, $owner=false)   X-Ref

returns: an array with the primary key columns in it.

MetaForeignKeys($table, $owner=false, $upper=false)   X-Ref

returns: assoc array where keys are tables, and values are foreign keys

SelectDB($dbName)   X-Ref
Choose a database to connect to. Many databases do not support this.

param: dbName is the name of the database to select
return: true or false

SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)   X-Ref
Will select, getting rows from $offset (1-based), for $nrows.
This simulates the MySQL "select * from table limit $offset,$nrows" , and
the PostgreSQL "select * from table limit $nrows offset $offset". Note that
MySQL and PostgreSQL parameter ordering is the opposite of the other.
eg.
SelectLimit('select * from table',3); will return rows 1 to 3 (1-based)
SelectLimit('select * from table',3,2); will return rows 3 to 5 (1-based)

Uses SELECT TOP for Microsoft databases (when $this->hasTop is set)
BUG: Currently SelectLimit fails with $sql with LIMIT or TOP clause already set

param: sql
param: [offset]    is the row to start calculations from (1-based)
param: [nrows]        is the number of rows to get
param: [inputarr]    array of bind variables
param: [secs2cache]        is a private parameter only used by jlim
return: the recordset ($rs->databaseType == 'array')

SerializableRS(&$rs)   X-Ref
Create serializable recordset. Breaks rs link to connection.

param: rs            the recordset to serialize

_rs2rs(&$rs,$nrows=-1,$offset=-1,$close=true)   X-Ref
Convert database recordset to an array recordset
input recordset's cursor should be at beginning, and
old $rs will be closed.

param: rs            the recordset to copy
param: [nrows]    number of rows to retrieve (optional)
param: [offset]    offset by number of rows (optional)
return: the new recordset

GetAll($sql, $inputarr=false)   X-Ref
No description

GetAssoc($sql, $inputarr=false,$force_array = false, $first2cols = false)   X-Ref
No description

CacheGetAssoc($secs2cache, $sql=false, $inputarr=false,$force_array = false, $first2cols = false)   X-Ref
No description

GetOne($sql,$inputarr=false)   X-Ref
Return first element of first row of sql statement. Recordset is disposed
for you.

param: sql            SQL statement
param: [inputarr]        input bind array

GetMedian($table, $field,$where = '')   X-Ref
No description

CacheGetOne($secs2cache,$sql=false,$inputarr=false)   X-Ref
No description

GetCol($sql, $inputarr = false, $trim = false)   X-Ref
No description

CacheGetCol($secs, $sql = false, $inputarr = false,$trim=false)   X-Ref
No description

Transpose(&$rs,$addfieldnames=true)   X-Ref
No description

OffsetDate($dayFraction,$date=false)   X-Ref
No description

GetArray($sql,$inputarr=false)   X-Ref

param: sql            SQL statement
param: [inputarr]        input bind array

CacheGetAll($secs2cache,$sql=false,$inputarr=false)   X-Ref
No description

CacheGetArray($secs2cache,$sql=false,$inputarr=false)   X-Ref
No description

GetRandRow($sql, $arr= false)   X-Ref
No description

GetRow($sql,$inputarr=false)   X-Ref
Return one row of sql statement. Recordset is disposed for you.
Note that SelectLimit should not be called.

param: sql            SQL statement
param: [inputarr]        input bind array

CacheGetRow($secs2cache,$sql=false,$inputarr=false)   X-Ref
No description

Replace($table, $fieldArray, $keyCol, $autoQuote=false, $has_autoinc=false)   X-Ref
Insert or replace a single record. Note: this is not the same as MySQL's replace.
ADOdb's Replace() uses update-insert semantics, not insert-delete-duplicates of MySQL.
Also note that no table locking is done currently, so it is possible that the
record be inserted twice by two programs...

$this->Replace('products', array('prodname' =>"'Nails'","price" => 3.99), 'prodname');

$table        table name
$fieldArray    associative array of data (you must quote strings yourself).
$keyCol        the primary key field name or if compound key, array of field names
autoQuote        set to true to use a hueristic to quote strings. Works with nulls and numbers
but does not work with dates nor SQL functions.
has_autoinc    the primary key is an auto-inc field, so skip in insert.

Currently blob replace not supported

returns 0 = fail, 1 = update, 2 = insert

CacheSelectLimit($secs2cache,$sql,$nrows=-1,$offset=-1,$inputarr=false)   X-Ref
Will select, getting rows from $offset (1-based), for $nrows.
This simulates the MySQL "select * from table limit $offset,$nrows" , and
the PostgreSQL "select * from table limit $nrows offset $offset". Note that
MySQL and PostgreSQL parameter ordering is the opposite of the other.
eg.
CacheSelectLimit(15,'select * from table',3); will return rows 1 to 3 (1-based)
CacheSelectLimit(15,'select * from table',3,2); will return rows 3 to 5 (1-based)

BUG: Currently CacheSelectLimit fails with $sql with LIMIT or TOP clause already set

param: [secs2cache]    seconds to cache data, set to 0 to force query. This is optional
param: sql
param: [offset]    is the row to start calculations from (1-based)
param: [nrows]    is the number of rows to get
param: [inputarr]    array of bind variables
return: the recordset ($rs->databaseType == 'array')

CacheFlush($sql=false,$inputarr=false)   X-Ref
Flush cached recordsets that match a particular $sql statement.
If $sql == false, then we purge all files in the cache.


_gencachename($sql,$createdir)   X-Ref
Private function to generate filename for caching.
Filename is generated based on:

- sql statement
- database type (oci8, ibase, ifx, etc)
- database name
- userid
- setFetchMode (adodb 4.23)

When not in safe mode, we create 256 sub-directories in the cache directory ($ADODB_CACHE_DIR).
Assuming that we can have 50,000 files per directory with good performance,
then we can scale to 12.8 million unique cached recordsets. Wow!

CacheExecute($secs2cache,$sql=false,$inputarr=false)   X-Ref
Execute SQL, caching recordsets.

param: [secs2cache]    seconds to cache data, set to 0 to force query.
param: sql        SQL statement to execute
param: [inputarr]    holds the input data  to bind to
return: RecordSet or false

AutoExecute($table, $fields_values, $mode = 'INSERT', $where = false, $forceUpdate = true, $magicq = false)   X-Ref
No description

GetUpdateSQL(&$rs, $arrFields,$forceUpdate=false,$magicq=false,$force=null)   X-Ref
Generates an Update Query based on an existing recordset.
$arrFields is an associative array of fields with the value
that should be assigned.

Note: This function should only be used on a recordset
that is run against a single table and sql should only
be a simple select stmt with no groupby/orderby/limit

"Jonathan Younger" <jyounger@unilab.com>

GetInsertSQL(&$rs, $arrFields,$magicq=false,$force=null)   X-Ref
Generates an Insert Query based on an existing recordset.
$arrFields is an associative array of fields with the value
that should be assigned.

Note: This function should only be used on a recordset
that is run against a single table.

UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')   X-Ref
Update a blob column, given a where clause. There are more sophisticated
blob handling functions that we could have implemented, but all require
a very complex API. Instead we have chosen something that is extremely
simple to understand and use.

Note: $blobtype supports 'BLOB' and 'CLOB', default is BLOB of course.

Usage to update a $blobvalue which has a primary key blob_id=1 into a
field blobtable.blobcolumn:

UpdateBlob('blobtable', 'blobcolumn', $blobvalue, 'blob_id=1');

Insert example:

$conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
$conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');

UpdateBlobFile($table,$column,$path,$where,$blobtype='BLOB')   X-Ref
Usage:
UpdateBlob('TABLE', 'COLUMN', '/path/to/file', 'ID=1');

$blobtype supports 'BLOB' and 'CLOB'

$conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
$conn->UpdateBlob('blobtable','blobcol',$blobpath,'id=1');

BlobDecode($blob)   X-Ref
No description

BlobEncode($blob)   X-Ref
No description

GetCharSet()   X-Ref
No description

SetCharSet($charset)   X-Ref
No description

IfNull( $field, $ifNull )   X-Ref
No description

LogSQL($enable=true)   X-Ref
No description

UpdateClob($table,$column,$val,$where)   X-Ref
Usage:
UpdateClob('TABLE', 'COLUMN', $var, 'ID=1', 'CLOB');

$conn->Execute('INSERT INTO clobtable (id, clobcol) VALUES (1, null)');
$conn->UpdateClob('clobtable','clobcol',$clob,'id=1');

MetaType($t,$len=-1,$fieldobj=false)   X-Ref
No description

SetDateLocale($locale = 'En')   X-Ref
Change the SQL connection locale to a specified locale.
This is used to get the date formats written depending on the client locale.


GetActiveRecordsClass($class, $table,$whereOrderBy=false,$bindarr=false, $primkeyArr=false,$extra=array()   X-Ref
GetActiveRecordsClass Performs an 'ALL' query

param: mixed $class This string represents the class of the current active record
param: mixed $table Table used by the active record object
param: mixed $whereOrderBy Where, order, by clauses
param: mixed $bindarr
param: mixed $primkeyArr
param: array $extra Query extras: limit, offset...
param: mixed $relations Associative array: table's foreign name, "hasMany", "belongsTo"
return: void

GetActiveRecords($table,$where=false,$bindarr=false,$primkeyArr=false)   X-Ref
No description

Close()   X-Ref
Close Connection


BeginTrans()   X-Ref
Begin a Transaction. Must be followed by CommitTrans() or RollbackTrans().

return: true if succeeded or false if database does not support transactions

SetTransactionMode( $transaction_mode )   X-Ref
No description

MetaTransaction($mode,$db)   X-Ref
No description

CommitTrans($ok=true)   X-Ref
If database does not support transactions, always return true as data always commited

param: $ok  set to false to rollback transaction, true to commit
return: true/false.

RollbackTrans()   X-Ref
If database does not support transactions, rollbacks always fail, so return false

return: true/false.

MetaDatabases()   X-Ref
return the databases that the driver can connect to.
Some databases will return an empty array.

return: an array of database names.

MetaProcedures($procedureNamePattern = null, $catalog = null, $schemaPattern = null)   X-Ref
List procedures or functions in an array.

param: procedureNamePattern  a procedure name pattern; must match the procedure name as it is stored in the database
param: catalog a catalog name; must match the catalog name as it is stored in the database;
param: schemaPattern a schema name pattern;
return: array of procedures on current database.

MetaTables($ttype=false,$showSchema=false,$mask=false)   X-Ref

param: ttype can either be 'VIEW' or 'TABLE' or false.
param: showSchema returns the schema/user with the table name, eg. USER.TABLE
param: mask  is the input mask - only supported by oci8 and postgresql
return: array of tables for current database.

_findschema(&$table,&$schema)   X-Ref
No description

MetaColumns($table,$normalize=true)   X-Ref
List columns in a database as an array of ADOFieldObjects.
See top of file for definition of object.

param: $table    table name to query
param: $normalize    makes table name case-insensitive (required by some databases)
return: array of ADOFieldObjects for current table.

MetaIndexes($table, $primary = false, $owner = false)   X-Ref
List indexes on a table as an array.

param: table  table name to query
param: primary true to only show primary keys. Not actually used for most databases
return: array of indexes on current table. Each element represents an index, and is itself an associative array.

MetaColumnNames($table, $numIndexes=false,$useattnum=false )   X-Ref
List columns names in a table as an array.

param: table    table name to query
return: array of column names for current table.

Concat()   X-Ref
Different SQL databases used different methods to combine strings together.
This function provides a wrapper.

param s    variable number of string parameters

Usage: $db->Concat($str1,$str2);

return: concatenated string

DBDate($d, $isfld=false)   X-Ref
Converts a date "d" to a string that the database can understand.

param: d    a date in Unix date time format.
return: date string in database date format

BindDate($d)   X-Ref
No description

BindTimeStamp($d)   X-Ref
No description

DBTimeStamp($ts,$isfld=false)   X-Ref
Converts a timestamp "ts" to a string that the database can understand.

param: ts    a timestamp in Unix date time format.
return: timestamp string in database timestamp format

UnixDate($v)   X-Ref
Also in ADORecordSet.

param: $v is a date string in YYYY-MM-DD format
return: date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format

UnixTimeStamp($v)   X-Ref
Also in ADORecordSet.

param: $v is a timestamp string in YYYY-MM-DD HH-NN-SS format
return: date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format

UserDate($v,$fmt='Y-m-d',$gmt=false)   X-Ref
Also in ADORecordSet.

Format database date based on user defined format.

param: v        is the character date in YYYY-MM-DD format, returned by database
param: fmt    is the format to apply to it, using date()
return: a date formated as user desires

UserTimeStamp($v,$fmt='Y-m-d H:i:s',$gmt=false)   X-Ref

param: v        is the character timestamp in YYYY-MM-DD hh:mm:ss format
param: fmt    is the format to apply to it, using date()
return: a timestamp formated as user desires

escape($s,$magic_quotes=false)   X-Ref
No description

addq($s,$magic_quotes=false)   X-Ref
Quotes a string, without prefixing nor appending quotes.


qstr($s,$magic_quotes=false)   X-Ref
Correctly quotes a string so that all strings are escaped. We prefix and append
to the string single-quotes.
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().
return: quoted string to be sent back to database

PageExecute($sql, $nrows, $page, $inputarr=false, $secs2cache=0)   X-Ref
Will select the supplied $page number from a recordset, given that it is paginated in pages of
$nrows rows per page. It also saves two boolean values saying if the given page is the first
and/or last one of the recordset. Added by Iván Oliva to provide recordset pagination.

See docs-adodb.htm#ex8 for an example of usage.

param: sql
param: nrows        is the number of rows per page to get
param: page        is the page number to get (1-based)
param: [inputarr]    array of bind variables
param: [secs2cache]        is a private parameter only used by jlim
return: the recordset ($rs->databaseType == 'array')

CachePageExecute($secs2cache, $sql, $nrows, $page,$inputarr=false)   X-Ref
Will select the supplied $page number from a recordset, given that it is paginated in pages of
$nrows rows per page. It also saves two boolean values saying if the given page is the first
and/or last one of the recordset. Added by Iván Oliva to provide recordset pagination.

param: secs2cache    seconds to cache data, set to 0 to force query
param: sql
param: nrows        is the number of rows per page to get
param: page        is the page number to get (1-based)
param: [inputarr]    array of bind variables
return: the recordset ($rs->databaseType == 'array')

resetLastError()   X-Ref
Get the last error recorded by PHP and clear the message.

By clearing the message, it becomes possible to detect whether a new error
has occurred, even when it is the same error as before being repeated.

return: array|null Array if an error has previously occurred. Null otherwise.

getChangedErrorMsg($old = null)   X-Ref
Compare a previously stored error message with the last error recorded by PHP
to determine whether a new error has occured.

param: array|null $old Optional. Previously stored return value of error_get_last().
return: string The error message if a new error has occured

Class: ADOFetchObj  - X-Ref

Internal placeholder for record objects. Used by ADORecordSet->FetchObj().

Class: ADODB_Iterator_empty  - X-Ref

__construct($rs)   X-Ref
No description

rewind()   X-Ref
No description

valid()   X-Ref
No description

key()   X-Ref
No description

current()   X-Ref
No description

next()   X-Ref
No description

__call($func, $params)   X-Ref
No description

hasMore()   X-Ref
No description

Class: ADORecordSet_empty  - X-Ref

Lightweight recordset when there are no records to be returned

RowCount()   X-Ref
No description

RecordCount()   X-Ref
No description

PO_RecordCount()   X-Ref
No description

Close()   X-Ref
No description

FetchRow()   X-Ref
No description

FieldCount()   X-Ref
No description

Init()   X-Ref
No description

getIterator()   X-Ref
No description

GetAssoc()   X-Ref
No description

GetArray()   X-Ref
No description

GetAll()   X-Ref
No description

GetArrayLimit()   X-Ref
No description

GetRows()   X-Ref
No description

GetRowAssoc()   X-Ref
No description

MaxRecordCount()   X-Ref
No description

NumRows()   X-Ref
No description

NumCols()   X-Ref
No description

Class: ADODB_Iterator  - X-Ref

__construct($rs)   X-Ref
No description

rewind()   X-Ref
No description

valid()   X-Ref
No description

key()   X-Ref
No description

current()   X-Ref
No description

next()   X-Ref
No description

__call($func, $params)   X-Ref
No description

hasMore()   X-Ref
No description

Class: ADORecordSet  - X-Ref

RecordSet class that represents the dataset returned by the database.
To keep memory overhead low, this class holds only the current row in memory.
No prefetching of data is done, so the RecordCount() can return -1 ( which
means recordcount not known).

__construct($queryID)   X-Ref
Constructor

param: queryID    this is the queryID returned by ADOConnection->_query()

__destruct()   X-Ref
No description

getIterator()   X-Ref
No description

__toString()   X-Ref
No description

Init()   X-Ref
No description

getMenu($name, $defstr = '', $blank1stItem = true, $multiple = false,$size = 0, $selectAttr = '', $compareFirstCol = true)   X-Ref
Generate a SELECT tag from a recordset, and return the HTML markup.

If the recordset has 2 columns, we treat the first one as the text to
display to the user, and the second as the return value. Extra columns
are discarded.

param: string       $name            Name of SELECT tag
param: string|array $defstr          The value to highlight. Use an array for multiple highlight values.
param: bool|string $blank1stItem     True to create an empty item (default), False not to add one;
param: bool         $multiple        True for multi-select list
param: int          $size            Number of rows to show (applies to multi-select box only)
param: string       $selectAttr      Additional attributes to defined for SELECT tag,
param: bool         $compareFirstCol When true (default), $defstr is compared against the value (column 2),
return: string HTML

getMenuGrouped($name, $defstr = '', $blank1stItem = true, $multiple = false,$size = 0, $selectAttr = '', $compareFirstCol = true)   X-Ref
Generate a SELECT tag with groups from a recordset, and return the HTML markup.

The recordset must have 3 columns and be ordered by the 3rd column. The
first column contains the text to display to the user, the second is the
return value and the third is the option group. Extra columns are discarded.
Default strings are compared with the SECOND column.

param: string       $name            Name of SELECT tag
param: string|array $defstr          The value to highlight. Use an array for multiple highlight values.
param: bool|string $blank1stItem     True to create an empty item (default), False not to add one;
param: bool         $multiple        True for multi-select list
param: int          $size            Number of rows to show (applies to multi-select box only)
param: string       $selectAttr      Additional attributes to defined for SELECT tag,
param: bool         $compareFirstCol When true (default), $defstr is compared against the value (column 2),
return: string HTML

getMenu2($name, $defstr = '', $blank1stItem = true, $multiple = false,$size = 0, $selectAttr = '')   X-Ref
Generate a SELECT tag from a recordset, and return the HTML markup.

Same as GetMenu(), except that default strings are compared with the
FIRST column (the description).

param: string       $name            Name of SELECT tag
param: string|array $defstr          The value to highlight. Use an array for multiple highlight values.
param: bool|string $blank1stItem     True to create an empty item (default), False not to add one;
param: bool         $multiple        True for multi-select list
param: int          $size            Number of rows to show (applies to multi-select box only)
param: string       $selectAttr      Additional attributes to defined for SELECT tag,
return: string HTML

getMenu3($name, $defstr = '', $blank1stItem = true, $multiple = false,$size = 0, $selectAttr = '')   X-Ref
Generate a SELECT tag with groups from a recordset, and return the HTML markup.

Same as GetMenuGrouped(), except that default strings are compared with the
FIRST column (the description).

param: string       $name            Name of SELECT tag
param: string|array $defstr          The value to highlight. Use an array for multiple highlight values.
param: bool|string $blank1stItem     True to create an empty item (default), False not to add one;
param: bool         $multiple        True for multi-select list
param: int          $size            Number of rows to show (applies to multi-select box only)
param: string       $selectAttr      Additional attributes to defined for SELECT tag,
return: string HTML

GetArray($nRows = -1)   X-Ref
return recordset as a 2-dimensional array.

param: [nRows]  is the number of rows to return. -1 means every row.
return: an array indexed by the rows (0-based) from the recordset

GetAll($nRows = -1)   X-Ref
No description

NextRecordSet()   X-Ref
No description

GetArrayLimit($nrows,$offset=-1)   X-Ref
return recordset as a 2-dimensional array.
Helper function for ADOConnection->SelectLimit()

param: offset    is the row to start calculations from (1-based)
param: [nrows]    is the number of rows to return
return: an array indexed by the rows (0-based) from the recordset

GetRows($nRows = -1)   X-Ref
Synonym for GetArray() for compatibility with ADO.

param: [nRows]  is the number of rows to return. -1 means every row.
return: an array indexed by the rows (0-based) from the recordset

GetAssoc($force_array = false, $first2cols = false)   X-Ref
return whole recordset as a 2-dimensional associative array if there are more than 2 columns.
The first column is treated as the key and is not included in the array.
If there is only 2 columns, it will return a 1 dimensional array of key-value pairs unless
$force_array == true.

param: [force_array] has only meaning if we have 2 data columns. If false, a 1 dimensional
param: [first2cols] means if there are more than 2 cols, ignore the remaining cols and
return: an associative array indexed by the first column of the array,

UserTimeStamp($v,$fmt='Y-m-d H:i:s')   X-Ref

param: v        is the character timestamp in YYYY-MM-DD hh:mm:ss format
param: fmt    is the format to apply to it, using date()
return: a timestamp formated as user desires

UserDate($v,$fmt='Y-m-d')   X-Ref

param: v        is the character date in YYYY-MM-DD format, returned by database
param: fmt    is the format to apply to it, using date()
return: a date formated as user desires

UnixDate($v)   X-Ref

param: $v is a date string in YYYY-MM-DD format
return: date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format

UnixTimeStamp($v)   X-Ref

param: $v is a timestamp string in YYYY-MM-DD HH-NN-SS format
return: date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format

Free()   X-Ref
PEAR DB Compat - do not use internally


NumRows()   X-Ref
PEAR DB compat, number of rows


NumCols()   X-Ref
PEAR DB compat, number of cols


FetchRow()   X-Ref
Fetch a row, returning false if no more rows.
This is PEAR DB compat mode.

return: false or array containing the current record

FetchInto(&$arr)   X-Ref
Fetch a row, returning PEAR_Error if no more rows.
This is PEAR DB compat mode.

return: DB_OK or error object

MoveFirst()   X-Ref
Move to the first row in the recordset. Many databases do NOT support this.

return: true or false

MoveLast()   X-Ref
Move to the last row in the recordset.

return: true or false

MoveNext()   X-Ref
Move to next record in the recordset.

return: true if there still rows available, or false if there are no more rows (EOF).

Move($rowNumber = 0)   X-Ref
Random access to a specific row in the recordset. Some databases do not support
access to previous rows in the databases (no scrolling backwards).

param: rowNumber is the row to move to (0-based)
return: true if there still rows available, or false if there are no more rows (EOF).

Fields($colname)   X-Ref
Get the value of a field in the current row by column name.
Will not work if ADODB_FETCH_MODE is set to ADODB_FETCH_NUM.

param: colname  is the field to access
return: the value of $colname column

AssocCaseConvertFunction($case = ADODB_ASSOC_CASE)   X-Ref
Defines the function to use for table fields case conversion
depending on ADODB_ASSOC_CASE

return: string strtolower/strtoupper or false if no conversion needed

GetAssocKeys($upper = ADODB_ASSOC_CASE)   X-Ref
Builds the bind array associating keys to recordset fields

param: int $upper Case for the array keys, defaults to uppercase

GetRowAssoc($upper = ADODB_ASSOC_CASE)   X-Ref
Use associative array to get fields array for databases that do not support
associative arrays. Submitted by Paolo S. Asioli paolo.asioli#libero.it

param: int $upper Case for the array keys, defaults to uppercase

Close()   X-Ref
Clean up recordset

return: true or false

RecordCount()   X-Ref
synonyms RecordCount and RowCount

return: the number of rows or -1 if this is not supported

MaxRecordCount()   X-Ref
No description

RowCount()   X-Ref
synonyms RecordCount and RowCount

return: the number of rows or -1 if this is not supported

PO_RecordCount($table="", $condition="")   X-Ref
Portable RecordCount. Pablo Roca <pabloroca@mvps.org>

return: the number of records from a previous SELECT. All databases support this.

CurrentRow()   X-Ref

return: the current row in the recordset. If at EOF, will return the last row. 0-based.

AbsolutePosition()   X-Ref
synonym for CurrentRow -- for ADO compat

return: the current row in the recordset. If at EOF, will return the last row. 0-based.

FieldCount()   X-Ref

return: the number of columns in the recordset. Some databases will set this to 0

FetchField($fieldoffset = -1)   X-Ref
Get the ADOFieldObject of a specific column.

param: fieldoffset    is the column position to access(0-based).
return: the ADOFieldObject for that column, or false.

FieldTypesArray()   X-Ref
Get the ADOFieldObjects of all columns in an array.


FetchObj()   X-Ref
Return the fields array of the current row as an object for convenience.
The default case is lowercase field names.

return: the object with the properties set to the fields of the current row

FetchObject($isupper=true)   X-Ref
Return the fields array of the current row as an object for convenience.
The default case is uppercase.

param: $isupper to set the object property names to uppercase
return: the object with the properties set to the fields of the current row

FetchNextObj()   X-Ref
Return the fields array of the current row as an object for convenience.
The default is lower-case field names.

return: the object with the properties set to the fields of the current row,

FetchNextObject($isupper=true)   X-Ref
Return the fields array of the current row as an object for convenience.
The default is upper case field names.

param: $isupper to set the object property names to uppercase
return: the object with the properties set to the fields of the current row,

MetaType($t,$len=-1,$fieldobj=false)   X-Ref
Get the metatype of the column. This is used for formatting. This is because
many databases use different names for the same type, so we transform the original
type to our standardised version which uses 1 character codes:

param: t  is the type passed in. Normally is ADOFieldObject->type.
param: len is the maximum length of that field. This is because we treat character
param: fieldobj is the field object returned by the database driver. Can hold
return: the general type of the data:

_updatefields()   X-Ref
Convert case of field names associative array, if needed

return: void

_close()   X-Ref
No description

AbsolutePage($page=-1)   X-Ref
set/returns the current recordset page when paginating


AtFirstPage($status=false)   X-Ref
set/returns the status of the atFirstPage flag when paginating


LastPageNo($page = false)   X-Ref
No description

AtLastPage($status=false)   X-Ref
set/returns the status of the atLastPage flag when paginating


Class: ADORecordSet_array  - X-Ref

This class encapsulates the concept of a recordset created in memory
as an array. This is useful for the creation of cached recordsets.

Note that the constructor is different from the standard ADORecordSet
__construct($fakeid=1)   X-Ref
Constructor


_transpose($addfieldnames=true)   X-Ref
No description

InitArray($array,$typearr,$colnames=false)   X-Ref
Setup the array.

param: array        is a 2-dimensional array holding the data.
param: typearr    holds an array of types. These are the same types
param: [colnames]    array of column names. If set, then the first row of

InitArrayFields(&$array,&$fieldarr)   X-Ref
Setup the Array and datatype file objects

param: array        is a 2-dimensional array holding the data.
param: fieldarr    holds an array of ADOFieldObject's.

GetArray($nRows=-1)   X-Ref
No description

_initrs()   X-Ref
No description

Fields($colname)   X-Ref
No description

FetchField($fieldOffset = -1)   X-Ref
No description

_seek($row)   X-Ref
No description

MoveNext()   X-Ref
No description

_fetch()   X-Ref
No description

_close()   X-Ref
No description

ADOLoadDB($dbType)   X-Ref
Synonym for ADOLoadCode. Private function. Do not use.


ADOLoadCode($dbType)   X-Ref
Load the code for a specific database driver. Private function. Do not use.


NewADOConnection($db='')   X-Ref
synonym for ADONewConnection for people like me who cannot remember the correct name


ADONewConnection($db='')   X-Ref
Instantiate a new Connection class for a specific database driver.

param: [db]  is the database Connection object to create. If undefined,
return: the freshly created instance of the Connection class.

_adodb_getdriver($provider,$drivername,$perf=false)   X-Ref
No description

NewPerfMonitor(&$conn)   X-Ref
No description

NewDataDictionary(&$conn,$drivername=false)   X-Ref
No description

adodb_pr($var,$as_string=false)   X-Ref
No description

adodb_backtrace($printOrArr=true,$levels=9999,$ishtml=null)   X-Ref
No description

Functions that are not part of a class:

ADODB_str_replace($src, $dest, $data)   X-Ref
No description

ADODB_Setup()   X-Ref
No description