Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
ADORecordSet_array_sybase Class Reference
Inheritance diagram for ADORecordSet_array_sybase:
ADORecordSet_array ADORecordSet

Public Member Functions

 __toString ()
 
 _close ()
 
 _fetch ()
 
 _initrs ()
 
 _seek ($row)
 
 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)
 Use associative array to get fields array.
 
 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)
 
 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 ()
 
 InitArray ($array, $typearr, $colnames=false)
 Setup the array.
 
 InitArrayFields (&$array, &$fieldarr)
 Setup the Array and datatype file objects.
 
 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)
 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 ()
 
 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

 $_array
 
 $_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.
 
 $_colnames
 
 $_currentPage = -1
 Used by FetchObj.
 
 $_currentRow = -1
 
 $_fieldobjects
 
 $_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
 
 $_skiprow1
 
 $_types
 
int $adodbFetchMode
 Defines the Fetch Mode for a recordset See the ADODB_FETCH_* constants.
 
 $affectedrows = false
 
 $bind = false
 datetime in Unix format rs created – for cached recordsets
 
 $blobSize = 100
 holds the current row data
 
 $canSeek = true
 
 $compat = false
 
ADOConnection $connection = false
 default fetch mode
 
 $customActualTypes
 
 $customMetaTypes
 
 $databaseType = 'array'
 
 $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
 
 $insertid = false
 
int $insertSig
 Only used in _adodb_getinsertsql()
 
 $sql = ''
 
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.
 

Member Function Documentation

◆ _close()

ADORecordSet_array::_close ( )
inherited

Reimplemented from ADORecordSet.

◆ _fetch()

ADORecordSet_array::_fetch ( )
inherited
Return values
bool

Reimplemented from ADORecordSet.

◆ _initRS()

ADORecordSet::_initRS ( )
protectedinherited

Recordset initialization stub.

Reimplemented in ADORecordSet_postgres64.

◆ _seek()

ADORecordSet_array::_seek ( $row)
inherited
Parameters
int$row
Return values
bool

Reimplemented from ADORecordSet.

◆ _updatefields()

ADORecordSet::_updatefields ( )
protectedinherited

Convert case of field names associative array, if needed.

Return values
void

◆ absolutePage()

ADORecordSet::absolutePage ( $page = -1)
inherited

set/returns the current recordset page when paginating

Parameters
int$page
Return values
int

◆ AbsolutePosition()

ADORecordSet::AbsolutePosition ( )
inherited

synonym for CurrentRow – for ADO compat

Return values
thecurrent row in the recordset. If at EOF, will return the last row. 0-based.

◆ AssocCaseConvertFunction()

ADORecordSet::AssocCaseConvertFunction ( $case = ADODB_ASSOC_CASE)
protectedinherited

Defines the function to use for table fields case conversion depending on ADODB_ASSOC_CASE.

Parameters
int[$case]
Return values
stringstrtolower/strtoupper or false if no conversion needed

◆ AtFirstPage()

ADORecordSet::AtFirstPage ( $status = false)
inherited

set/returns the status of the atFirstPage flag when paginating

Parameters
bool$status
Return values
bool

◆ AtLastPage()

ADORecordSet::AtLastPage ( $status = false)
inherited

set/returns the status of the atLastPage flag when paginating

Parameters
bool$status
Return values
bool

◆ Close()

ADORecordSet::Close ( )
inherited

Clean up recordset.

Return values
bool

◆ CurrentRow()

ADORecordSet::CurrentRow ( )
inherited
Return values
thecurrent row in the recordset. If at EOF, will return the last row. 0-based.

◆ FetchField()

ADORecordSet_array::FetchField ( $fieldOffset = -1)
inherited
Parameters
int[$fieldOffset]
Return values
ADOFieldObject

◆ fetchField()

ADORecordSet::fetchField ( $fieldOffset)
inherited

Get a Field's metadata from database.

Must be defined by child class.

Parameters
int$fieldOffset
Return values
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.

◆ FetchInto()

ADORecordSet::FetchInto ( & $arr)
inherited

Fetch a row, returning PEAR_Error if no more rows.

This is PEAR DB compat mode.

Parameters
mixed[] | false$arr
Return values
mixedDB_OK or error object

◆ FetchNextObj()

ADORecordSet::FetchNextObj ( )
inherited

Return the fields array of the current row as an object for convenience.

The default is lower-case field names.

Return values
ADOFetchObj|falseThe 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

◆ FetchNextObject()

ADORecordSet::FetchNextObject ( $isUpper = true)
inherited

Return the fields array of the current row as an object for convenience.

The default is upper case field names.

Parameters
bool$isUpperto set the object property names to uppercase
Return values
ADOFetchObj|falseThe 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

◆ FetchObj()

ADORecordSet::FetchObj ( )
inherited

Return the fields array of the current row as an object for convenience.

The default case is lowercase field names.

Return values
theobject with the properties set to the fields of the current row

◆ FetchObject()

ADORecordSet::FetchObject ( $isUpper = true)
inherited

Return the fields array of the current row as an object for convenience.

The default case is uppercase.

Parameters
bool$isUpperto set the object property names to uppercase
Return values
ADOFetchObjThe object with properties set to the fields of the current row

◆ FetchRow()

ADORecordSet::FetchRow ( )
inherited

Fetch a row, returning false if no more rows.

This is PEAR DB compat mode.

Return values
mixed[]|falsefalse or array containing the current record

◆ FieldCount()

ADORecordSet::FieldCount ( )
inherited
Return values
thenumber 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.

◆ Fields()

ADORecordSet_array::Fields ( $colname)
inherited

Use associative array to get fields array.

Parameters
string$colname
Return values
mixed

Reimplemented from ADORecordSet.

◆ fieldTypesArray()

ADORecordSet::fieldTypesArray ( )
inherited

Get Field metadata for all the recordset's columns in an array.

Return values
ADOFieldObject[]

◆ GetArray()

ADORecordSet_array::GetArray ( $nRows = -1)
inherited
Parameters
int[$nRows]
Return values
array

Reimplemented from ADORecordSet.

◆ getArrayLimit()

ADORecordSet::getArrayLimit ( $nrows,
$offset = -1 )
inherited

Return recordset as a 2-dimensional array.

Helper function for ADOConnection->SelectLimit()

Parameters
int$nrowsNumber of rows to return
int$offsetStarting row (1-based)
Return values
arrayan array indexed by the rows (0-based) from the recordset

Reimplemented in ADORecordSet_db2.

◆ getAssoc()

ADORecordSet::getAssoc ( $force_array = false,
$first2cols = false )
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()

Parameters
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
Return values
mixed[]|false

◆ GetAssocKeys()

ADORecordSet::GetAssocKeys ( $upper = ADODB_ASSOC_CASE)
inherited

Builds the bind array associating keys to recordset fields.

Parameters
int[$upper] Case for the array keys, defaults to uppercase (see ADODB_ASSOC_CASE_xxx constants)

◆ getMenu()

ADORecordSet::getMenu ( $name,
$defstr = '',
$blank1stItem = true,
$multiple = false,
$size = 0,
$selectAttr = '',
$compareFirstCol = true )
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.

Parameters
string$nameName of SELECT tag
string | array$defstrThe value to highlight. Use an array for multiple highlight values.
bool | string$blank1stItemTrue 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$multipleTrue for multi-select list
int$sizeNumber of rows to show (applies to multi-select box only)
string$selectAttrAdditional attributes to defined for SELECT tag, useful for holding javascript onChange='...' handlers, CSS class, etc.
bool$compareFirstColWhen true (default), $defstr is compared against the value (column 2), while false will compare against the description (column 1).
Return values
stringHTML

◆ getMenu2()

ADORecordSet::getMenu2 ( $name,
$defstr = '',
$blank1stItem = true,
$multiple = false,
$size = 0,
$selectAttr = '' )
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).

Parameters
string$nameName of SELECT tag
string | array$defstrThe value to highlight. Use an array for multiple highlight values.
bool | string$blank1stItemTrue 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$multipleTrue for multi-select list
int$sizeNumber of rows to show (applies to multi-select box only)
string$selectAttrAdditional attributes to defined for SELECT tag, useful for holding javascript onChange='...' handlers, CSS class, etc.
Return values
stringHTML
Deprecated
5.21.0 Use getMenu() with $compareFirstCol = false instead.

◆ getMenu3()

ADORecordSet::getMenu3 ( $name,
$defstr = '',
$blank1stItem = true,
$multiple = false,
$size = 0,
$selectAttr = '' )
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).

Parameters
string$nameName of SELECT tag
string | array$defstrThe value to highlight. Use an array for multiple highlight values.
bool | string$blank1stItemTrue 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$multipleTrue for multi-select list
int$sizeNumber of rows to show (applies to multi-select box only)
string$selectAttrAdditional attributes to defined for SELECT tag, useful for holding javascript onChange='...' handlers, CSS class, etc.
Return values
stringHTML
Deprecated
5.21.0 Use getMenuGrouped() with $compareFirstCol = false instead.

◆ getMenuGrouped()

ADORecordSet::getMenuGrouped ( $name,
$defstr = '',
$blank1stItem = true,
$multiple = false,
$size = 0,
$selectAttr = '',
$compareFirstCol = true )
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.

Parameters
string$nameName of SELECT tag
string | array$defstrThe value to highlight. Use an array for multiple highlight values.
bool | string$blank1stItemTrue 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$multipleTrue for multi-select list
int$sizeNumber of rows to show (applies to multi-select box only)
string$selectAttrAdditional attributes to defined for SELECT tag, useful for holding javascript onChange='...' handlers, CSS class, etc.
bool$compareFirstColWhen true (default), $defstr is compared against the value (column 2), while false will compare against the description (column 1).
Return values
stringHTML

◆ GetRowAssoc()

ADORecordSet::GetRowAssoc ( $upper = ADODB_ASSOC_CASE)
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

Parameters
int$upperCase for the array keys, defaults to uppercase (see ADODB_ASSOC_CASE_xxx constants)
Return values
array

Reimplemented in ADORecordSet_ldap, and ADORecordSet_postgres64.

◆ getRows()

ADORecordSet::getRows ( $nRows = -1)
inherited

Synonym for GetArray() for compatibility with ADO.

Parameters
int$nRowsNumber of rows to return. -1 means every row.
Return values
arrayan array indexed by the rows (0-based) from the recordset

◆ InitArray()

ADORecordSet_array::InitArray ( $array,
$typearr,
$colnames = false )
inherited

Setup the array.

Parameters
arrayis a 2-dimensional array holding the data. The first row should hold the column names unless parameter $colnames is used.
typearrholds an array of types. These are the same types used in MetaTypes (C,B,L,I,N).
string[]|false[$colnames] array of column names. If set, then the first row of $array should not hold the column names.

◆ InitArrayFields()

ADORecordSet_array::InitArrayFields ( & $array,
& $fieldarr )
inherited

Setup the Array and datatype file objects.

Parameters
array$array2-dimensional array holding the data The first row should hold the column names unless parameter $colnames is used.
array$fieldarrArray of ADOFieldObject's.

◆ LastPageNo()

ADORecordSet::LastPageNo ( $page = false)
inherited
Parameters
bool$page
Return values
bool

◆ MaxRecordCount()

ADORecordSet::MaxRecordCount ( )
inherited

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

Return values
int

◆ metaType()

ADORecordSet::metaType ( $t,
$len = -1,
$fieldObj = false )
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.

See also
https://adodb.org/dokuwiki/doku.php?id=v5:dictionary:dictionary_index#portable_data_types
Parameters
string | ADOFieldObject$tNative type (usually ADOFieldObject->type) It is also possible to provide an ADOFieldObject here.
int$lenThe field's maximum length. This is because we treat character fields bigger than a certain size as a 'B' (blob).
ADOFieldObject$fieldObjField object returned by the database driver; can hold additional info (eg. primary_key for mysql).
Return values
stringThe ADOdb Standard type

Reimplemented in ADORecordset_firebird.

◆ Move()

ADORecordSet::Move ( $rowNumber = 0)
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).

Parameters
int$rowNumberis the row to move to (0-based)
Return values
booltrue if there still rows available, or false if there are no more rows (EOF).

◆ MoveFirst()

ADORecordSet::MoveFirst ( )
inherited

Move to the first row in the recordset.

Many databases do NOT support this.

Return values
booltrue or false

Reimplemented in ADORecordset_informix72, and ADORecordSet_odbtp.

◆ MoveLast()

ADORecordSet::MoveLast ( )
inherited

Move to the last row in the recordset.

Return values
booltrue or false

Reimplemented in ADORecordset_informix72, and ADORecordSet_odbtp.

◆ MoveNext()

ADORecordSet_array::MoveNext ( )
inherited
Return values
bool

Reimplemented from ADORecordSet.

◆ NextRecordSet()

ADORecordSet::NextRecordSet ( )
inherited

Checks if there is another available recordset.

Some databases allow multiple recordsets to be returned.

Return values
booleantrue if there is a next recordset, or false if no more

Reimplemented in ADORecordSet_ado, ADORecordSet_ado, ADORecordset_mssql, ADORecordset_mssqlnative, and ADORecordSet_odbtp.

◆ NumCols()

ADORecordSet::NumCols ( )
inherited

PEAR DB compat, number of cols.

Return values
int

◆ NumRows()

ADORecordSet::NumRows ( )
inherited

PEAR DB compat, number of rows.

Return values
int

◆ PO_RecordCount()

ADORecordSet::PO_RecordCount ( $table = "",
$condition = "" )
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.

Parameters
string$table
string$condition
Return values
intNumber of records from a previous SELECT. All databases support this.
Author
Pablo Roca pablo.nosp@m.roca.nosp@m.@mvps.nosp@m..org

◆ recordCount()

ADORecordSet::recordCount ( )
inherited

Number of rows in recordset.

Return values
intNumber of rows or -1 if this is not supported

◆ rowCount()

ADORecordSet::rowCount ( )
inherited

Number of rows in recordset.

Alias for {

See also
recordCount()}
Return values
intNumber of rows or -1 if this is not supported

◆ UnixDate()

static ADORecordSet_array_sybase::UnixDate ( $v)
static
Parameters
mixed$vis a date string in YYYY-MM-DD format
Return values
stringdate in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format

Reimplemented from ADORecordSet.

◆ UnixTimeStamp()

static ADORecordSet_array_sybase::UnixTimeStamp ( $v)
static
Parameters
string | object$vis a timestamp string in YYYY-MM-DD HH-NN-SS format
Return values
mixeddate in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format

Reimplemented from ADORecordSet.

◆ UserDate()

ADORecordSet::UserDate ( $v,
$fmt = 'Y-m-d' )
inherited
Parameters
mixed$vis the character date in YYYY-MM-DD format, returned by database
string$fmtis the format to apply to it, using date()
Return values
stringa date formatted as user desires

◆ UserTimeStamp()

ADORecordSet::UserTimeStamp ( $v,
$fmt = 'Y-m-d H:i:s' )
inherited
Parameters
mixed$vis the character timestamp in YYYY-MM-DD hh:mm:ss format
string[$fmt] is the format to apply to it, using date()
Return values
stringa timestamp formated as user desires

Member Data Documentation

◆ $_closed

ADORecordSet::$_closed = false
inherited

This variable keeps the current row in the Recordset.


◆ $_queryID

resource int false ADORecordSet::$_queryID = self::DUMMY_QUERY_ID
inherited

number of fields in recordset

result link identifier

◆ $connection

ADOConnection ADORecordSet::$connection = false
inherited

default fetch mode

The parent connection

◆ $fieldObjectsCache

ADOFieldObject [] ADORecordSet::$fieldObjectsCache
protectedinherited

Field metadata cache.

See also
fieldTypesArray()

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