Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Public Member Functions | |
__toString () | |
_close () | |
close() only needs to be called if you are worried about using too much memory while your script is running. | |
_fetch () | |
Row fetch stub. | |
_FetchField ($fieldOffset=-1) | |
Get column information in the Recordset object. | |
_initrs () | |
_seek ($row) | |
Adjusts the result pointer to an arbitrary row in the result. | |
absolutePage ($page=-1) | |
set/returns the current recordset page when paginating | |
AbsolutePosition () | |
synonym for CurrentRow – for ADO compat | |
AtFirstPage ($status=false) | |
set/returns the status of the atFirstPage flag when paginating | |
AtLastPage ($status=false) | |
set/returns the status of the atLastPage flag when paginating | |
Close () | |
Clean up recordset. | |
CurrentRow () | |
FetchField ($fieldOffset=-1) | |
fetchField ($fieldOffset) | |
Get a Field's metadata from database. | |
FetchInto (&$arr) | |
Fetch a row, returning PEAR_Error if no more rows. | |
FetchNextObj () | |
Return the fields array of the current row as an object for convenience. | |
FetchNextObject ($isUpper=true) | |
Return the fields array of the current row as an object for convenience. | |
FetchObj () | |
Return the fields array of the current row as an object for convenience. | |
FetchObject ($isUpper=true) | |
Return the fields array of the current row as an object for convenience. | |
FetchRow () | |
Fetch a row, returning false if no more rows. | |
FieldCount () | |
Fields ($colname) | |
Get the value of a field in the current row by column name. | |
fieldTypesArray () | |
Get Field metadata for all the recordset's columns in an array. | |
Free () | |
PEAR DB Compat - do not use internally. | |
GetAll ($nRows=-1) | |
GetArray ($nRows=-1) | |
return recordset as a 2-dimensional array. | |
GetArrayLimit ($nrows, $offset=-1) | |
getArrayLimit ($nrows, $offset=-1) | |
Return recordset as a 2-dimensional array. | |
getAssoc ($force_array=false, $first2cols=false) | |
return whole recordset as a 2-dimensional associative array if there are more than 2 columns. | |
GetAssocKeys ($upper=ADODB_ASSOC_CASE) | |
Builds the bind array associating keys to recordset fields. | |
getIterator () | |
getMenu ($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='', $compareFirstCol=true) | |
Generate a SELECT tag from a recordset, and return the HTML markup. | |
getMenu2 ($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='') | |
Generate a SELECT tag from a recordset, and return the HTML markup. | |
getMenu3 ($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='') | |
Generate a SELECT tag with groups from a recordset, and return the HTML markup. | |
getMenuGrouped ($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='', $compareFirstCol=true) | |
Generate a SELECT tag with groups from a recordset, and return the HTML markup. | |
GetRowAssoc ($upper=ADODB_ASSOC_CASE) | |
Use associative array to get fields array for databases that do not support associative arrays. | |
getRows ($nRows=-1) | |
Synonym for GetArray() for compatibility with ADO. | |
Init () | |
LastPageNo ($page=false) | |
MaxRecordCount () | |
If we are using PageExecute(), this will return the maximum possible rows that can be returned when paging a recordset. | |
MetaType ($t, $len=-1, $fieldobj=false) | |
not the fastest implementation - quick and dirty - jlim for best performance, use the actual $rs->MetaType(). | |
metaType ($t, $len=-1, $fieldObj=false) | |
Get the ADOdb metatype. | |
Move ($rowNumber=0) | |
Random access to a specific row in the recordset. | |
MoveFirst () | |
Move to the first row in the recordset. | |
MoveLast () | |
Move to the last row in the recordset. | |
MoveNext () | |
Move to next record in the recordset. | |
NextRecordSet () | |
Checks if there is another available recordset. | |
NumCols () | |
PEAR DB compat, number of cols. | |
NumRows () | |
PEAR DB compat, number of rows. | |
PO_RecordCount ($table="", $condition="") | |
Portable RecordCount. | |
recordCount () | |
Number of rows in recordset. | |
rowCount () | |
Number of rows in recordset. | |
UserDate ($v, $fmt='Y-m-d') | |
UserTimeStamp ($v, $fmt='Y-m-d H:i:s') | |
Static Public Member Functions | |
static | UnixDate ($v) |
static | UnixTimeStamp ($v) |
Public Attributes | |
$_atFirstPage = false | |
Added by Iván Oliva to implement recordset pagination. | |
$_atLastPage = false | |
Added by Iván Oliva to implement recordset pagination. | |
$_closed = false | |
This variable keeps the current row in the Recordset. | |
$_currentPage = -1 | |
Used by FetchObj. | |
$_currentRow = -1 | |
$_fieldobjs | |
$_inited = false | |
has recordset been closed | |
$_lastPageNo = -1 | |
Added by Iván Oliva to implement recordset pagination. | |
$_maxRecordCount = 0 | |
$_names | |
Used by FetchObj. | |
$_numOfFields = -1 | |
number of rows, or -1 | |
$_numOfRows = -1 | |
private variables | |
$_obj | |
Init() should only be called once. | |
resource int false | $_queryID = self::DUMMY_QUERY_ID |
number of fields in recordset | |
resource | $_refcursor |
Cursor reference. | |
int | $adodbFetchMode |
Defines the Fetch Mode for a recordset See the ADODB_FETCH_* constants. | |
$bind =false | |
$blobSize = 100 | |
holds the current row data | |
$canSeek = false | |
any varchar/char field this size or greater is treated as a blob in other words, we use a text area for editing. | |
ADOConnection | $connection = false |
default fetch mode | |
$customActualTypes | |
$customMetaTypes | |
$databaseType = 'oci8quercus' | |
$dataProvider = "native" | |
public variables | |
$datetime = false | |
$debug = false | |
what to display when $time==0 | |
$emptyDate = ' ' | |
what to display when $time==0 | |
$emptyTimeStamp = ' ' | |
Indicates that the current record position is after the last record in a Recordset object. | |
$EOF = false | |
sql text | |
$fetchMode | |
used by Fields() to hold array - should be private? | |
bool array | $fields = false |
int | $insertSig |
Only used in _adodb_getinsertsql() | |
$sql | |
indicates that seek is supported | |
string | $tableName = '' |
Table name (used in _adodb_getupdatesql() and _adodb_getinsertsql())-. | |
$timeCreated =0 | |
const | DUMMY_QUERY_ID = -1 |
Used for cases when a recordset object is not created by executing a query. | |
Protected Member Functions | |
_initRS () | |
Recordset initialization stub. | |
_updatefields () | |
Convert case of field names associative array, if needed. | |
AssocCaseConvertFunction ($case=ADODB_ASSOC_CASE) | |
Defines the function to use for table fields case conversion depending on ADODB_ASSOC_CASE. | |
Protected Attributes | |
ADOFieldObject[] | $fieldObjectsCache |
Field metadata cache. | |
|
inherited |
close() only needs to be called if you are worried about using too much memory while your script is running.
All associated result memory for the specified result identifier will automatically be freed.
Reimplemented from ADORecordSet.
|
inherited |
Row fetch stub.
bool |
Reimplemented from ADORecordSet.
Reimplemented in ADORecordset_oci8po.
ADORecordset_oci8quercus::_FetchField | ( | $fieldOffset = -1 | ) |
Get column information in the Recordset object.
fetchField() can be used in order to obtain information about fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by fetchField() is retrieved
object | containing field information |
Reimplemented from ADORecordset_oci8.
|
protectedinherited |
Recordset initialization stub.
Reimplemented in ADORecordSet_postgres64.
|
inherited |
Adjusts the result pointer to an arbitrary row in the result.
int | $row | The row to seek to. |
bool | False if the recordset contains no rows, otherwise true. |
Reimplemented from ADORecordSet.
|
protectedinherited |
Convert case of field names associative array, if needed.
void |
|
inherited |
set/returns the current recordset page when paginating
int | $page |
int |
|
inherited |
synonym for CurrentRow – for ADO compat
the | current row in the recordset. If at EOF, will return the last row. 0-based. |
|
protectedinherited |
Defines the function to use for table fields case conversion depending on ADODB_ASSOC_CASE.
int | [$case] |
string | strtolower/strtoupper or false if no conversion needed |
|
inherited |
set/returns the status of the atFirstPage flag when paginating
bool | $status |
bool |
|
inherited |
set/returns the status of the atLastPage flag when paginating
bool | $status |
bool |
|
inherited |
Clean up recordset.
bool |
|
inherited |
the | current row in the recordset. If at EOF, will return the last row. 0-based. |
|
inherited |
Get a Field's metadata from database.
Must be defined by child class.
int | $fieldOffset |
ADOFieldObject|false |
Reimplemented in ADORecordSet_array_pdo_firebird, ADORecordSet_array_pdo_sqlsrv, ADORecordSet_db2, ADORecordset_firebird, ADORecordset_mssqlnative, ADORecordSet_pdo_firebird, ADORecordSet_pdo_sqlsrv, and ADORecordSet_postgres64.
|
inherited |
Fetch a row, returning PEAR_Error if no more rows.
This is PEAR DB compat mode.
mixed[] | false | $arr |
mixed | DB_OK or error object |
|
inherited |
Return the fields array of the current row as an object for convenience.
The default is lower-case field names.
ADOFetchObj|false | The object with properties set to the fields of the current row or false if EOF. |
Fixed bug reported by tim@o.nosp@m.rote.nosp@m.ch.ne.nosp@m.t
|
inherited |
Return the fields array of the current row as an object for convenience.
The default is upper case field names.
bool | $isUpper | to set the object property names to uppercase |
ADOFetchObj|false | The object with properties set to the fields of the current row or false if EOF. |
Fixed bug reported by tim@o.nosp@m.rote.nosp@m.ch.ne.nosp@m.t
|
inherited |
Return the fields array of the current row as an object for convenience.
The default case is lowercase field names.
the | object with the properties set to the fields of the current row |
|
inherited |
Return the fields array of the current row as an object for convenience.
The default case is uppercase.
bool | $isUpper | to set the object property names to uppercase |
ADOFetchObj | The object with properties set to the fields of the current row |
|
inherited |
Fetch a row, returning false if no more rows.
This is PEAR DB compat mode.
mixed[]|false | false or array containing the current record |
|
inherited |
the | number of columns in the recordset. Some databases will set this to 0 if no records are returned, others will return the number of columns in the query. |
|
inherited |
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.
string | $colname | is the field to access |
mixed | the value of $colname column |
Reimplemented from ADORecordSet.
Reimplemented in ADORecordset_oci8po.
|
inherited |
Get Field metadata for all the recordset's columns in an array.
ADOFieldObject[] |
|
inherited |
return recordset as a 2-dimensional array.
int | $nRows | Number of rows to return. -1 means every row. |
array | indexed by the rows (0-based) from the recordset |
Reimplemented in ADORecordSet_array.
|
inherited |
Return recordset as a 2-dimensional array.
Helper function for ADOConnection->SelectLimit()
int | $nrows | Number of rows to return |
int | $offset | Starting row (1-based) |
array | an array indexed by the rows (0-based) from the recordset |
Reimplemented in ADORecordSet_db2.
|
inherited |
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()
bool | $force_array | (optional) Has only meaning if we have 2 data columns. If false, a 1 dimensional array is returned, otherwise a 2 dimensional array is returned. If this sounds confusing, read the source. |
bool | $first2cols | (optional) Means if there are more than 2 cols, ignore the remaining cols and instead of returning array[col0] => array(remaining cols), return array[col0] => col1 |
mixed[]|false |
|
inherited |
Builds the bind array associating keys to recordset fields.
int | [$upper] Case for the array keys, defaults to uppercase (see ADODB_ASSOC_CASE_xxx constants) |
|
inherited |
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.
string | $name | Name of SELECT tag |
string | array | $defstr | The value to highlight. Use an array for multiple highlight values. |
bool | string | $blank1stItem | True to create an empty item (default), False not to add one; 'string' to set its label and 'value:string' to assign a value to it. |
bool | $multiple | True for multi-select list |
int | $size | Number of rows to show (applies to multi-select box only) |
string | $selectAttr | Additional attributes to defined for SELECT tag, useful for holding javascript onChange='...' handlers, CSS class, etc. |
bool | $compareFirstCol | When true (default), $defstr is compared against the value (column 2), while false will compare against the description (column 1). |
string | HTML |
|
inherited |
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).
string | $name | Name of SELECT tag |
string | array | $defstr | The value to highlight. Use an array for multiple highlight values. |
bool | string | $blank1stItem | True to create an empty item (default), False not to add one; 'string' to set its label and 'value:string' to assign a value to it. |
bool | $multiple | True for multi-select list |
int | $size | Number of rows to show (applies to multi-select box only) |
string | $selectAttr | Additional attributes to defined for SELECT tag, useful for holding javascript onChange='...' handlers, CSS class, etc. |
string | HTML |
|
inherited |
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).
string | $name | Name of SELECT tag |
string | array | $defstr | The value to highlight. Use an array for multiple highlight values. |
bool | string | $blank1stItem | True to create an empty item (default), False not to add one; 'string' to set its label and 'value:string' to assign a value to it. |
bool | $multiple | True for multi-select list |
int | $size | Number of rows to show (applies to multi-select box only) |
string | $selectAttr | Additional attributes to defined for SELECT tag, useful for holding javascript onChange='...' handlers, CSS class, etc. |
string | HTML |
|
inherited |
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.
string | $name | Name of SELECT tag |
string | array | $defstr | The value to highlight. Use an array for multiple highlight values. |
bool | string | $blank1stItem | True to create an empty item (default), False not to add one; 'string' to set its label and 'value:string' to assign a value to it. |
bool | $multiple | True for multi-select list |
int | $size | Number of rows to show (applies to multi-select box only) |
string | $selectAttr | Additional attributes to defined for SELECT tag, useful for holding javascript onChange='...' handlers, CSS class, etc. |
bool | $compareFirstCol | When true (default), $defstr is compared against the value (column 2), while false will compare against the description (column 1). |
string | HTML |
|
inherited |
Use associative array to get fields array for databases that do not support associative arrays.
Submitted by Paolo S. Asioli paolo.asioli\libero.it
int | $upper | Case for the array keys, defaults to uppercase (see ADODB_ASSOC_CASE_xxx constants) |
array |
Reimplemented in ADORecordSet_ldap, and ADORecordSet_postgres64.
|
inherited |
Synonym for GetArray() for compatibility with ADO.
int | $nRows | Number of rows to return. -1 means every row. |
array | an array indexed by the rows (0-based) from the recordset |
|
inherited |
Reimplemented from ADORecordSet.
|
inherited |
bool | $page |
bool |
|
inherited |
If we are using PageExecute(), this will return the maximum possible rows that can be returned when paging a recordset.
int |
|
inherited |
not the fastest implementation - quick and dirty - jlim for best performance, use the actual $rs->MetaType().
mixed | $t | |
int | $len | [optional] Length of blobsize |
bool | $fieldobj | [optional][discarded] |
str | The metatype of the field |
|
inherited |
Get the ADOdb metatype.
Many databases use different names for the same type, so we transform the native type to our standardised one, which uses 1 character codes.
string | ADOFieldObject | $t | Native type (usually ADOFieldObject->type) It is also possible to provide an ADOFieldObject here. |
int | $len | The field's maximum length. This is because we treat character fields bigger than a certain size as a 'B' (blob). |
ADOFieldObject | $fieldObj | Field object returned by the database driver; can hold additional info (eg. primary_key for mysql). |
string | The ADOdb Standard type |
Reimplemented in ADORecordset_firebird.
|
inherited |
Random access to a specific row in the recordset.
Some databases do not support access to previous rows in the databases (no scrolling backwards).
int | $rowNumber | is the row to move to (0-based) |
bool | true if there still rows available, or false if there are no more rows (EOF). |
|
inherited |
Move to the first row in the recordset.
Many databases do NOT support this.
bool | true or false |
Reimplemented in ADORecordset_informix72, and ADORecordSet_odbtp.
|
inherited |
Move to the last row in the recordset.
bool | true or false |
Reimplemented in ADORecordset_informix72, and ADORecordSet_odbtp.
|
inherited |
Move to next record in the recordset.
bool | true if there still rows available, or false if there are no more rows (EOF). |
Reimplemented from ADORecordSet.
Reimplemented in ADORecordset_oci8po.
|
inherited |
Checks if there is another available recordset.
Some databases allow multiple recordsets to be returned.
boolean | true if there is a next recordset, or false if no more |
Reimplemented in ADORecordSet_ado, ADORecordSet_ado, ADORecordset_mssql, ADORecordset_mssqlnative, and ADORecordSet_odbtp.
|
inherited |
PEAR DB compat, number of cols.
int |
|
inherited |
PEAR DB compat, number of rows.
int |
|
inherited |
Portable RecordCount.
Be aware of possible problems in multiuser environments. For better speed the table must be indexed by the condition. Heavy test this before deploying.
string | $table | |
string | $condition |
int | Number of records from a previous SELECT. All databases support this. |
|
inherited |
Number of rows in recordset.
int | Number of rows or -1 if this is not supported |
|
inherited |
Number of rows in recordset.
Alias for {
int | Number of rows or -1 if this is not supported |
|
staticinherited |
mixed | $v | is a date string in YYYY-MM-DD format |
string | date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format |
Reimplemented in ADORecordSet_array_sybase, and ADORecordset_sybase.
|
staticinherited |
string | object | $v | is a timestamp string in YYYY-MM-DD HH-NN-SS format |
mixed | date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format |
Reimplemented in ADORecordSet_array_sybase, and ADORecordset_sybase.
|
inherited |
mixed | $v | is the character date in YYYY-MM-DD format, returned by database |
string | $fmt | is the format to apply to it, using date() |
string | a date formatted as user desires |
|
inherited |
mixed | $v | is the character timestamp in YYYY-MM-DD hh:mm:ss format |
string | [$fmt] is the format to apply to it, using date() |
string | a timestamp formated as user desires |
|
inherited |
This variable keeps the current row in the Recordset.
|
inherited |
number of fields in recordset
result link identifier
|
inherited |
default fetch mode
The parent connection
|
protectedinherited |
Field metadata cache.