Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

ADOdb Library main include file. This file is part of ADOdb, a Database Abstraction Layer library for PHP.

Copyright: 2000-2013 John Lim
Copyright: 2014 Damien Regad, Mark Newnham and the ADOdb community
License: BSD-3-Clause
License: LGPL-2.1-or-later
File Size: 5795 lines (155 kb)
Included or required: 4 times
Referenced: 0 times
Includes or requires: 9 files
 lib/adodb/adodb-lib.inc.php
 lib/adodb/adodb-datadict.inc.php
 lib/adodb/adodb-perf.inc.php
 lib/adodb/toexport.inc.php
 lib/adodb/adodb-time.inc.php
 lib/adodb/adodb-active-record.inc.php
 lib/adodb/adodb-memcache.lib.inc.php
 lib/adodb/adodb-error.inc.php
 lib/adodb/adodb-csvlib.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:: (132 methods):
  __construct()
  setConnectionParameter()
  Version()
  setCustomMetaType()
  getCustomMetaTypes()
  ServerInfo()
  IsConnected()
  _findvers()
  outp()
  Time()
  parseHostNameAndPort()
  Connect()
  _nconnect()
  NConnect()
  PConnect()
  outp_throw()
  _CreateCache()
  SQLDate()
  Prepare()
  releaseStatement()
  PrepareSP()
  Quote()
  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()
  enableLastInsertID()
  _insertID()
  PO_Insert_ID()
  Affected_Rows()
  ErrorMsg()
  ErrorNo()
  MetaError()
  MetaErrorMsg()
  MetaPrimaryKeys()
  metaForeignKeys()
  SelectDB()
  SelectLimit()
  SerializableRS()
  _rs2rs()
  GetAll()
  GetAssoc()
  CacheGetAssoc()
  GetOne()
  GetMedian()
  CacheGetOne()
  GetCol()
  CacheGetCol()
  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()
  charMax()
  textMax()
  substr()
  month()
  day()
  year()
  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:: (56 methods):
  __construct()
  __destruct()
  getIterator()
  __toString()
  Init()
  _initRS()
  _fetch()
  getMenu()
  getMenuGrouped()
  getMenu2()
  getMenu3()
  GetArray()
  GetAll()
  NextRecordSet()
  getArrayLimit()
  getRows()
  getAssoc()
  UserTimeStamp()
  UserDate()
  UnixDate()
  UnixTimeStamp()
  Free()
  NumRows()
  NumCols()
  FetchRow()
  FetchInto()
  MoveFirst()
  MoveLast()
  MoveNext()
  Move()
  _seek()
  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:: (20 methods):
  __construct()
  InitArray()
  InitArrayFields()
  GetArray()
  _initrs()
  Fields()
  FetchField()
  _seek()
  MoveNext()
  _fetch()
  _close()
  ADOLoadDB()
  ADOLoadCode()
  NewADOConnection()
  ADONewConnection()
  _adodb_getdriver()
  NewPerfMonitor()
  newDataDictionary()
  adodb_pr()
  adodb_backtrace()

Defines 20 functions

  ADODB_Setup()

Class: ADOFieldObject  - X-Ref

Helper class for FetchFields -- holds info on a column

_adodb_safedate($s)   X-Ref
Parse date string to prevent injection attack.

param: string $s
return: string

_adodb_safedateq($s)   X-Ref
Parse date string to prevent injection attack.
Date string will have one quote at beginning e.g. '3434343'

param: string $s
return: string

ADODB_TransMonitor($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection)   X-Ref
For transaction handling.

param: $dbms
param: $fn
param: $errno
param: $errmsg
param: $p1
param: $p2
param: $thisConnection

Class: ADODB_Cache_File  - X-Ref

Class ADODB_Cache_File

__construct()   X-Ref
No description

writecache($filename, $contents, $debug, $secs2cache)   X-Ref
Write serialised RecordSet to cache item/file.

param: $filename
param: $contents
param: $debug
param: $secs2cache
return: bool|int

readcache($filename, &$err, $secs2cache, $rsClass)   X-Ref
load serialised RecordSet and unserialise it

param: $filename
param: $err
param: $secs2cache
param: $rsClass
return: ADORecordSet

flushall($debug=false)   X-Ref
Flush all items in cache.

param: bool $debug
return: bool|void

flushcache($f, $debug=false)   X-Ref
Flush one file in cache.

param: string $f
param: bool   $debug

getdirname($hash)   X-Ref

param: string $hash
return: string

createdir($hash, $debug)   X-Ref
Create temp directories.

param: string $hash
param: bool   $debug
return: string

_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.

__construct()   X-Ref
Default Constructor.
We define it even though it does not actually do anything. This avoids
getting a PHP Fatal error:  Cannot call constructor if a subclass tries
to call its parent constructor.


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

Parameters must be added before the connection is established;
they are then passed on to the connect statement, which will.
process them if the driver supports this feature.

Example usage:
- mssqlnative: setConnectionParameter('CharacterSet','UTF-8');
- mysqli: setConnectionParameter(MYSQLI_SET_CHARSET_NAME,'utf8mb4');

If used in a portable environment, parameters set in this manner should
be predicated on the database provider, as unexpected results may occur
if applied to the wrong database.

param: string $parameter The name of the parameter to set
param: string $value     The value of the parameter
return: bool True if success, false otherwise (e.g. parameter is not valid)

Version()   X-Ref
ADOdb version.

return: string

setCustomMetaType($metaType,$dictionaryType,$actualType,$handleAsType=false,$callback=false)   X-Ref
Set a custom meta type with a corresponding actual

param: string    $metaType    The Custom ADOdb metatype
param: string    $dictionaryType    The database dictionary type
param: string    $actualType    The database actual type
param: bool    $handleAsType handle like an existing Metatype
param: mixed    $callBack A pre-processing function
return: bool success if the actual exists

getCustomMetaTypes()   X-Ref
Get a list of custom meta types.

return: string[]

ServerInfo()   X-Ref
Get server version info.

return: string[] Array with 2 string elements: version and description

IsConnected()   X-Ref
Return true if connected to the database.

return: bool

_findvers($str)   X-Ref
Find version string.

param: string $str
return: string

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.

param: string $msg     Message to print
param: bool   $newline True to add a newline after printing $msg

Time()   X-Ref
Return the database server's current date and time.

return: int|false

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: string $argHostname     Host to connect to
param: string $argUsername     Userid to login
param: string $argPassword     Associated password
param: string $argDatabaseName Database name
param: bool   $forceNew        Force new connection
return: bool

_nconnect($argHostname, $argUsername, $argPassword, $argDatabaseName)   X-Ref
Always force a new connection to database.

param: string $argHostname     Host to connect to
param: string $argUsername     Userid to login
param: string $argPassword     Associated password
param: string $argDatabaseName Database name
return: bool

NConnect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "")   X-Ref
Always force a new connection to database.

Currently this only works with Oracle.

param: string $argHostname     Host to connect to
param: string $argUsername     Userid to login
param: string $argPassword     Associated password
param: string $argDatabaseName Database name
return: bool

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

param: string $argHostname     Host to connect to
param: string $argUsername     Userid to login
param: string $argPassword     Associated password
param: string $argDatabaseName Database name
return: bool

outp_throw($msg, $src='WARN', $sql='')   X-Ref
Throw an exception if the handler is defined or prints the message if not.

param: string $msg Message
param: string $src the name of the calling function (in uppercase)
param: string $sql Optional offending SQL statement

_CreateCache()   X-Ref
Create cache class.

Code is backwards-compatible with old memcache implementation.

SQLDate($fmt, $col = '')   X-Ref
Format date column in sql string.

See https://adodb.org/dokuwiki/doku.php?id=v5:reference:connection:sqldate
for documentation on supported formats.

param: string $fmt Format string
param: string $col Date column; use system date if not specified.
return: string

Prepare($sql)   X-Ref
Prepare an SQL statement and return the statement resource.

For databases that do not support prepared statements, we return the
provided SQL statement as-is, to ensure compatibility:

$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: string $sql SQL to send to database
return: mixed|false The prepared statement, or the original sql if the

releaseStatement(&$stmt)   X-Ref
Releases a previously prepared statement.

param: mixed $stmt Statement resource, as returned by {@see prepare()}
return: bool

PrepareSP($sql,$param=true)   X-Ref
Prepare a Stored Procedure and return the statement resource.

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

For databases that do not support this, we return the $sql.

param: string $sql   SQL to send to database
param: bool   $param
return: mixed|false The prepared statement, or the original sql if the

Quote($s)   X-Ref
PEAR DB Compat - alias for qStr.

param: $s
return: string

q(&$s)   X-Ref
Quotes a string so that all strings are escaped.
Wrapper for qstr with magic_quotes = false.

param: string &$s

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

return: int

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

param: string $seq_name
return: int

RowLock($table,$where,$col='1 as adodbignore')   X-Ref
Lock a row.
Will escalate and lock the table if row locking is not supported.
Will normally free the lock at the end of the transaction.

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

CommitLock($table)   X-Ref

param: string $table
return: true

RollbackLock($table)   X-Ref

param: string $table
return: true

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: int $mode The fetchmode ADODB_FETCH_ASSOC or ADODB_FETCH_NUM
return: int Previous fetch mode

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

param: string     $sql
param: array|bool $inputarr
return: ADORecordSet|bool

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: mixed $name parameter's name.
param: string $type (unused)
return: string query parameter placeholder

InParameter(&$stmt, &$var, $name, $maxLen=4000, $type=false)   X-Ref
Self-documenting version of Parameter().

param: $stmt
param: &$var
param: $name
param: int $maxLen
param: bool $type
return: bool

OutParameter(&$stmt,&$var,$name,$maxLen=4000,$type=false)   X-Ref
Self-documenting version of Parameter().

param: $stmt
param: $var
param: $name
param: int $maxLen
param: bool $type
return: bool

Parameter(&$stmt,&$var,$name,$isOutput=false,$maxLen=4000,$type=false)   X-Ref
Usage in oracle
$stmt = $db->Prepare('select * from table where id =:myid and group=:group');
$db->Parameter($stmt,$id,'myid');
$db->Parameter($stmt,$group,'group',64);
$db->Execute();

param: mixed &$stmt Statement returned by Prepare() or PrepareSP().
param: mixed &$var PHP variable to bind to
param: string $name Name of stored procedure variable name to bind to.
param: int|bool $isOutput Indicates direction of parameter 0/false=IN  1=OUT  2= IN/OUT. This is ignored in oci8.
param: int $maxLen Holds an maximum length of the variable.
param: mixed $type The data type of $var. Legal values depend on driver.
return: bool

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
Complete a transation.

Used together with StartTrans() to end a transaction. Monitors connection
for sql errors, and will commit or rollback as appropriate.

param: bool autoComplete if true, monitor sql errors and commit and
returns: true on commit, false on rollback.

FailTrans()   X-Ref
At the end of a StartTrans/CompleteTrans block, perform a rollback.


HasFailedTrans()   X-Ref
Check if transaction has failed, only for Smart Transactions.


Execute($sql, $inputarr = false)   X-Ref
Execute SQL

param: string     $sql      SQL statement to execute, or possibly an array
param: array|bool $inputarr holds the input data to bind to.
return: ADORecordSet|bool

_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: string $seqname Name of sequence to use
param: int    $startID If sequence does not exist, start at this ID
return: int Sequence id, 0 if not supported

Insert_ID($table='',$column='')   X-Ref
Returns the last inserted ID.

Not all databases support this feature. Some do not require to specify
table or column name (e.g. MySQL).

param: string $table  Table name, default ''
param: string $column Column name, default ''
return: int The last inserted ID.

enableLastInsertID($enable = true)   X-Ref
Enable or disable the Last Insert Id functionality.

If the Driver supports it, this function allows setting {@see $hasInsertID}.

param: bool $enable False to disable

_insertID($table = '', $column = '')   X-Ref
Return the id of the last row that has been inserted in a table.

param: string $table
param: string $column
return: int|false

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

param: string $table
param: string $id
return: mixed The last inserted ID. All databases support this, but be

Affected_Rows()   X-Ref

return: int|false Number of rows affected by UPDATE/DELETE

ErrorMsg()   X-Ref

return: string the last error message

ErrorNo()   X-Ref

return: int 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 = '', $upper = false, $associative = false)   X-Ref
Returns a list of Foreign Keys associated with a specific table.

If there are no foreign keys then the function returns false.

param: string $table       The name of the table to get the foreign keys for.
param: string $owner       Table owner/schema.
param: bool   $upper       If true, only matches the table with the uppercase name.
param: bool   $associative Returns the result in associative mode;
return: string[]|false An 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: string $dbName the name of the database to select
return: bool

SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)   X-Ref
Select a limited number of rows.

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: string     $sql
param: int        $offset     Row to start calculations from (1-based)
param: int        $nrows      Number of rows to get
param: array|bool $inputarr   Array of bind variables
param: int        $secs2cache Private parameter only used by jlim
return: ADORecordSet The recordset ($rs->databaseType == 'array')

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

param: ADORecordSet $rs the recordset to serialize
return: ADORecordSet_array|bool the new recordset

_rs2rs(&$rs,$nrows=-1,$offset=-1,$close=true)   X-Ref
Convert a database recordset to an array recordset.

Input recordset's cursor should be at beginning, and old $rs will be closed.

param: ADORecordSet $rs     the recordset to copy
param: int          $nrows  number of rows to retrieve (optional)
param: int          $offset offset by number of rows (optional)
param: bool         $close
return: ADORecordSet_array|ADORecordSet|bool the new recordset

GetAll($sql, $inputarr=false)   X-Ref
Return all rows.

Compat with PEAR DB.

param: string     $sql      SQL statement
param: array|bool $inputarr Input bind array
return: array|false

GetAssoc($sql, $inputarr = false, $force_array = false, $first2cols = false)   X-Ref
Execute statement and return rows in an array.

The function executes a statement and returns all of the returned rows in
an array, or false if the statement execution fails or if only 1 column
is requested in the SQL statement.
If no records match the provided SQL statement, an empty array is returned.

param: string     $sql         SQL statement
param: array|bool $inputarr    input bind array
param: bool       $force_array
param: bool       $first2cols
return: array|bool

CacheGetAssoc($secs2cache, $sql = false, $inputarr = false,$force_array = false, $first2cols = false)   X-Ref
Search for the results of an executed query in the cache.

param: int $secs2cache
param: string|bool $sql         SQL statement
param: array|bool  $inputarr    input bind array
param: bool        $force_array
param: bool        $first2cols
return: false|array

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

param: string        $sql        SQL statement
param: array|bool    $inputarr    input bind array
return: mixed

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
Executes a statement and returns each row's first column in an array.

param: string     $sql      SQL statement
param: array|bool $inputarr input bind array
param: bool       $trim     enables space trimming of the returned value.
return: array|bool 1D array containning the first row of the query

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

OffsetDate($dayFraction,$date=false)   X-Ref
Calculate the offset of a date for a particular database
and generate appropriate SQL.

Useful for calculating future/past dates and storing in a database.

param: double       $dayFraction 1.5 means 1.5 days from now, 1.0/24 for 1 hour
param: string|false $date        Reference date, false for system time
return: string

GetArray($sql,$inputarr=false)   X-Ref
Executes a statement and returns a the entire recordset in an array.

param: string     $sql      SQL statement
param: array|bool $inputarr input bind array
return: array|false

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: string     $sql      SQL statement
param: array|bool $inputarr input bind array
return: array|false Array containing the first row of the query

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

param: int $secs2cache
param: string|false $sql
param: mixed[]|bool $inputarr
return: mixed[]|bool

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 heuristic 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: int    $secs2cache Seconds to cache data, set to 0 to force query. This is optional
param: string $sql
param: int    $offset     Row to start calculations from (1-based)
param: int    $nrows      Number of rows to get
param: array $inputarr    Array of bind variables
return: ADORecordSet 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: int         $secs2cache Seconds to cache data, set to 0 to force query.
param: string|bool $sql        SQL statement to execute
param: array|bool  $inputarr   Holds the input data to bind
return: ADORecordSet RecordSet or false

AutoExecute($table, $fields_values, $mode = 'INSERT', $where = false, $forceUpdate = true, $magic_quotes = false)   X-Ref
Similar to PEAR DB's autoExecute(), except that $mode can be 'INSERT'
or 'UPDATE' or DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE.
If $mode == 'UPDATE', then $where is compulsory as a safety measure.

param: $table
param: $fields_values
param: string $mode
param: false $where
param: bool $forceUpdate  If true, perform update even if the data has not changed.
param: bool $magic_quotes This param is not used since 5.21.0.
return: bool

GetUpdateSQL(&$rs, $arrFields, $forceUpdate=false, $magic_quotes=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
param: $rs
param: $arrFields
param: bool $forceUpdate
param: bool $magic_quotes This param is not used since 5.21.0.
param: null $force
author: "Jonathan Younger" <jyounger@unilab.com>
return: false|string

GetInsertSQL(&$rs, $arrFields, $magic_quotes=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.

param: $rs
param: $arrFields
param: bool $magic_quotes This param is not used since 5.21.0.
param: null $force
return: false|string

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.

Sample usage:
- update a BLOB in field table.blob_col with value $blobValue, for a
record having primary key id=1
$conn->updateBlob('table', 'blob_col', $blobValue, 'id=1');
- insert example:
$conn->execute('INSERT INTO table (id, blob_col) VALUES (1, null)');
$conn->updateBlob('table', 'blob_col', $blobValue, 'id=1');

param: string $table
param: string $column
param: string $val      Filename containing blob data
param: mixed  $where    {@see updateBlob()}
param: string $blobtype supports 'BLOB' (default) and 'CLOB'
return: bool success

updateBlobFile($table, $column, $path, $where, $blobtype='BLOB')   X-Ref
Update a BLOB from a file.

Usage example:
$conn->updateBlobFile('table', 'blob_col', '/path/to/file', 'id=1');

param: string $table
param: string $column
param: string $path     Filename containing blob data
param: mixed  $where    {@see updateBlob()}
param: string $blobtype supports 'BLOB' and 'CLOB'
return: bool success

BlobDecode($blob)   X-Ref
No description

BlobEncode($blob)   X-Ref
No description

getCharSet()   X-Ref
Retrieve the client connection's current character set.

return: string|false The character set, or false if it can't be determined.

setCharSet($charset)   X-Ref
Sets the client-side character set.

This is only supported for some databases.
param: string $charset The character set to switch to.
return: bool True if the character set was changed successfully, false otherwise.

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: bool 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
Commits a transaction.

If database does not support transactions, return true as data is
always committed.

param: bool $ok True to commit, false to rollback the transaction.
return: bool true if successful

RollbackTrans()   X-Ref
Rolls back a transaction.

If database does not support transactions, return false as rollbacks
always fail.

return: bool true if successful

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

return: array|bool 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
Concatenate strings.

Different SQL databases used different methods to combine strings together.
This function provides a wrapper.

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

param: string $s Variable number of string parameters
return: string concatenated string

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

param: mixed $d a date in Unix date time format.
return: string 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: int|object $ts A timestamp in Unix date time format.
return: string $timestamp string in database timestamp format

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

param: mixed $v is a date string in YYYY-MM-DD format
return: int|false 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: string|object $v is a timestamp string in YYYY-MM-DD HH-NN-SS format
return: int|false 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
Format database date based on user defined format.

Also in ADORecordSet.

param: mixed  $v    Date in YYYY-MM-DD format, returned by database
param: string $fmt  Format to apply, using date()
param: bool   $gmt
return: string Formatted date

UserTimeStamp($v,$fmt='Y-m-d H:i:s',$gmt=false)   X-Ref
Format timestamp based on user defined format.

param: mixed  $v    Date in YYYY-MM-DD hh:mm:ss format
param: string $fmt  Format to apply, using date()
param: bool   $gmt
return: string Formatted timestamp

escape($s,$magic_quotes=false)   X-Ref
Alias for addQ()

param: string $s
param: bool [$magic_quotes]
return: mixed

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

param: string $s            The string to quote
param: bool   $magic_quotes This param is not used since 5.21.0.
return: string Quoted string

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");

param: string $s            The string to quote
param: bool   $magic_quotes This param is not used since 5.21.0.
return: string 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.
NOTE: phpLens uses a different algorithm and does not use PageExecute().

param: string $sql
param: int    $nrows          Number of rows per page to get
param: int    $page           Page number to get (1-based)
param: mixed[]|bool $inputarr Array of bind variables
param: int    $secs2cache     Private parameter only used by jlim
return: mixed        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: int $secs2cache    seconds to cache data, set to 0 to force query
param: string $sql
param: int $nrows        is the number of rows per page to get
param: int $page        is the page number to get (1-based)
param: mixed[]|bool $inputarr    array of bind variables
return: mixed    the recordset ($rs->databaseType == 'array')

charMax()   X-Ref
Returns the maximum size of a MetaType C field. If the method
is not defined in the driver returns ADODB_STRINGMAX_NOTSET

return: int

textMax()   X-Ref
Returns the maximum size of a MetaType X field. If the method
is not defined in the driver returns ADODB_STRINGMAX_NOTSET

return: int

substr($fld,$start,$length=0)   X-Ref
Returns a substring of a varchar type field

Some databases have variations of the parameters, which is why
we have an ADOdb function for it

param: string    $fld    The field to sub-string
param: int        $start    The start point
param: int        $length    An optional length
return: string    The SQL text

month($fld)   X-Ref
No description

day($fld)   X-Ref
No description

year($fld)   X-Ref
No description

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: mixed[]|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 occurred.

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

Class: ADOFetchObj  - X-Ref

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

Class: ADODB_Iterator_empty  - X-Ref

Class ADODB_Iterator_empty

__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

Class ADODB_Iterator

__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,$mode=false)   X-Ref
Constructor

param: resource|int $queryID Query ID returned by ADOConnection->_query()
param: int|bool     $mode    The ADODB_FETCH_MODE value

__destruct()   X-Ref
No description

getIterator()   X-Ref
No description

__toString()   X-Ref
No description

Init()   X-Ref
No description

_initRS()   X-Ref
Recordset initialization stub


_fetch()   X-Ref
Row fetch stub

return: bool

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: int $nRows  Number of rows to return. -1 means every row.
return: array indexed by the rows (0-based) from the recordset

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

NextRecordSet()   X-Ref
Checks if there is another available recordset.

Some databases allow multiple recordsets to be returned.

return: boolean true if there is a next recordset, or false if no more

getArrayLimit($nrows, $offset=-1)   X-Ref
Return recordset as a 2-dimensional array.

Helper function for ADOConnection->SelectLimit()

param: int $nrows  Number of rows to return
param: int $offset Starting row (1-based)
return: array an array indexed by the rows (0-based) from the recordset

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

param: int $nRows Number of rows to return. -1 means every row.
return: array 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. This recordset method is currently part of
the API, but may not be in later versions of ADOdb. By preference, use
ADOconnnection::getAssoc()

param: bool    $force_array    (optional) Has only meaning if we have 2 data
param: bool    $first2cols     (optional) Means if there are more than
return: mixed[]|false

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

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

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

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

UnixDate($v)   X-Ref

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

UnixTimeStamp($v)   X-Ref

param: string|object $v is a timestamp string in YYYY-MM-DD HH-NN-SS format
return: mixed 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

return: int

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

return: int

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

return: mixed[]|false 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.

param: mixed[]|false $arr
return: mixed DB_OK or error object

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

return: bool true or false

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

return: bool true or false

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

return: bool 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: int $rowNumber is the row to move to (0-based)
return: bool true if there still rows available, or false if there are no more rows (EOF).

_seek($row)   X-Ref
Adjusts the result pointer to an arbitrary row in the result.

param: int $row The row to seek to.
return: bool False if the recordset contains no rows, otherwise true.

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: string $colname is the field to access
return: mixed 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

param: int [$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
return: array

Close()   X-Ref
Clean up recordset

return: bool

recordCount()   X-Ref
Number of rows in recordset.

return: int Number of rows or -1 if this is not supported

MaxRecordCount()   X-Ref
If we are using PageExecute(), this will return the maximum possible rows
that can be returned when paging a recordset.

return: int

rowCount()   X-Ref
Number of rows in recordset.
Alias for {@see recordCount()}

return: int Number of rows or -1 if this is not supported

PO_RecordCount($table="", $condition="")   X-Ref
Portable RecordCount.

Be aware of possible problems in multiuser environments.
For better speed the table must be indexed by the condition.
Heavy test this before deploying.

param: string $table
param: string $condition
author: Pablo Roca <pabloroca@mvps.org>
return: int 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)   X-Ref
Get a Field's metadata from database.

Must be defined by child class.

param: int $fieldOffset
return: ADOFieldObject|false

fieldTypesArray()   X-Ref
Get Field metadata for all the recordset's columns in an array.

return: ADOFieldObject[]

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: bool $isUpper to set the object property names to uppercase
return: ADOFetchObj The object with 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: ADOFetchObj|false The object with 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: bool $isUpper to set the object property names to uppercase
return: ADOFetchObj|false The object with properties set to the fields of the current row

metaType($t, $len = -1, $fieldObj = false)   X-Ref
Get the ADOdb metatype.

Many databases use different names for the same type, so we transform
the native type to our standardised one, which uses 1 character codes.
param: string|ADOFieldObject $t  Native type (usually ADOFieldObject->type)
param: int $len The field's maximum length. This is because we treat
param: ADOFieldObject $fieldObj Field object returned by the database driver;
return: string The ADOdb Standard type

_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

param: int $page
return: int

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

param: bool $status
return: bool

LastPageNo($page = false)   X-Ref

param: bool $page
return: bool

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

param: bool $status
return: bool

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($queryID, $mode=false)   X-Ref
Constructor

The parameters passed to this recordset are always fake because
this class does not use the queryID

param: resource|int $queryID Ignored
param: int|bool     $mode    The ADODB_FETCH_MODE value

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: string[]|false [$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 $array    2-dimensional array holding the data
param: array $fieldarr Array of ADOFieldObject's.

GetArray($nRows=-1)   X-Ref

param: int [$nRows]
return: array

_initrs()   X-Ref
No description

Fields($colname)   X-Ref
Use associative array to get fields array

param: string $colname
return: mixed

FetchField($fieldOffset = -1)   X-Ref

param: int [$fieldOffset]
return: \ADOFieldObject

_seek($row)   X-Ref

param: int $row
return: bool

MoveNext()   X-Ref

return: bool

_fetch()   X-Ref

return: bool

_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

param: string [$db]
return: ADOConnection|false

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

param: string $db Database Connection object to create. If undefined,
return: ADOConnection|false 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='')   X-Ref
Get a new Data Dictionary object for the connection.

param: ADOConnection $conn
param: string        $drivername
return: ADODB_DataDict|false

adodb_pr($var,$as_string=false)   X-Ref
Perform a print_r, with pre tags for better formatting.


adodb_backtrace($printOrArr=true,$levels=9999,$ishtml=null)   X-Ref
Perform a stack-crawl and pretty print it.

param: bool  $printOrArr Pass in a boolean to indicate print, or an $exception->trace array (assumes that print is true then).
param: int   $levels     Number of levels to display
param: mixed $ishtml
return: string

Functions that are not part of a class:

ADODB_Setup()   X-Ref
No description