Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
ADODB_oracle Class Reference
Inheritance diagram for ADODB_oracle:
ADOConnection

Public Member Functions

 _close ()
 
 _connect ($argHostname, $argUsername, $argPassword, $argDatabasename, $mode=0)
 
 _CreateCache ()
 Create cache class.
 
 _Execute ($sql, $inputarr=false)
 
 _findschema (&$table, &$schema)
 
 _findvers ($str)
 Find version string.
 
 _gencachename ($sql, $createdir)
 Private function to generate filename for caching.
 
 _nconnect ($argHostname, $argUsername, $argPassword, $argDatabaseName)
 Always force a new connection to database.
 
 _pconnect ($argHostname, $argUsername, $argPassword, $argDatabasename)
 
 _query ($sql, $inputarr=false)
 Execute a query.
 
_rs2rs (&$rs, $nrows=-1, $offset=-1, $close=true)
 Convert a database recordset to an array recordset.
 
 addQ ($s, $magic_quotes=false)
 Quotes a string, without prefixing nor appending quotes.
 
 Affected_Rows ()
 
 autoExecute ($table, $fields_values, $mode='INSERT', $where='', $forceUpdate=true, $magic_quotes=false)
 Simple interface to insert and update records.
 
 BeginTrans ()
 Begin a Transaction.
 
 BindDate ($d)
 
 BindTimeStamp ($d)
 
 BlobDecode ($blob)
 
 BlobEncode ($blob)
 
 CacheExecute ($secs2cache, $sql=false, $inputarr=false)
 Execute SQL, caching recordsets.
 
 CacheFlush ($sql=false, $inputarr=false)
 Flush cached recordsets that match a particular $sql statement.
 
 CacheGetAll ($secs2cache, $sql=false, $inputarr=false)
 
 CacheGetArray ($secs2cache, $sql=false, $inputarr=false)
 
 CacheGetAssoc ($secs2cache, $sql=false, $inputarr=false, $force_array=false, $first2cols=false)
 Search for the results of an executed query in the cache.
 
 CacheGetCol ($secs, $sql=false, $inputarr=false, $trim=false)
 
 CacheGetOne ($secs2cache, $sql=false, $inputarr=false)
 
 CacheGetRow ($secs2cache, $sql=false, $inputarr=false)
 
 CachePageExecute ($secs2cache, $sql, $nrows, $page, $inputarr=false)
 Will select the supplied $page number from a recordset, given that it is paginated in pages of $nrows rows per page.
 
 CacheSelectLimit ($secs2cache, $sql, $nrows=-1, $offset=-1, $inputarr=false)
 Will select, getting rows from $offset (1-based), for $nrows.
 
 charMax ()
 Returns the maximum size of a MetaType C field.
 
 Close ()
 Close Connection.
 
 CommitLock ($table)
 
 CommitTrans ($ok=true)
 Commits a transaction.
 
 CompleteTrans ($autoComplete=true)
 Complete a transation.
 
 Concat ()
 Concatenate strings.
 
 Connect ($argHostname="", $argUsername="", $argPassword="", $argDatabaseName="", $forceNew=false)
 Connect to database.
 
 CreateSequence ($seqname='adodbseq', $startID=1)
 
 day ($fld)
 
 DBDate ($d, $isfld=false)
 Converts a date "d" to a string that the database can understand.
 
 DBTimeStamp ($ts, $isfld=false)
 Converts a timestamp "ts" to a string that the database can understand.
 
 Disconnect ()
 PEAR DB Compat - do not use internally.
 
 DropSequence ($seqname='adodbseq')
 
 enableLastInsertID ($enable=true)
 Enable or disable the Last Insert Id functionality.
 
 ErrorMsg ()
 
 ErrorNative ()
 PEAR DB Compat - do not use internally.
 
 ErrorNo ()
 
 escape ($s, $magic_quotes=false)
 Alias for addQ()
 
 Execute ($sql, $inputarr=false)
 Execute SQL.
 
 FailTrans ()
 At the end of a StartTrans/CompleteTrans block, perform a rollback.
 
 GenID ($seqname='adodbseq', $startID=1)
 Generates a sequence id and stores it in $this->genID.
 
 GetActiveRecords ($table, $where=false, $bindarr=false, $primkeyArr=false)
 
 GetActiveRecordsClass ( $class, $table, $whereOrderBy=false, $bindarr=false, $primkeyArr=false, $extra=array(), $relations=array())
 GetActiveRecordsClass Performs an 'ALL' query.
 
 GetAll ($sql, $inputarr=false)
 Return all rows.
 
 GetArray ($sql, $inputarr=false)
 Executes a statement and returns a the entire recordset in an array.
 
 GetAssoc ($sql, $inputarr=false, $force_array=false, $first2cols=false)
 Execute statement and return rows in an array.
 
 getCharSet ()
 Retrieve the client connection's current character set.
 
 GetCol ($sql, $inputarr=false, $trim=false)
 Executes a statement and returns each row's first column in an array.
 
 getCustomMetaTypes ()
 Get a list of custom meta types.
 
 GetInsertSQL (&$rs, $arrFields, $magic_quotes=false, $force=null)
 Generates an Insert Query based on an existing recordset.
 
 GetMedian ($table, $field, $where='')
 
 GetOne ($sql, $inputarr=false)
 Return first element of first row of sql statement.
 
 GetRandRow ($sql, $arr=false)
 
 GetRow ($sql, $inputarr=false)
 Return one row of sql statement.
 
 GetUpdateSQL (&$rs, $arrFields, $forceUpdate=false, $magic_quotes=false, $force=null)
 Generates an Update Query based on an existing recordset.
 
 HasFailedTrans ()
 Check if transaction has failed, only for Smart Transactions.
 
 IfNull ( $field, $ifNull)
 
 IgnoreErrors ($saveErrs=false)
 
 InParameter (&$stmt, &$var, $name, $maxLen=4000, $type=false)
 Self-documenting version of Parameter().
 
 Insert_ID ($table='', $column='')
 Returns the last inserted ID.
 
 IsConnected ()
 Return true if connected to the database.
 
 LimitQuery ($sql, $offset, $count, $params=false)
 PEAR DB Compat - do not use internally.
 
 LogSQL ($enable=true)
 
 MetaColumnNames ($table, $numIndexes=false, $useattnum=false)
 List columns names in a table as an array.
 
 MetaColumns ($table, $normalize=true)
 List columns in a database as an array of ADOFieldObjects.
 
 MetaDatabases ()
 return the databases that the driver can connect to.
 
 MetaError ($err=false)
 
 MetaErrorMsg ($errno)
 
 metaForeignKeys ($table, $owner='', $upper=false, $associative=false)
 Returns a list of Foreign Keys associated with a specific table.
 
 MetaIndexes ($table, $primary=false, $owner=false)
 List indexes on a table as an array.
 
 MetaPrimaryKeys ($table, $owner=false)
 
 MetaProcedures ($procedureNamePattern=null, $catalog=null, $schemaPattern=null)
 List procedures or functions in an array.
 
 MetaTables ($ttype=false, $showSchema=false, $mask=false)
 
 MetaTransaction ($mode, $db)
 
 MetaType ($t, $len=-1, $fieldobj=false)
 
 month ($fld)
 
 NConnect ($argHostname="", $argUsername="", $argPassword="", $argDatabaseName="")
 Always force a new connection to database.
 
 nextId ($seq_name)
 PEAR DB Compat - do not use internally.
 
 OffsetDate ($dayFraction, $date=false)
 Calculate the offset of a date for a particular database and generate appropriate SQL.
 
 outp_throw ($msg, $src='WARN', $sql='')
 Throw an exception if the handler is defined or prints the message if not.
 
 OutParameter (&$stmt, &$var, $name, $maxLen=4000, $type=false)
 Self-documenting version of Parameter().
 
 PageExecute ($sql, $nrows, $page, $inputarr=false, $secs2cache=0)
 Execute query with pagination.
 
 Param ($name, $type='C')
 Returns a placeholder for query parameters.
 
 Parameter (&$stmt, &$var, $name, $isOutput=false, $maxLen=4000, $type=false)
 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();.
 
 PConnect ($argHostname="", $argUsername="", $argPassword="", $argDatabaseName="")
 Establish persistent connection to database.
 
 PO_Insert_ID ($table="", $id="")
 Portable Insert ID.
 
 Prepare ($sql)
 Prepare an SQL statement and return the statement resource.
 
 PrepareSP ($sql, $param=true)
 Prepare a Stored Procedure and return the statement resource.
 
 q (&$s)
 Quotes a string so that all strings are escaped.
 
 qStr ($s, $magic_quotes=false)
 Correctly quotes a string so that all strings are escaped.
 
 Query ($sql, $inputarr=false)
 PEAR DB Compat - do not use internally.
 
 Quote ($s)
 PEAR DB Compat - alias for qStr.
 
 releaseStatement (&$stmt)
 Releases a previously prepared statement.
 
 Replace ($table, $fieldArray, $keyCol, $autoQuote=false, $has_autoinc=false)
 Insert or replace a single record.
 
 RollbackLock ($table)
 
 RollbackTrans ()
 Rolls back a transaction.
 
 RowLock ($table, $where, $col='1 as adodbignore')
 Lock a row.
 
 SelectDB ($dbName)
 Choose a database to connect to.
 
 SelectLimit ($sql, $nrows=-1, $offset=-1, $inputarr=false, $secs2cache=0)
 Select a limited number of rows.
 
 SerializableRS (&$rs)
 Create serializable recordset.
 
 ServerInfo ()
 Get server version info.
 
 setCharSet ($charset)
 Sets the client-side character set.
 
 setConnectionParameter ($parameter, $value)
 Adds a parameter to the connection string.
 
 setCustomMetaType ( $metaType, $dictionaryType, $actualType, $handleAsType=false, $callback=false)
 Set a custom meta type with a corresponding actual.
 
 SetDateLocale ($locale='En')
 Change the SQL connection locale to a specified locale.
 
 SetFetchMode ($mode)
 PEAR DB Compat - do not use internally.
 
 SetTransactionMode ( $transaction_mode)
 
 SQLDate ($fmt, $col='')
 Format date column in sql string.
 
 StartTrans ($errfn='ADODB_TransMonitor')
 Improved method of initiating a transaction.
 
 substr ($fld, $start, $length=0)
 Returns a substring of a varchar type field.
 
 textMax ()
 Returns the maximum size of a MetaType X field.
 
 Time ()
 Return the database server's current date and time.
 
 updateBlob ($table, $column, $val, $where, $blobtype='BLOB')
 Update a BLOB column, given a where clause.
 
 updateBlobFile ($table, $column, $path, $where, $blobtype='BLOB')
 Update a BLOB from a file.
 
 UpdateClob ($table, $column, $val, $where)
 Usage: UpdateClob('TABLE', 'COLUMN', $var, 'ID=1', 'CLOB');.
 
 UserDate ($v, $fmt='Y-m-d', $gmt=false)
 Format database date based on user defined format.
 
 UserTimeStamp ($v, $fmt='Y-m-d H:i:s', $gmt=false)
 Format timestamp based on user defined format.
 
 year ($fld)
 

Static Public Member Functions

static outp ($msg, $newline=true)
 All error messages go through this bottleneck function.
 
static UnixDate ($v)
 Also in ADORecordSet.
 
static UnixTimeStamp ($v)
 Also in ADORecordSet.
 
static Version ()
 ADOdb version.
 

Public Attributes

 $_affected = false
 
 $_bindInputArray = false
 A boolean variable to state whether its a persistent connection or normal connection. *‍/.
 
resource $_connectionID = false
 Identifier for the native database connection.
 
 $_curs
 
string $_dropSeqSQL
 SQL statement to drop a Sequence.
 
int false $_errorCode = false
 Stores the last returned error code.
 
string false $_errorMsg = false
 Stores the last returned error message.
 
string $_genIDSQL
 SQL statement to generate a Sequence ID.
 
string $_genSeqSQL
 SQL statement to create a Sequence .
 
 $_initdate = true
 
 $_isPersistentConnection = false
 This variable keeps the last created result link identifier.
 
 $_logsql = false
 
ADORecordSet $_metars
 Recordset used to retrieve MetaType information.
 
 $_oldRaiseFn = false
 
 $_queryID = false
 
 $_transmode = ''
 
 $_transOK = null
 
 $ansiOuter = false
 operator to use for right outer join in WHERE clause
 
 $arrayClass = 'ADORecordSet_array'
 
 $autoCommit = true
 
 $autoRollback = false
 whether ansi outer join syntax supported
 
 $blobEncodeType = false
 
 $bulkBind = false
 
 $cacheSecs = 3600
 accepts dates in ISO format
 
 $charSet =false
 right square bracked for t-sql styled column names
 
 $concat_operator ='||'
 
 $connectSID = true
 
string $connectStmt = ''
 SQL statement executed by some drivers after successful connection.
 
 $customActualTypes = array()
 
 $customMetaTypes = array()
 
string $database = ''
 RDBMS currently in use, eg. odbc, mysql, mssql.
 
 $databaseType = "oracle"
 
 $dataProvider = 'native'
 
 $debug = false
 Password for the username. For security, we no longer store it.
 
string $dsnType = ''
 If the driver is PDO, then the dsnType is e.g.
 
 $emptyDate = ' '
 All order by columns have to be unique.
 
 $emptyTimeStamp = ' '
 
string $evalAll = false
 set to true if ADOConnection.Execute() permits binding of array parameters.
 
 $false = '0'
 string that represents TRUE for a database
 
 $fetchMode =false
 count of nested transactions
 
 $fmtDate = "'Y-m-d'"
 uppercase function
 
 $fmtTimeStamp = "'Y-m-d, h:i:s A'"
 used by DBDate() as the default date format used by the database
 
bool callable $fnCacheExecute = false
 Cache execution function to call.
 
bool callable $fnExecute = false
 Execute function to call.
 
 $genID = 0
 has transactions
 
 $hasAffectedRows = false
 supports autoincrement ID?
 
 $hasGenID = false
 has ability to run MoveFirst(), scrolling backwards
 
 $hasInsertID = false
 
 $hasLimit = false
 support mssql/access SELECT TOP 10 * FROM TABLE
 
 $hasMoveFirst = false
 this is a readonly database - used by phpLens
 
 $hasTop = false
 supports affected rows for update/delete?
 
 $hasTransactions = true
 can generate sequences using GenID();
 
 $host = ''
 
string $identitySQL
 SQL statement to get the last IDENTITY value inserted into an IDENTITY column in the same scope.
 
 $isoDates = false
 
 $lastInsID = false
 
 $leftBracket = '['
 string to use to quote identifiers and names
 
 $leftOuter = false
 indicates that all fields in order by must be unique
 
 $length = 'length'
 substring operator
 
string $locale
 a specified locale.
 
 $maxblobsize = 262144
 if set to true will output sql statements
 
bool $memCache = false
 cache for 1 hour
 
bool $memCacheCompress = false
 Enable compression of stored items.
 
string array $memCacheHost
 The memcache server(s) to connect to.
 
array $memCacheOptions = array()
 An array of memcached options.
 
int $memCachePort = 11211
 Default port number.
 
 $metaColumnsSQL = "select cname,coltype,width from col where tname='%s' order by colno"
 
string $metaDatabasesSQL = ''
 character set to use - only for interbase, postgres and oci8
 
 $metaTablesSQL = 'select table_name from cat'
 
 $nameQuote = '"'
 string to use to replace quotes
 
 $noNullStrings = false
 name of class used to generate array recordsets, which are pre-downloaded recordsets
 
 $null2null = 'null'
 
 $numCacheHits = 0
 oracle specific stuff - if true ensures that '' is converted to ' '
 
 $numCacheMisses = 0
 
 $pageExecuteCountRows = true
 
 $password = ''
 The username which is used to connect to the database server.
 
 $poorAffectedRows = false
 
 $port = ''
 The hostname of the database server.
 
bool callable $raiseErrorFn = false
 sequence id used by GenID();
 
 $random = 'rand()'
 string length ofperator
 
 $readOnly = false
 support pgsql/mysql SELECT * FROM TABLE LIMIT 10
 
 $replaceQuote = "''"
 
 $rightBracket = ']'
 left square bracked for t-sql styled column names
 
 $rightOuter = false
 operator to use for left outer join in WHERE clause
 
 $rsPrefix = "ADORecordSet_"
 
 $substr = 'substr'
 default concat operator – change to || for Oracle/Interbase
 
 $sysDate = "TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD')"
 
 $sysTimeStamp = 'SYSDATE'
 
 $sysUTimeStamp = false
 name of function that returns the current timestamp
 
 $transCnt = 0
 temporarily disable transactions
 
 $transOff = 0
 do not modify this yourself - actually private
 
 $true = '1'
 used by DBTimeStamp as the default timestamp fmt.
 
 $uniqueOrderBy = false
 
 $uniqueSort = false
 
 $upperCase = 'upper'
 random function
 
 $user = ''
 The port of the database server.
 

Protected Member Functions

 _insertID ($table='', $column='')
 Return the id of the last row that has been inserted in a table.
 
 getChangedErrorMsg ($old=null)
 Compare a previously stored error message with the last error recorded by PHP to determine whether a new error has occurred.
 
 parseHostNameAndPort ()
 Parses the hostname to extract the port.
 
 resetLastError ()
 Get the last error recorded by PHP and clear the message.
 

Protected Attributes

array $connectionParameters = array()
 Additional parameters that may be passed to drivers in the connect string.
 

Member Function Documentation

◆ _CreateCache()

ADOConnection::_CreateCache ( )
inherited

Create cache class.

Code is backwards-compatible with old memcache implementation.

◆ _findvers()

ADOConnection::_findvers ( $str)
inherited

Find version string.

Parameters
string$str
Return values
string

◆ _gencachename()

ADOConnection::_gencachename ( $sql,
$createdir )
inherited

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)

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!

◆ _insertID()

ADOConnection::_insertID ( $table = '',
$column = '' )
protectedinherited

Return the id of the last row that has been inserted in a table.

Parameters
string$table
string$column
Return values
int|false

Reimplemented in ADODB_ado_mssql, ADODB_db2, ADODB_informix72, ADODB_mssql, ADODB_mssqlnative, ADODB_oci8, ADODB_odbc_mssql, ADODB_odbtp, ADODB_pdo, ADODB_postgres64, ADODB_postgres8, ADODB_sqlite, and ADODB_sybase.

◆ _nconnect()

ADOConnection::_nconnect ( $argHostname,
$argUsername,
$argPassword,
$argDatabaseName )
inherited

Always force a new connection to database.

Parameters
string$argHostnameHost to connect to
string$argUsernameUserid to login
string$argPasswordAssociated password
string$argDatabaseNameDatabase name
Return values
bool

Reimplemented in ADODB_mssql, ADODB_oci8, and ADODB_postgres64.

◆ _query()

ADODB_oracle::_query ( $sql,
$inputarr = false )

Execute a query.

Parameters
string | array$sqlQuery to execute.
array$inputarrAn optional array of parameters.
Return values
mixed|boolQuery identifier or true if execution successful, false if failed.

Reimplemented from ADOConnection.

◆ _rs2rs()

& ADOConnection::_rs2rs ( & $rs,
$nrows = -1,
$offset = -1,
$close = true )
inherited

Convert a database recordset to an array recordset.

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

Parameters
ADORecordSet$rsthe recordset to copy
int$nrowsnumber of rows to retrieve (optional)
int$offsetoffset by number of rows (optional)
bool$close
Return values
ADORecordSet_array|ADORecordSet|boolthe new recordset

◆ addQ()

ADOConnection::addQ ( $s,
$magic_quotes = false )
inherited

Quotes a string, without prefixing nor appending quotes.

Parameters
string$sThe string to quote
bool$magic_quotesThis param is not used since 5.21.0. It remains for backwards compatibility.
Return values
stringQuoted string

@noinspection PhpUnusedParameterInspection

◆ Affected_Rows()

ADOConnection::Affected_Rows ( )
inherited
Return values
int|falseNumber of rows affected by UPDATE/DELETE

◆ autoExecute()

ADOConnection::autoExecute ( $table,
$fields_values,
$mode = 'INSERT',
$where = '',
$forceUpdate = true,
$magic_quotes = false )
inherited

Simple interface to insert and update records.

Automatically generate and execute INSERT and UPDATE statements on a given table, similar to PEAR DB's autoExecute().

Parameters
string$tableName of the table to process.
array$fields_valuesAssociative array of field names => values.
string | int$modeExecution mode: 'INSERT' (default), 'UPDATE' or one of the DB_AUTOQUERY_xx constants.
string$whereSQL where clause (mandatory in UPDATE mode as a safety measure)
bool$forceUpdateIf true, update all provided fields, even if they have not changed; otherwise only modified fields are updated.
bool$magic_quotesThis param is not used since 5.21.0. It remains for backwards compatibility.
Return values
bool

@noinspection PhpUnusedParameterInspection

◆ BeginTrans()

ADODB_oracle::BeginTrans ( )

Begin a Transaction.

Must be followed by CommitTrans() or RollbackTrans().

Return values
booltrue if succeeded or false if database does not support transactions

Reimplemented from ADOConnection.

◆ BindDate()

ADODB_oracle::BindDate ( $d)

Reimplemented from ADOConnection.

◆ BindTimeStamp()

ADODB_oracle::BindTimeStamp ( $d)

Reimplemented from ADOConnection.

◆ BlobEncode()

ADOConnection::BlobEncode ( $blob)
inherited

Reimplemented in ADODB_postgres64.

◆ CacheExecute()

ADOConnection::CacheExecute ( $secs2cache,
$sql = false,
$inputarr = false )
inherited

Execute SQL, caching recordsets.

Parameters
int$secs2cacheSeconds to cache data, set to 0 to force query. This is an optional parameter.
string | bool$sqlSQL statement to execute
array | bool$inputarrHolds the input data to bind
Return values
ADORecordSetRecordSet or false

◆ CacheFlush()

ADOConnection::CacheFlush ( $sql = false,
$inputarr = false )
inherited

Flush cached recordsets that match a particular $sql statement.

If $sql == false, then we purge all files in the cache.

◆ CacheGetAssoc()

ADOConnection::CacheGetAssoc ( $secs2cache,
$sql = false,
$inputarr = false,
$force_array = false,
$first2cols = false )
inherited

Search for the results of an executed query in the cache.

Parameters
int$secs2cache
string | bool$sqlSQL statement
array | bool$inputarrinput bind array
bool$force_array
bool$first2cols
Return values
false|array

◆ CacheGetRow()

ADOConnection::CacheGetRow ( $secs2cache,
$sql = false,
$inputarr = false )
inherited
Parameters
int$secs2cache
string | false$sql
mixed[] | bool$inputarr
Return values
mixed[]|bool

◆ CachePageExecute()

ADOConnection::CachePageExecute ( $secs2cache,
$sql,
$nrows,
$page,
$inputarr = false )
inherited

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.

Parameters
int$secs2cacheseconds to cache data, set to 0 to force query
string$sql
int$nrowsis the number of rows per page to get
int$pageis the page number to get (1-based)
mixed[] | bool$inputarrarray of bind variables
Return values
mixedthe recordset ($rs->databaseType == 'array')

◆ CacheSelectLimit()

ADOConnection::CacheSelectLimit ( $secs2cache,
$sql,
$nrows = -1,
$offset = -1,
$inputarr = false )
inherited

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

Parameters
int$secs2cacheSeconds to cache data, set to 0 to force query. This is optional
string$sql
int$offsetRow to start calculations from (1-based)
int$nrowsNumber of rows to get
array$inputarrArray of bind variables
Return values
ADORecordSetThe recordset ($rs->databaseType == 'array')

◆ charMax()

ADOConnection::charMax ( )
inherited

Returns the maximum size of a MetaType C field.

If the method is not defined in the driver returns ADODB_STRINGMAX_NOTSET

Return values
int

Reimplemented in ADODB_mssqlnative, ADODB_odbc_mssql, and ADODB_sqlite.

◆ CommitLock()

ADOConnection::CommitLock ( $table)
inherited
Parameters
string$table
Return values
true

◆ CommitTrans()

ADODB_oracle::CommitTrans ( $ok = true)

Commits a transaction.

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

Parameters
bool$okTrue to commit, false to rollback the transaction.
Return values
booltrue if successful

Reimplemented from ADOConnection.

◆ CompleteTrans()

ADOConnection::CompleteTrans ( $autoComplete = true)
inherited

Complete a transation.

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

Parameters
boolautoComplete if true, monitor sql errors and commit and rollback as appropriate, and if set to false force rollback even if no SQL error detected.
Returns
true on commit, false on rollback.

◆ Concat()

ADOConnection::Concat ( )
inherited

Concatenate strings.

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

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

Parameters
string$sVariable number of string parameters
Return values
stringconcatenated string

Reimplemented in ADODB_mssql, ADODB_mssqlnative, ADODB_odbc_mssql, and ADODB_pdo.

◆ Connect()

ADOConnection::Connect ( $argHostname = "",
$argUsername = "",
$argPassword = "",
$argDatabaseName = "",
$forceNew = false )
inherited

Connect to database.

Parameters
string$argHostnameHost to connect to
string$argUsernameUserid to login
string$argPasswordAssociated password
string$argDatabaseNameDatabase name
bool$forceNewForce new connection
Return values
bool

◆ DBDate()

ADODB_oracle::DBDate ( $d,
$isfld = false )

Converts a date "d" to a string that the database can understand.

Parameters
mixed$da date in Unix date time format.
Return values
stringdate string in database date format

Reimplemented from ADOConnection.

◆ DBTimeStamp()

ADODB_oracle::DBTimeStamp ( $ts,
$isfld = false )

Converts a timestamp "ts" to a string that the database can understand.

Parameters
int | object$tsA timestamp in Unix date time format.
Return values
string\$timestampstring in database timestamp format

Reimplemented from ADOConnection.

◆ enableLastInsertID()

ADOConnection::enableLastInsertID ( $enable = true)
inherited

Enable or disable the Last Insert Id functionality.

If the Driver supports it, this function allows setting {

See also
$hasInsertID}.
Parameters
bool$enableFalse to disable

Reimplemented in ADODB_mssqlnative.

◆ ErrorMsg()

ADODB_oracle::ErrorMsg ( )
Return values
stringthe last error message

Reimplemented from ADOConnection.

◆ ErrorNative()

ADOConnection::ErrorNative ( )
inherited

PEAR DB Compat - do not use internally.

Return values
int

◆ ErrorNo()

ADODB_oracle::ErrorNo ( )
Return values
intthe last error number. Normally 0 means no error.

Reimplemented from ADOConnection.

◆ escape()

ADOConnection::escape ( $s,
$magic_quotes = false )
inherited

Alias for addQ()

Parameters
string$s
bool[$magic_quotes]
Return values
mixed
Deprecated
5.21.0 @noinspection PhpUnusedParameterInspection

◆ Execute()

ADOConnection::Execute ( $sql,
$inputarr = false )
inherited

Execute SQL.

Parameters
string$sqlSQL statement to execute, or possibly an array holding prepared statement ($sql[0] will hold sql text)
array | bool$inputarrholds the input data to bind to. Null elements will be set to null.
Return values
ADORecordSet|false

Reimplemented in ADODB_oci8, and ADODB_oci8po.

◆ GenID()

ADOConnection::GenID ( $seqname = 'adodbseq',
$startID = 1 )
inherited

Generates a sequence id and stores it in $this->genID.

GenID is only available if $this->hasGenID = true;

Parameters
string$seqnameName of sequence to use
int$startIDIf sequence does not exist, start at this ID
Return values
intSequence id, 0 if not supported

Reimplemented in ADODB_ado_mssql, ADODB_ads, ADODB_mssql, ADODB_mssqlnative, ADODB_odbc, ADODB_odbtp, ADODB_pdo, and ADODB_sqlite.

◆ GetActiveRecordsClass()

ADOConnection::GetActiveRecordsClass ( $class,
$table,
$whereOrderBy = false,
$bindarr = false,
$primkeyArr = false,
$extra = array(),
$relations = array() )
inherited

GetActiveRecordsClass Performs an 'ALL' query.

Parameters
mixed$classThis string represents the class of the current active record
mixed$tableTable used by the active record object
mixed$whereOrderByWhere, order, by clauses
mixed$bindarr
mixed$primkeyArr
array$extraQuery extras: limit, offset...
mixed$relationsAssociative array: table's foreign name, "hasMany", "belongsTo"
Return values
void

◆ GetAll()

ADOConnection::GetAll ( $sql,
$inputarr = false )
inherited

Return all rows.

Compat with PEAR DB.

Parameters
string$sqlSQL statement
array | bool$inputarrInput bind array
Return values
array|false

◆ GetArray()

ADOConnection::GetArray ( $sql,
$inputarr = false )
inherited

Executes a statement and returns a the entire recordset in an array.

Parameters
string$sqlSQL statement
array | bool$inputarrinput bind array
Return values
array|false

◆ GetAssoc()

ADOConnection::GetAssoc ( $sql,
$inputarr = false,
$force_array = false,
$first2cols = false )
inherited

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.

Parameters
string$sqlSQL statement
array | bool$inputarrinput bind array
bool$force_array
bool$first2cols
Return values
array|bool

◆ getChangedErrorMsg()

ADOConnection::getChangedErrorMsg ( $old = null)
protectedinherited

Compare a previously stored error message with the last error recorded by PHP to determine whether a new error has occurred.

Parameters
mixed[] | null$oldOptional. Previously stored return value of error_get_last().
Return values
stringThe error message if a new error has occurred or an empty string if no (new) errors have occurred..

◆ getCharSet()

ADOConnection::getCharSet ( )
inherited

Retrieve the client connection's current character set.

Return values
string|falseThe character set, or false if it can't be determined.

Reimplemented in ADODB_postgres7.

◆ GetCol()

ADOConnection::GetCol ( $sql,
$inputarr = false,
$trim = false )
inherited

Executes a statement and returns each row's first column in an array.

Parameters
string$sqlSQL statement
array | bool$inputarrinput bind array
bool$trimenables space trimming of the returned value. This is only relevant if the returned string is coming from a CHAR type field.
Return values
array|bool1D array containning the first row of the query

◆ getCustomMetaTypes()

ADOConnection::getCustomMetaTypes ( )
finalinherited

Get a list of custom meta types.

Return values
string[]

◆ GetInsertSQL()

ADOConnection::GetInsertSQL ( & $rs,
$arrFields,
$magic_quotes = false,
$force = null )
inherited

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.

Parameters
$rs
$arrFields
bool$magic_quotesThis param is not used since 5.21.0. It remains for backwards compatibility.
null$force
Return values
false|string

@noinspection PhpUnusedParameterInspection

◆ GetOne()

ADOConnection::GetOne ( $sql,
$inputarr = false )
inherited

Return first element of first row of sql statement.

Recordset is disposed for you.

Parameters
string$sqlSQL statement
array | bool$inputarrinput bind array
Return values
mixed

◆ GetRow()

ADOConnection::GetRow ( $sql,
$inputarr = false )
inherited

Return one row of sql statement.

Recordset is disposed for you. Note that SelectLimit should not be called.

Parameters
string$sqlSQL statement
array | bool$inputarrinput bind array
Return values
array|falseArray containing the first row of the query

◆ GetUpdateSQL()

ADOConnection::GetUpdateSQL ( & $rs,
$arrFields,
$forceUpdate = false,
$magic_quotes = false,
$force = null )
inherited

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" jyoun.nosp@m.ger@.nosp@m.unila.nosp@m.b.co.nosp@m.m
Parameters
$rs
$arrFields
bool$forceUpdate
bool$magic_quotesThis param is not used since 5.21.0. It remains for backwards compatibility.
null$force
Return values
false|string

@noinspection PhpUnusedParameterInspection

◆ InParameter()

ADOConnection::InParameter ( & $stmt,
& $var,
$name,
$maxLen = 4000,
$type = false )
inherited

Self-documenting version of Parameter().

Parameters
$stmt
&$var
$name
int$maxLen
bool$type
Return values
bool

Reimplemented in ADODB_pdo.

◆ Insert_ID()

ADOConnection::Insert_ID ( $table = '',
$column = '' )
inherited

Returns the last inserted ID.

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

Parameters
string$tableTable name, default ''
string$columnColumn name, default ''
Return values
intThe last inserted ID.

◆ IsConnected()

ADOConnection::IsConnected ( )
inherited

Return true if connected to the database.

Return values
bool

◆ MetaColumnNames()

ADOConnection::MetaColumnNames ( $table,
$numIndexes = false,
$useattnum = false )
inherited

List columns names in a table as an array.

Parameters
tabletable name to query
Return values
arrayof column names for current table.

Reimplemented in ADODB_ads.

◆ MetaColumns()

ADOConnection::MetaColumns ( $table,
$normalize = true )
inherited

List columns in a database as an array of ADOFieldObjects.

See top of file for definition of object.

Parameters
$tabletable name to query
$normalizemakes table name case-insensitive (required by some databases) @schema is optional database schema to use - not supported by all databases.
Return values
arrayof ADOFieldObjects for current table.

Reimplemented in ADODB_ado, ADODB_ado, ADODB_ado_mssql, ADODB_ads, ADODB_informix72, ADODB_mssql, ADODB_netezza, ADODB_oci8, ADODB_odbc, ADODB_odbc_mssql, ADODB_odbc_oracle, ADODB_odbtp, ADODB_pdo, ADODB_pdo_base, ADODB_postgres64, ADODB_sqlite, and ADODB_sybase_ase.

◆ MetaDatabases()

ADOConnection::MetaDatabases ( )
inherited

return the databases that the driver can connect to.

Some databases will return an empty array.

Return values
array|boolan array of database names.

Reimplemented in ADODB_mssql, ADODB_mssqlnative, and ADODB_sybase_ase.

◆ metaForeignKeys()

ADOConnection::metaForeignKeys ( $table,
$owner = '',
$upper = false,
$associative = false )
inherited

Returns a list of Foreign Keys associated with a specific table.

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

Parameters
string$tableThe name of the table to get the foreign keys for.
string$ownerTable owner/schema.
bool$upperIf true, only matches the table with the uppercase name.
bool$associativeReturns the result in associative mode; if ADODB_FETCH_MODE is already associative, then this parameter is discarded.
Return values
string[]|falseAn array where keys are tables, and values are foreign keys; false if no foreign keys could be found.

Reimplemented in ADODB_db2, ADODB_informix72, ADODB_mssql, ADODB_mssqlnative, ADODB_oci8, ADODB_odbc_mssql, ADODB_odbtp, ADODB_pdo, and ADODB_postgres7.

◆ MetaIndexes()

ADOConnection::MetaIndexes ( $table,
$primary = false,
$owner = false )
inherited

List indexes on a table as an array.

Parameters
tabletable name to query
primarytrue to only show primary keys. Not actually used for most databases
Return values
arrayof indexes on current table. Each element represents an index, and is itself an associative array.

Array( [name_of_index] => Array( [unique] => true or false [columns] => Array( [0] => firstname [1] => lastname ) ) )

Reimplemented in ADODB_mssql, ADODB_mssqlnative, ADODB_oci8, ADODB_odbc_mssql, ADODB_odbtp, ADODB_postgres64, and ADODB_sqlite.

◆ MetaPrimaryKeys()

ADOConnection::MetaPrimaryKeys ( $table,
$owner = false )
inherited
Returns
an array with the primary key columns in it.

Reimplemented in ADODB_ads, ADODB_mssql, ADODB_mssqlnative, ADODB_odbc, ADODB_odbc_mssql, ADODB_odbtp, and ADODB_sybase.

◆ MetaProcedures()

ADOConnection::MetaProcedures ( $procedureNamePattern = null,
$catalog = null,
$schemaPattern = null )
inherited

List procedures or functions in an array.

Parameters
procedureNamePatterna procedure name pattern; must match the procedure name as it is stored in the database
cataloga catalog name; must match the catalog name as it is stored in the database;
schemaPatterna schema name pattern;
Return values
arrayof procedures on current database.

Array( [name_of_procedure] => Array( [type] => PROCEDURE or FUNCTION [catalog] => Catalog_name [schema] => Schema_name [remarks] => explanatory comment on the procedure ) )

Reimplemented in ADODB_informix72.

◆ MetaTables()

ADOConnection::MetaTables ( $ttype = false,
$showSchema = false,
$mask = false )
inherited
Parameters
ttypecan either be 'VIEW' or 'TABLE' or false. If false, both views and tables are returned. "VIEW" returns only views "TABLE" returns only tables
showSchemareturns the schema/user with the table name, eg. USER.TABLE
maskis the input mask - only supported by oci8 and postgresql
Return values
arrayof tables for current database.

Reimplemented in ADODB_ado, ADODB_ado, ADODB_ads, ADODB_mssql, ADODB_mssqlnative, ADODB_oci8, ADODB_odbc, ADODB_odbc_mssql, ADODB_odbc_oracle, ADODB_odbtp, ADODB_pdo, ADODB_pdo_base, ADODB_postgres64, and ADODB_sybase_ase.

◆ NConnect()

ADOConnection::NConnect ( $argHostname = "",
$argUsername = "",
$argPassword = "",
$argDatabaseName = "" )
inherited

Always force a new connection to database.

Currently this only works with Oracle.

Parameters
string$argHostnameHost to connect to
string$argUsernameUserid to login
string$argPasswordAssociated password
string$argDatabaseNameDatabase name
Return values
bool

◆ nextId()

ADOConnection::nextId ( $seq_name)
inherited

PEAR DB Compat - do not use internally.

Parameters
string$seq_name
Return values
int

◆ OffsetDate()

ADOConnection::OffsetDate ( $dayFraction,
$date = false )
inherited

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.

Parameters
double$dayFraction1.5 means 1.5 days from now, 1.0/24 for 1 hour
string | false$dateReference date, false for system time
Return values
string

Reimplemented in ADODB_pdo, and ADODB_postgres64.

◆ outp()

static ADOConnection::outp ( $msg,
$newline = true )
staticinherited

All error messages go through this bottleneck function.

You can define your own handler by defining the function name in ADODB_OUTP.

Parameters
string$msgMessage to print
bool$newlineTrue to add a newline after printing $msg
Examples
/home/runner/work/phpdoc/phpdoc/.moodle/lib/adodb/adodb-perf.inc.php.

◆ outp_throw()

ADOConnection::outp_throw ( $msg,
$src = 'WARN',
$sql = '' )
inherited

Throw an exception if the handler is defined or prints the message if not.

Parameters
string$msgMessage
string$srcthe name of the calling function (in uppercase)
string$sqlOptional offending SQL statement

◆ OutParameter()

ADOConnection::OutParameter ( & $stmt,
& $var,
$name,
$maxLen = 4000,
$type = false )
inherited

Self-documenting version of Parameter().

Parameters
$stmt
$var
$name
int$maxLen
bool$type
Return values
bool

◆ PageExecute()

ADOConnection::PageExecute ( $sql,
$nrows,
$page,
$inputarr = false,
$secs2cache = 0 )
inherited

Execute query with pagination.

Will select the supplied $page number from a recordset, divided in pages of $nrows rows each. It also saves two boolean values saying if the given page is the first and/or last one of the recordset.

Parameters
string$sqlQuery to execute
int$nrowsNumber of rows per page
int$pagePage number to retrieve (1-based)
array | bool$inputarrArray of bind variables
int$secs2cacheTime-to-live of the cache (in seconds), 0 to force query execution
Return values
ADORecordSet|boolthe recordset ($rs->databaseType == 'array')
Author
Iván Oliva

◆ Param()

ADOConnection::Param ( $name,
$type = 'C' )
inherited

Returns a placeholder for query parameters.

e.g. $DB->Param('a') will return

  • '?' for most databases
  • ':a' for Oracle
  • '$1', '$2', etc. for PostgreSQL
Parameters
mixed$nameparameter's name. For databases that require positioned params (e.g. PostgreSQL), a "falsy" value can be used to force resetting the placeholder count; using boolean 'false' will reset it without actually returning a placeholder. ADOdb will also automatically reset the count when executing a query.
string$type(unused)
Return values
stringquery parameter placeholder

Reimplemented in ADODB_oci8, and ADODB_oci8po.

◆ Parameter()

ADOConnection::Parameter ( & $stmt,
& $var,
$name,
$isOutput = false,
$maxLen = 4000,
$type = false )
inherited

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();.

Parameters
mixed&$stmtStatement returned by Prepare() or PrepareSP().
mixed&$varPHP variable to bind to
string$nameName of stored procedure variable name to bind to.
int | bool$isOutputIndicates direction of parameter 0/false=IN 1=OUT 2= IN/OUT. This is ignored in oci8.
int$maxLenHolds an maximum length of the variable.
mixed$typeThe data type of $var. Legal values depend on driver.
Return values
bool

Reimplemented in ADODB_mssql, ADODB_oci8, and ADODB_odbtp.

◆ parseHostNameAndPort()

ADOConnection::parseHostNameAndPort ( )
protectedinherited

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.

◆ PConnect()

ADOConnection::PConnect ( $argHostname = "",
$argUsername = "",
$argPassword = "",
$argDatabaseName = "" )
inherited

Establish persistent connection to database.

Parameters
string$argHostnameHost to connect to
string$argUsernameUserid to login
string$argPasswordAssociated password
string$argDatabaseNameDatabase name
Return values
bool

◆ PO_Insert_ID()

ADOConnection::PO_Insert_ID ( $table = "",
$id = "" )
inherited

Portable Insert ID.

Pablo Roca <pabloroca\mvps.org>

Parameters
string$table
string$id
Return values
mixedThe last inserted ID. All databases support this, but be aware of possible problems in multiuser environments. Heavily test this before deploying.

◆ Prepare()

ADOConnection::Prepare ( $sql)
inherited

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

Parameters
string$sqlSQL to send to database
Return values
mixed|falseThe prepared statement, or the original sql if the database does not support prepare.

Reimplemented in ADODB_ads, ADODB_mssql, ADODB_mssqlnative, ADODB_odbc, ADODB_odbtp, and ADODB_pdo.

◆ PrepareSP()

ADOConnection::PrepareSP ( $sql,
$param = true )
inherited

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.

Parameters
string$sqlSQL to send to database
bool$param
Return values
mixed|falseThe prepared statement, or the original sql if the database does not support prepare.

Reimplemented in ADODB_mssql, ADODB_mssqlpo, and ADODB_odbtp.

◆ q()

ADOConnection::q ( & $s)
inherited

Quotes a string so that all strings are escaped.

Wrapper for qstr with magic_quotes = false.

Parameters
string&$s

◆ qStr()

ADOConnection::qStr ( $s,
$magic_quotes = false )
inherited

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"); @externalurl https://adodb.org/dokuwiki/doku.php?id=v5:reference:connection:qstr

Parameters
string$sThe string to quote
bool$magic_quotesThis param is not used since 5.21.0. It remains for backwards compatibility.
Return values
stringQuoted string to be sent back to database

@noinspection PhpUnusedParameterInspection

Reimplemented in ADODB_ado_mssql, ADODB_mssql, ADODB_oci8, ADODB_pdo, and ADODB_postgres64.

◆ Query()

ADOConnection::Query ( $sql,
$inputarr = false )
inherited

PEAR DB Compat - do not use internally.

Parameters
string$sql
array | bool$inputarr
Return values
ADORecordSet|bool

◆ Quote()

ADOConnection::Quote ( $s)
inherited

PEAR DB Compat - alias for qStr.

Parameters
$s
Return values
string

◆ releaseStatement()

ADOConnection::releaseStatement ( & $stmt)
inherited

Releases a previously prepared statement.

Parameters
mixed$stmtStatement resource, as returned by {
See also
prepare()}
Return values
bool

Reimplemented in ADODB_oci8.

◆ Replace()

ADOConnection::Replace ( $table,
$fieldArray,
$keyCol,
$autoQuote = false,
$has_autoinc = false )
inherited

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

◆ resetLastError()

ADOConnection::resetLastError ( )
protectedinherited

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 values
mixed[]|nullArray if an error has previously occurred. Null otherwise.

◆ RollbackLock()

ADOConnection::RollbackLock ( $table)
inherited
Parameters
string$table
Return values
true

◆ RollbackTrans()

ADODB_oracle::RollbackTrans ( )

Rolls back a transaction.

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

Return values
booltrue if successful

Reimplemented from ADOConnection.

◆ RowLock()

ADOConnection::RowLock ( $table,
$where,
$col = '1 as adodbignore' )
inherited

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.

Parameters
string$tablename of table to lock
string$wherewhere clause to use, eg: "WHERE row=12". If left empty, will escalate to table lock
string$col
Return values
bool

Reimplemented in ADODB_informix72, ADODB_mssql, ADODB_mssqlnative, ADODB_oci8, ADODB_postgres64, and ADODB_sybase.

◆ SelectDB()

ADOConnection::SelectDB ( $dbName)
inherited

Choose a database to connect to.

Many databases do not support this.

Parameters
string$dbNamethe name of the database to select
Return values
bool

Reimplemented in ADODB_ldap, ADODB_mssql, ADODB_mssqlnative, ADODB_oci8, ADODB_odbtp, ADODB_pdo, and ADODB_sybase.

◆ SelectLimit()

ADOConnection::SelectLimit ( $sql,
$nrows = -1,
$offset = -1,
$inputarr = false,
$secs2cache = 0 )
inherited

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

Parameters
string$sql
int$offsetRow to start calculations from (1-based)
int$nrowsNumber of rows to get
array | bool$inputarrArray of bind variables
int$secs2cachePrivate parameter only used by jlim
Return values
ADORecordSetThe recordset ($rs->databaseType == 'array')

Reimplemented in ADODB_mssql, ADODB_oci805, ADODB_oci8, ADODB_oci8po, ADODB_odbc_mssql, ADODB_odbtp, ADODB_pdo, ADODB_pdo_base, ADODB_postgres7, ADODB_sqlite, and ADODB_sybase.

◆ SerializableRS()

ADOConnection::SerializableRS ( & $rs)
inherited

Create serializable recordset.

Breaks rs link to connection.

Parameters
ADORecordSet$rsthe recordset to serialize
Return values
ADORecordSet_array|boolthe new recordset

◆ ServerInfo()

ADOConnection::ServerInfo ( )
inherited

Get server version info.

Return values
string[]Array with 2 string elements: version and description

Reimplemented in ADODB_ado, ADODB_ado, ADODB_ads, ADODB_informix72, ADODB_ldap, ADODB_mssql, ADODB_mssqlnative, ADODB_oci8, ADODB_odbc, ADODB_odbc_mssql, ADODB_odbtp, ADODB_pdo, ADODB_pdo_base, and ADODB_sqlite.

◆ setCharSet()

ADOConnection::setCharSet ( $charset)
inherited

Sets the client-side character set.

This is only supported for some databases.

See also
https://adodb.org/dokuwiki/doku.php?id=v5:reference:connection:setcharset
Parameters
string$charsetThe character set to switch to.
Return values
boolTrue if the character set was changed successfully, false otherwise.

Reimplemented in ADODB_postgres7.

◆ setConnectionParameter()

ADOConnection::setConnectionParameter ( $parameter,
$value )
inherited

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.

Parameters
string$parameterThe name of the parameter to set
string$valueThe value of the parameter
Return values
boolTrue if success, false otherwise (e.g. parameter is not valid)

◆ setCustomMetaType()

ADOConnection::setCustomMetaType ( $metaType,
$dictionaryType,
$actualType,
$handleAsType = false,
$callback = false )
finalinherited

Set a custom meta type with a corresponding actual.

Parameters
string$metaTypeThe Custom ADOdb metatype
string$dictionaryTypeThe database dictionary type
string$actualTypeThe database actual type
bool$handleAsTypehandle like an existing Metatype
mixed$callBackA pre-processing function
Return values
boolsuccess if the actual exists

◆ SetDateLocale()

ADOConnection::SetDateLocale ( $locale = 'En')
inherited

Change the SQL connection locale to a specified locale.

This is used to get the date formats written depending on the client locale.

◆ SetFetchMode()

ADOConnection::SetFetchMode ( $mode)
inherited

PEAR DB Compat - do not use internally.

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

Parameters
int$modeThe fetchmode ADODB_FETCH_ASSOC or ADODB_FETCH_NUM
Return values
intPrevious fetch mode

◆ SQLDate()

ADOConnection::SQLDate ( $fmt,
$col = '' )
inherited

Format date column in sql string.

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

Parameters
string$fmtFormat string
string$colDate column; use system date if not specified.
Return values
string

Reimplemented in ADODB_mssql, ADODB_mssqlnative, ADODB_oci8, ADODB_odbc_mssql, ADODB_pdo, ADODB_postgres64, ADODB_sqlite, and ADODB_sybase.

◆ StartTrans()

ADOConnection::StartTrans ( $errfn = 'ADODB_TransMonitor')
inherited

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.
b. CompleteTrans auto-detects SQL errors, and will rollback on errors, commit otherwise.
c. All BeginTrans/CommitTrans/RollbackTrans inside a StartTrans/CompleteTrans block are disabled, making it backward compatible.

◆ substr()

ADOConnection::substr ( $fld,
$start,
$length = 0 )
inherited

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

Parameters
string$fldThe field to sub-string
int$startThe start point
int$lengthAn optional length
Return values
stringThe SQL text

Reimplemented in ADODB_mssql, ADODB_mssqlnative, and ADODB_odbc_mssql.

◆ textMax()

ADOConnection::textMax ( )
inherited

Returns the maximum size of a MetaType X field.

If the method is not defined in the driver returns ADODB_STRINGMAX_NOTSET

Return values
int

Reimplemented in ADODB_mssqlnative, ADODB_odbc_mssql, and ADODB_sqlite.

◆ Time()

ADOConnection::Time ( )
inherited

Return the database server's current date and time.

Return values
int|false

Reimplemented in ADODB_oci8, and ADODB_pdo.

◆ UnixDate()

static ADOConnection::UnixDate ( $v)
staticinherited

Also in ADORecordSet.

Parameters
mixed$vis a date string in YYYY-MM-DD format
Return values
int|falseDate in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format

Reimplemented in ADODB_sybase.

◆ UnixTimeStamp()

static ADOConnection::UnixTimeStamp ( $v)
staticinherited

Also in ADORecordSet.

Parameters
string | object$vis a timestamp string in YYYY-MM-DD HH-NN-SS format
Return values
int|falseDate in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format

Reimplemented in ADODB_sybase.

◆ updateBlob()

ADOConnection::updateBlob ( $table,
$column,
$val,
$where,
$blobtype = 'BLOB' )
inherited

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');
Parameters
string$table
string$column
string$valFilename containing blob data
mixed$where{
See also
updateBlob()}
Parameters
string$blobtypesupports 'BLOB' (default) and 'CLOB'
Return values
boolsuccess

Reimplemented in ADODB_db2.

◆ updateBlobFile()

ADOConnection::updateBlobFile ( $table,
$column,
$path,
$where,
$blobtype = 'BLOB' )
inherited

Update a BLOB from a file.

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

Parameters
string$table
string$column
string$pathFilename containing blob data
mixed$where{
See also
updateBlob()}
Parameters
string$blobtypesupports 'BLOB' and 'CLOB'
Return values
boolsuccess

◆ UpdateClob()

ADOConnection::UpdateClob ( $table,
$column,
$val,
$where )
inherited

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

◆ UserDate()

ADOConnection::UserDate ( $v,
$fmt = 'Y-m-d',
$gmt = false )
inherited

Format database date based on user defined format.

Also in ADORecordSet.

Parameters
mixed$vDate in YYYY-MM-DD format, returned by database
string$fmtFormat to apply, using date()
bool$gmt
Return values
stringFormatted date

◆ UserTimeStamp()

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

Format timestamp based on user defined format.

Parameters
mixed$vDate in YYYY-MM-DD hh:mm:ss format
string$fmtFormat to apply, using date()
bool$gmt
Return values
stringFormatted timestamp

◆ Version()

static ADOConnection::Version ( )
staticinherited

ADOdb version.

Return values
string

Member Data Documentation

◆ $_errorCode

int false ADOConnection::$_errorCode = false
inherited

Stores the last returned error code.

Not guaranteed to be used. Only some drivers actually populate it.

◆ $_errorMsg

string false ADOConnection::$_errorMsg = false
inherited

Stores the last returned error message.

See also
ADOConnection\errorMsg()

◆ $connectionParameters

array ADOConnection::$connectionParameters = array()
protectedinherited

Additional parameters that may be passed to drivers in the connect string.

Data is stored as an array of arrays and not a simple associative array, because some drivers (e.g. mysql) allow multiple parameters with the same key to be set. @externalurl https://github.com/ADOdb/ADOdb/issues/187

See also
setConnectionParameter()

$connectionParameters Set of ParameterName => Value pairs

◆ $database

string ADOConnection::$database = ''
inherited

RDBMS currently in use, eg. odbc, mysql, mssql.

Current database name.

This used to be stored in the $databaseName property, which was marked as deprecated in 4.66 and removed in 5.22.5.

◆ $dsnType

string ADOConnection::$dsnType = ''
inherited

If the driver is PDO, then the dsnType is e.g.

sqlsrv, otherwise empty

◆ $evalAll

string ADOConnection::$evalAll = false
inherited

set to true if ADOConnection.Execute() permits binding of array parameters.

Eval string used to filter data. Only used in the deprecated Text driver.

See also
https://adodb.org/dokuwiki/doku.php?id=v5:database:text#workaround

◆ $identitySQL

string ADOConnection::$identitySQL
inherited

SQL statement to get the last IDENTITY value inserted into an IDENTITY column in the same scope.

See also
https://learn.microsoft.com/en-us/sql/t-sql/functions/scope-identity-transact-sql

◆ $memCache

bool ADOConnection::$memCache = false
inherited

cache for 1 hour

Use memCache library instead of caching in files. $memCache

◆ $memCacheCompress

bool ADOConnection::$memCacheCompress = false
inherited

Enable compression of stored items.

$memCacheCompress

◆ $memCacheHost

string array ADOConnection::$memCacheHost
inherited

The memcache server(s) to connect to.

Can be defined as:

◆ $memCacheOptions

array ADOConnection::$memCacheOptions = array()
inherited

An array of memcached options.

Only used with memcached; memcache ignores this setting. @externalurl https://www.php.net/manual/en/memcached.constants.php $memCacheOptions

◆ $memCachePort

int ADOConnection::$memCachePort = 11211
inherited

Default port number.

The default port can be overridden if memcache server connection data is provided as an array {

See also
$memCacheHost}. $memCachePort

◆ $metaDatabasesSQL

string ADOConnection::$metaDatabasesSQL = ''
inherited

character set to use - only for interbase, postgres and oci8

SQL statement to get databases

◆ $raiseErrorFn

bool callable ADOConnection::$raiseErrorFn = false
inherited

sequence id used by GenID();

Error function to call


The documentation for this class was generated from the following file: