Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 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: | 5535 lines (149 kb) |
Included or required: | 4 times |
Referenced: | 0 times |
Includes or requires: | 9 files lib/adodb/adodb-active-record.inc.php lib/adodb/adodb-csvlib.inc.php lib/adodb/toexport.inc.php lib/adodb/adodb-error.inc.php lib/adodb/adodb-lib.inc.php lib/adodb/adodb-datadict.inc.php lib/adodb/adodb-time.inc.php lib/adodb/adodb-memcache.lib.inc.php lib/adodb/adodb-perf.inc.php |
ADOFieldObject:: (3 methods):
_adodb_safedate()
_adodb_safedateq()
ADODB_TransMonitor()
ADODB_Cache_File:: (8 methods):
__construct()
writecache()
readcache()
flushall()
flushcache()
getdirname()
createdir()
_dirFlush()
ADOConnection:: (130 methods):
__construct()
setConnectionParameter()
Version()
ServerInfo()
IsConnected()
_findvers()
outp()
Time()
parseHostNameAndPort()
Connect()
_nconnect()
NConnect()
PConnect()
outp_throw()
_CreateCache()
SQLDate()
Prepare()
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()
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()
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:: (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()
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.__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. return: bool True if success, false otherwise (e.g. parameter is not valid) param: string $parameter The name of the parameter to set param: string $value The value of the parameter |
Version() X-Ref |
ADOdb version. return: string |
ServerInfo() X-Ref |
Get server version info. return: string[] An array with 2 elements: $arr['string'] is the description string, |
IsConnected() X-Ref |
Return true if connected to the database. return: bool |
_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. 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. return: bool 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 |
_nconnect($argHostname, $argUsername, $argPassword, $argDatabaseName) X-Ref |
No description |
NConnect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "") X-Ref |
Always force a new connection to database. Currently this only works with Oracle. return: bool param: string $argHostname Host to connect to param: string $argUsername Userid to login param: string $argPassword Associated password param: string $argDatabaseName Database name |
PConnect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "") X-Ref |
Establish persistent connection to database. return: bool param: string $argHostname Host to connect to param: string $argUsername Userid to login param: string $argPassword Associated password param: string $argDatabaseName Database name |
outp_throw($msg,$src='WARN',$sql='') X-Ref |
No description |
_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. |
Prepare($sql) X-Ref |
Prepare an sql statement and return the statement 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'); return: mixed|false The prepared statement, or the original sql if the param: string $sql SQL to send to database |
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. return: mixed|false The prepared statement, or the original sql if the param: string $sql SQL to send to database param: bool $param |
Quote($s) X-Ref |
PEAR DB Compat - alias for qStr. return: string param: $s |
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: 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 |
CommitLock($table) X-Ref |
return: true param: string $table |
RollbackLock($table) X-Ref |
return: true param: string $table |
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 :-) return: int Previous fetch mode param: int $mode The fetchmode ADODB_FETCH_ASSOC or ADODB_FETCH_NUM |
Query($sql, $inputarr=false) X-Ref |
PEAR DB Compat - do not use internally. return: ADORecordSet|bool param: string $sql param: array|bool $inputarr |
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 return: string query parameter placeholder param: mixed $name parameter's name. param: string $type (unused) |
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 return: ADORecordSet|bool param: string $sql SQL statement to execute, or possibly an array param: array|bool $inputarr holds the input data to bind to. |
_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; return: int Sequence id, 0 if not supported param: string $seqname Name of sequence to use param: int $startID If sequence does not exist, start at this ID |
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). return: int The last inserted ID. param: string $table Table name, default '' param: string $column Column name, default '' |
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. return: int|false param: string $table param: string $column |
PO_Insert_ID($table="", $id="") X-Ref |
Portable Insert ID. Pablo Roca <pabloroca#mvps.org> return: mixed The last inserted ID. All databases support this, but be param: string $table param: string $id |
Affected_Rows() X-Ref |
return: # 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=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. return: bool param: string $dbName the name of the database to select |
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 return: ADORecordSet The recordset ($rs->databaseType == 'array') 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 |
SerializableRS(&$rs) X-Ref |
Create serializable recordset. Breaks rs link to connection. return: ADORecordSet_array|bool the new recordset param: ADORecordSet $rs the recordset to serialize |
_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. return: ADORecordSet_array|ADORecordSet|bool the new recordset 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 |
GetAll($sql, $inputarr=false) X-Ref |
No description |
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. return: array|bool param: string $sql SQL statement param: array|bool $inputarr input bind array param: bool $force_array param: bool $first2cols |
CacheGetAssoc($secs2cache, $sql = false, $inputarr = false,$force_array = false, $first2cols = false) X-Ref |
Search for the results of an executed query in the cache. return: false|array param: int $secs2cache param: string|bool $sql SQL statement param: array|bool $inputarr input bind array param: bool $force_array param: bool $first2cols |
GetOne($sql, $inputarr=false) X-Ref |
Return first element of first row of sql statement. Recordset is disposed for you. return: mixed param: string $sql SQL statement param: array|bool $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 |
Executes a statement and returns each row's first column in an array. return: array|bool 1D array containning the first row of the query param: string $sql SQL statement param: array|bool $inputarr input bind array param: bool $trim enables space trimming of the returned value. |
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 |
Executes a statement and returns a the entire recordset in an array. return: array|false param: string $sql SQL statement param: array|bool $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. return: array|false Array containing the first row of the query param: string $sql SQL statement param: array|bool $inputarr input bind array |
CacheGetRow($secs2cache,$sql=false,$inputarr=false) X-Ref |
return: mixed[]|bool param: int $secs2cache param: string|false $sql param: mixed[]|bool $inputarr |
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 return: ADORecordSet The recordset ($rs->databaseType == 'array') 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 |
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. return: ADORecordSet RecordSet or false 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 |
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. return: bool 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. |
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 author: "Jonathan Younger" <jyounger@unilab.com> return: false|string param: $rs param: $arrFields param: bool $forceUpdate param: bool $magic_quotes This param is not used since 5.21.0. param: null $force |
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. return: false|string param: $rs param: $arrFields param: bool $magic_quotes This param is not used since 5.21.0. param: null $force |
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 |
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. return: bool True if the character set was changed successfully, false otherwise. param: string $charset The character set to switch to. |
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 return: void 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" |
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 |
If database does not support transactions, always return true as data always committed return: true/false. param: bool $ok set to false to rollback transaction, true to commit |
RollbackTrans() X-Ref |
If database does not support transactions, rollbacks always fail, so return false return: bool |
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. return: array of procedures on current database. 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; |
MetaTables($ttype=false,$showSchema=false,$mask=false) X-Ref |
return: array of tables for current database. 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 |
_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. return: array of ADOFieldObjects for current table. param: $table table name to query param: $normalize makes table name case-insensitive (required by some databases) |
MetaIndexes($table, $primary = false, $owner = false) X-Ref |
List indexes on a table as an array. return: array of indexes on current table. Each element represents an index, and is itself an associative array. param: table table name to query param: primary true to only show primary keys. Not actually used for most databases |
MetaColumnNames($table, $numIndexes=false,$useattnum=false ) X-Ref |
List columns names in a table as an array. return: array of column names for current table. param: table table name to query |
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); return: string concatenated string param: string $s Variable number of string parameters |
DBDate($d, $isfld=false) X-Ref |
Converts a date "d" to a string that the database can understand. return: string date string in database date format param: mixed $d a date in Unix date time 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. return: string $timestamp string in database timestamp format param: int|object $ts A timestamp in Unix date time format. |
UnixDate($v) X-Ref |
Also in ADORecordSet. return: int|false Date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format param: mixed $v is a date string in YYYY-MM-DD format |
UnixTimeStamp($v) X-Ref |
Also in ADORecordSet. return: int|false Date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format param: string|object $v is a timestamp string in YYYY-MM-DD HH-NN-SS format |
UserDate($v,$fmt='Y-m-d',$gmt=false) X-Ref |
Format database date based on user defined format. Also in ADORecordSet. return: string Formatted date param: mixed $v Date in YYYY-MM-DD format, returned by database param: string $fmt Format to apply, using date() param: bool $gmt |
UserTimeStamp($v,$fmt='Y-m-d H:i:s',$gmt=false) X-Ref |
Format timestamp based on user defined format. return: string Formatted timestamp param: mixed $v Date in YYYY-MM-DD hh:mm:ss format param: string $fmt Format to apply, using date() param: bool $gmt |
escape($s,$magic_quotes=false) X-Ref |
Alias for addQ() return: mixed param: string $s param: bool [$magic_quotes] |
addQ($s, $magic_quotes=false) X-Ref |
Quotes a string, without prefixing nor appending quotes. return: string Quoted string param: string $s The string to quote param: bool $magic_quotes This param is not used since 5.21.0. |
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"); return: string Quoted string to be sent back to database param: string $s The string to quote param: bool $magic_quotes This param is not used since 5.21.0. |
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(). return: mixed the recordset ($rs->databaseType == 'array') 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 |
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. return: mixed the recordset ($rs->databaseType == 'array') 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 |
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 return: string The SQL text param: string $fld The field to sub-string param: int $start The start point param: int $length An optional length |
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. return: string The error message if a new error has occurred param: mixed[]|null $old Optional. Previously stored return value of error_get_last(). |
Class: ADOFetchObj - X-Ref
Internal placeholder for record objects. Used by ADORecordSet->FetchObj().Class: ADODB_Iterator_empty - X-Ref
Class: ADORecordSet_empty - X-Ref
Lightweight recordset when there are no records to be returnedRowCount() 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: ADORecordSet - X-Ref
RecordSet class that represents the dataset returned by the database.__construct($queryID) X-Ref |
Constructor param: resource|int 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. return: string HTML 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), |
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. return: string HTML 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), |
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). return: string HTML 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, |
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). return: string HTML 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, |
GetArray($nRows = -1) X-Ref |
return recordset as a 2-dimensional array. return: array indexed by the rows (0-based) from the recordset param: int $nRows Number of rows to return. -1 means every row. |
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() return: array an array indexed by the rows (0-based) from the recordset param: offset is the row to start calculations from (1-based) param: [nrows] is the number of rows to return |
GetRows($nRows = -1) X-Ref |
Synonym for GetArray() for compatibility with ADO. return: array an array indexed by the rows (0-based) from the recordset param: [nRows] is the number of rows to return. -1 means every row. |
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() return: mixed[]|false param: bool $force_array (optional) Has only meaning if we have 2 data param: bool $first2cols (optional) Means if there are more than |
UserTimeStamp($v,$fmt='Y-m-d H:i:s') X-Ref |
return: string a timestamp formated as user desires 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() |
UserDate($v,$fmt='Y-m-d') X-Ref |
return: string a date formatted as user desires 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() |
UnixDate($v) X-Ref |
return: string date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format param: mixed $v is a date string in YYYY-MM-DD format |
UnixTimeStamp($v) X-Ref |
return: mixed date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format param: string|object $v is a timestamp string in YYYY-MM-DD HH-NN-SS 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. return: mixed DB_OK or error object param: mixed[]|false $arr |
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). return: bool true if there still rows available, or false if there are no more rows (EOF). param: int $rowNumber is the row to move to (0-based) |
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. return: mixed the value of $colname column param: string $colname is the field to access |
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 param: int [$case] |
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: bool |
RecordCount() X-Ref |
Synonyms RecordCount and RowCount 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 |
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) X-Ref |
Get a Field's metadata from database. Must be defined by child class. return: ADOFieldObject|false param: int $fieldOffset |
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. return: the object with the properties set to the fields of the current row param: $isupper to set the object property names to uppercase |
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. return: the object with the properties set to the fields of the current row, param: $isupper to set the object property names to uppercase |
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: return: the general type of the data: 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 |
_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__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: 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 |
return: array param: int [$nRows] |
_initrs() X-Ref |
No description |
Fields($colname) X-Ref |
Use associative array to get fields array return: mixed param: string $colname |
FetchField($fieldOffset = -1) X-Ref |
return: \ADOFieldObject param: int [$fieldOffset] |
_seek($row) X-Ref |
return: bool param: int $row |
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 return: ADOConnection|false param: string [$db] |
ADONewConnection($db='') X-Ref |
Instantiate a new Connection class for a specific database driver. return: ADOConnection|false The freshly created instance of the Connection class param: string $db Database Connection object to create. If undefined, |
_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. return: ADODB_DataDict|false param: ADOConnection $conn param: string $drivername |
adodb_pr($var,$as_string=false) X-Ref |
No description |
adodb_backtrace($printOrArr=true,$levels=9999,$ishtml=null) X-Ref |
No description |