Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

(no description)

File Size: 1712 lines (46 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

ADODB_mysqli:: (36 methods):
  SetTransactionMode()
  _connect()
  _pconnect()
  _nconnect()
  IfNull()
  GetOne()
  ServerInfo()
  BeginTrans()
  CommitTrans()
  RollbackTrans()
  RowLock()
  qStr()
  _insertid()
  _affectedrows()
  CreateSequence()
  GenID()
  MetaDatabases()
  MetaIndexes()
  SQLDate()
  Concat()
  OffsetDate()
  MetaProcedures()
  MetaTables()
  MetaForeignKeys()
  MetaColumns()
  SelectDB()
  SelectLimit()
  Prepare()
  _query()
  ErrorMsg()
  ErrorNo()
  _close()
  CharMax()
  TextMax()
  GetCharSet()
  SetCharSet()

ADORecordSet_mysqli:: (11 methods):
  __construct()
  _initrs()
  FetchField()
  GetRowAssoc()
  Fields()
  _seek()
  NextRecordSet()
  MoveNext()
  _fetch()
  _close()
  MetaType()

ADORecordSet_array_mysqli:: (1 method):
  MetaType()


Class: ADODB_mysqli  - X-Ref

Class ADODB_mysqli

SetTransactionMode($transaction_mode)   X-Ref
Sets the isolation level of a transaction.

param: string $transaction_mode The transaction mode to set.
return: void

_connect($argHostname = null,$argUsername = null,$argPassword = null,$argDatabasename = null,$persist = false)   X-Ref
Connect to a database.

param: string|null $argHostname (Optional) The host to connect to.
param: string|null $argUsername (Optional) The username to connect as.
param: string|null $argPassword (Optional) The password to connect with.
param: string|null $argDatabasename (Optional) The name of the database to start in when connected.
param: bool $persist (Optional) Whether or not to use a persistent connection.
return: bool|null True if connected successfully, false if connection failed, or null if the mysqli extension

_pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)   X-Ref
Connect to a database with a persistent connection.

param: string|null $argHostname The host to connect to.
param: string|null $argUsername The username to connect as.
param: string|null $argPassword The password to connect with.
param: string|null $argDatabasename The name of the database to start in when connected.
return: bool|null True if connected successfully, false if connection failed, or null if the mysqli extension

_nconnect($argHostname, $argUsername, $argPassword, $argDatabasename)   X-Ref
Connect to a database, whilst setting $this->forceNewConnect to true.

When is this used? Close old connection first?
In _connect(), check $this->forceNewConnect?

param: string|null $argHostname The host to connect to.
param: string|null $argUsername The username to connect as.
param: string|null $argPassword The password to connect with.
param: string|null $argDatabasename The name of the database to start in when connected.
return: bool|null True if connected successfully, false if connection failed, or null if the mysqli extension

IfNull($field, $ifNull)   X-Ref
Replaces a null value with a specified replacement.

param: mixed $field The field in the table to check.
param: mixed $ifNull The value to replace the null value with if it is found.
return: string

GetOne($sql, $inputarr = false)   X-Ref
Retrieves the first column of the first matching row of an executed SQL statement.

param: string $sql The SQL to execute.
param: bool|array $inputarr (Optional) An array containing any required SQL parameters, or false if none needed.
return: bool|array|null

ServerInfo()   X-Ref
Get information about the current MySQL server.

return: array

BeginTrans()   X-Ref
Begins a granular transaction.

return: bool Always returns true.

CommitTrans($ok = true)   X-Ref
Commits a granular transaction.

param: bool $ok (Optional) If false, will rollback the transaction instead.
return: bool Always returns true.

RollbackTrans()   X-Ref
Rollback a smart transaction.

return: bool Always returns true.

RowLock($tables, $where = '', $col = '1 as adodbignore')   X-Ref
Lock a table row for a duration of a transaction.

param: string $tables The table(s) to lock rows for.
param: string $where (Optional) The WHERE clause to use to determine which rows to lock.
param: string $col (Optional) The columns to select.
return: bool True if the locking SQL statement executed successfully, otherwise false.

qStr($s, $magic_quotes=false)   X-Ref
Appropriately quotes strings with ' characters for insertion into the database.

Relies on mysqli_real_escape_string()
param: string $s            The string to quote
param: bool   $magic_quotes This param is not used since 5.21.0.
return: string Quoted string

_insertid()   X-Ref
Return the AUTO_INCREMENT id of the last row that has been inserted or updated in a table.

return: int|string

_affectedrows()   X-Ref
Returns how many rows were effected by the most recently executed SQL statement.
Only works for INSERT, UPDATE and DELETE queries.

return: int The number of rows affected.

CreateSequence($seqname = 'adodbseq', $startID = 1)   X-Ref
Creates a sequence in the database.

param: string $seqname The sequence name.
param: int $startID The start id.
return: ADORecordSet|bool A record set if executed successfully, otherwise false.

GenID($seqname = 'adodbseq', $startID = 1)   X-Ref
A portable method of creating sequence numbers.

param: string $seqname (Optional) The name of the sequence to use.
param: int $startID (Optional) The point to start at in the sequence.
return: bool|int|string

MetaDatabases()   X-Ref
Return a list of all visible databases except the 'mysql' database.

return: array|false An array of database names, or false if the query failed.

MetaIndexes($table, $primary = false, $owner = false)   X-Ref
Get a list of indexes on the specified table.

param: string $table The name of the table to get indexes for.
param: bool $primary (Optional) Whether or not to include the primary key.
param: bool $owner (Optional) Unused.
return: array|bool An array of the indexes, or false if the query to get the indexes failed.

SQLDate($fmt, $col = false)   X-Ref
Returns a portably-formatted date string from a timestamp database column.

param: string $fmt The date format to use.
param: string|bool $col (Optional) The table column to date format, or if false, use NOW().
return: bool|string The SQL DATE_FORMAT() string, or false if the provided date format was empty.

Concat()   X-Ref
Returns a database-specific concatenation of strings.

return: string

OffsetDate($dayFraction, $date = false)   X-Ref
Creates a portable date offset field, for use in SQL statements.

param: float $dayFraction A day in floating point
param: string|bool $date (Optional) The date to offset. If false, uses CURDATE()
return: string

MetaProcedures($NamePattern = false, $catalog = null, $schemaPattern = null)   X-Ref
Returns information about stored procedures and stored functions.

param: string|bool $NamePattern (Optional) Only look for procedures/functions with a name matching this pattern.
param: null $catalog (Optional) Unused.
param: null $schemaPattern (Optional) Unused.
return: array

MetaTables($ttype = false, $showSchema = false, $mask = false)   X-Ref
Retrieves a list of tables based on given criteria

param: string|bool $ttype (Optional) Table type = 'TABLE', 'VIEW' or false=both (default)
param: string|bool $showSchema (Optional) schema name, false = current schema (default)
param: string|bool $mask (Optional) filters the table by name
return: array list of tables

MetaForeignKeys($table, $owner = false, $upper = false, $associative = false)   X-Ref
Return information about a table's foreign keys.

param: string $table The name of the table to get the foreign keys for.
param: string|bool $owner (Optional) The database the table belongs to, or false to assume the current db.
param: string|bool $upper (Optional) Force uppercase table name on returned array keys.
param: bool $associative (Optional) Whether to return an associate or numeric array.
return: array|bool An array of foreign keys, or false no foreign keys could be found.

MetaColumns($table, $normalize = true)   X-Ref
Return an array of information about a table's columns.

param: string $table The name of the table to get the column info for.
param: bool $normalize (Optional) Unused.
return: ADOFieldObject[]|bool An array of info for each column, or false if it could not determine the info.

SelectDB($dbName)   X-Ref
Select which database to connect to.

param: string $dbName The name of the database to select.
return: bool True if the database was selected successfully, otherwise false.

SelectLimit($sql,$nrows = -1,$offset = -1,$inputarr = false,$secs = 0)   X-Ref
Executes a provided SQL statement and returns a handle to the result, with the ability to supply a starting
offset and record count.

param: string $sql The SQL to execute.
param: int $nrows (Optional) The limit for the number of records you want returned. By default, all results.
param: int $offset (Optional) The offset to use when selecting the results. By default, no offset.
param: array|bool $inputarr (Optional) Any parameter values required by the SQL statement, or false if none.
param: int $secs (Optional) If greater than 0, perform a cached execute. By default, normal execution.
return: ADORecordSet|false The query results, or false if the query failed to execute.

Prepare($sql)   X-Ref
Prepares an SQL statement and returns a handle to use.

param: string $sql The SQL to prepare.
return: string The original SQL that was provided.

_query($sql, $inputarr)   X-Ref
Return the query id.

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

ErrorMsg()   X-Ref
Returns a database specific error message.

return: string The last error message.

ErrorNo()   X-Ref
Returns the last error number from previous database operation.

return: int The last error number.

_close()   X-Ref
Close the database connection.

return: void

CharMax()   X-Ref
Returns the largest length of data that can be inserted into a character field.

return: int

TextMax()   X-Ref
Returns the largest length of data that can be inserted into a text field.

return: int

GetCharSet()   X-Ref
Get the name of the character set the client connection is using now.

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

SetCharSet($charset_name)   X-Ref
Sets the character set for database connections (limited databases).

param: string $charset_name The character set to switch to.
return: bool True if the character set was changed successfully, otherwise false.

Class: ADORecordSet_mysqli  - X-Ref

Class ADORecordSet_mysqli

__construct($queryID, $mode = false)   X-Ref
No description

_initrs()   X-Ref
No description

FetchField($fieldOffset = -1)   X-Ref
Returns raw, database specific information about a field.

param: int $fieldOffset (Optional) The field number to get information for.
return: ADOFieldObject|bool

GetRowAssoc($upper = ADODB_ASSOC_CASE)   X-Ref
Reads a row in associative mode if the recordset fetch mode is numeric.
Using this function when the fetch mode is set to ADODB_FETCH_ASSOC may produce unpredictable results.

param: int $upper Indicates whether the keys of the recordset should be upper case or lower case.
return: array|bool

Fields($colname)   X-Ref
Returns a single field in a single row of the current recordset.

param: string $colname The name of the field to retrieve.
return: mixed

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

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

NextRecordSet()   X-Ref
In databases that allow accessing of recordsets, retrieves the next set.

return: bool

MoveNext()   X-Ref
Moves the cursor to the next record of the recordset from the current position.

return: bool False if there are no more records to move on to, otherwise true.

_fetch()   X-Ref
Attempt to fetch a result row using the current fetch mode and return whether or not this was successful.

return: bool True if row was fetched successfully, otherwise false.

_close()   X-Ref
Frees the memory associated with a result.

return: void

MetaType($t, $len = -1, $fieldobj = false)   X-Ref
Get the MetaType character for a given field type.

param: string|object $t The type to get the MetaType character for.
param: int $len (Optional) Redundant. Will always be set to -1.
param: bool|object $fieldobj (Optional)
return: string The MetaType

Class: ADORecordSet_array_mysqli  - X-Ref

Class ADORecordSet_array_mysqli

MetaType($t, $len = -1, $fieldobj = false)   X-Ref
Get the MetaType character for a given field type.

param: string|object $t The type to get the MetaType character for.
param: int $len (Optional) Redundant. Will always be set to -1.
param: bool|object $fieldobj (Optional)
return: string The MetaType