Documentation TYPO3 par Ameos

ADORecordSet Class Reference

Inheritance diagram for ADORecordSet:
[legend]
Collaboration diagram for ADORecordSet:
[legend]
List of all members.

Public Member Functions

 ADORecordSet ($queryID)
 Init ()
 GetMenu ($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='', $compareFields0=true)
 GetMenu2 ($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='')
 GetMenu3 ($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='')
GetArray ($nRows=-1)
GetAll ($nRows=-1)
 NextRecordSet ()
GetArrayLimit ($nrows, $offset=-1)
GetRows ($nRows=-1)
GetAssoc ($force_array=false, $first2cols=false)
 UserTimeStamp ($v, $fmt='Y-m-d H:i:s')
 UserDate ($v, $fmt='Y-m-d')
 UnixDate ($v)
 UnixTimeStamp ($v)
 Free ()
 NumRows ()
 NumCols ()
FetchRow ()
 FetchInto (&$arr)
 MoveFirst ()
 MoveLast ()
 MoveNext ()
 Move ($rowNumber=0)
 Fields ($colname)
 GetAssocKeys ($upper=true)
GetRowAssoc ($upper=1)
 Close ()
 RecordCount ()
 MaxRecordCount ()
 RowCount ()
 PO_RecordCount ($table="", $condition="")
 CurrentRow ()
 AbsolutePosition ()
 FieldCount ()
FetchField ($fieldoffset)
FieldTypesArray ()
FetchObj ()
FetchObject ($isupper=true)
FetchNextObj ()
FetchNextObject ($isupper=true)
 MetaType ($t, $len=-1, $fieldobj=false)
 _close ()
 AbsolutePage ($page=-1)
 AtFirstPage ($status=false)
 LastPageNo ($page=false)
 AtLastPage ($status=false)

Public Attributes

 $dataProvider = "native"
 $fields = false
 $blobSize = 100
 holds the current row data
 $canSeek = false
 in other words, we use a text area for editing.
 $sql
 indicates that seek is supported
 $EOF = false
 sql text
 $emptyTimeStamp = ' '
 Indicates that the current record position is after the last record in a Recordset object.
 $emptyDate = ' '
 what to display when $time==0
 $debug = false
 what to display when $time==0
 $timeCreated = 0
 $bind = false
 datetime in Unix format rs created -- for cached recordsets
 $fetchMode
 used by Fields() to hold array - should be private?
 $connection = false
 default fetch mode
 $_numOfRows = -1
 the parent connection
 $_numOfFields = -1
 $_queryID = -1
 $_currentRow = -1
 $_closed = false
 $_inited = false
 $_obj
 $_names
 $_currentPage = -1
 $_atFirstPage = false
 $_atLastPage = false
 $_lastPageNo = -1
 $_maxRecordCount = 0
 $datetime = false

Detailed Description

RecordSet class that represents the dataset returned by the database. To keep memory overhead low, this class holds only the current row in memory. No prefetching of data is done, so the RecordCount() can return -1 ( which means recordcount not known).

Definition at line 2707 of file adodb.inc.php.


Member Function Documentation

ADORecordSet::ADORecordSet ( queryID  ) 

Constructor

Parameters:
queryID this is the queryID returned by ADOConnection->_query()

Definition at line 2752 of file adodb.inc.php.

Referenced by ADORecordSet_ado::ADORecordSet_ado(), ADORecordSet_array::ADORecordSet_array(), ADORecordSet_ext_mysql::ADORecordSet_ext_mysql(), ADORecordSet_ext_mysqlt::ADORecordSet_ext_mysqlt(), ADORecordSet_fbsql::ADORecordSet_fbsql(), ADORecordset_ibase::ADORecordset_ibase(), ADORecordset_informix72::ADORecordset_informix72(), ADORecordSet_ldap::ADORecordSet_ldap(), ADORecordSet_mysql::ADORecordSet_mysql(), ADORecordSet_mysqli::ADORecordSet_mysqli(), ADORecordSet_mysqlt::ADORecordSet_mysqlt(), ADORecordSet_netezza::ADORecordSet_netezza(), ADORecordSet_odbtp::ADORecordSet_odbtp(), ADORecordSet_pdo::ADORecordSet_pdo(), ADORecordSet_postgres64::ADORecordSet_postgres64(), and ADORecordset_sybase::ADORecordset_sybase().

ADORecordSet::GetMenu ( name,
defstr = '',
blank1stItem = true,
multiple = false,
size = 0,
selectAttr = '',
compareFields0 = true 
)

Generate a SELECT tag string from a recordset, and return the string. If the recordset has 2 cols, we treat the 1st col as the containing the text to display to the user, and 2nd col as the return value. Default strings are compared with the FIRST column.

Parameters:
name name of SELECT tag
[defstr] the value to hilite. Use an array for multiple hilites for listbox.
[blank1stItem] true to leave the 1st item in list empty
[multiple] true for listbox, false for popup
[size] rows to show for listbox. not used by popup
[selectAttr] additional attributes to defined for SELECT tag. useful for holding javascript onChange='...' handlers. &
[compareFields0] when we have 2 cols in recordset, we compare the defstr with column 0 (1st col) if this is true. This is not documented.
Returns:
HTML
changes by glen.davies@cce.ac.nz to support multiple hilited items

Definition at line 2800 of file adodb.inc.php.

Referenced by GetMenu2().

ADORecordSet::GetMenu2 ( name,
defstr = '',
blank1stItem = true,
multiple = false,
size = 0,
selectAttr = '' 
)

Generate a SELECT tag string from a recordset, and return the string. If the recordset has 2 cols, we treat the 1st col as the containing the text to display to the user, and 2nd col as the return value. Default strings are compared with the SECOND column.

Definition at line 2818 of file adodb.inc.php.

References GetMenu().

& ADORecordSet::GetArray ( nRows = -1  ) 

return recordset as a 2-dimensional array.

Parameters:
[nRows] is the number of rows to return. -1 means every row.
Returns:
an array indexed by the rows (0-based) from the recordset

Reimplemented in ADORecordSet_array.

Definition at line 2843 of file adodb.inc.php.

References MoveNext().

Referenced by GetAll(), ADORecordSet_array::GetArray(), ADORecordSet_odbc::GetArrayLimit(), ADORecordset_oci8po::GetArrayLimit(), ADORecordset_oci8::GetArrayLimit(), ADORecordSet_db2::GetArrayLimit(), GetArrayLimit(), and GetRows().

& ADORecordSet::GetArrayLimit ( nrows,
offset = -1 
)

return recordset as a 2-dimensional array. Helper function for ADOConnection->SelectLimit()

Parameters:
offset is the row to start calculations from (1-based)
[nrows] is the number of rows to return
Returns:
an array indexed by the rows (0-based) from the recordset

Reimplemented in ADORecordSet_db2, ADORecordset_oci8, ADORecordset_oci8po, and ADORecordSet_odbc.

Definition at line 2883 of file adodb.inc.php.

References GetArray(), Move(), and MoveNext().

& ADORecordSet::GetRows ( nRows = -1  ) 

Synonym for GetArray() for compatibility with ADO.

Parameters:
[nRows] is the number of rows to return. -1 means every row.
Returns:
an array indexed by the rows (0-based) from the recordset

Definition at line 2910 of file adodb.inc.php.

References GetArray().

& ADORecordSet::GetAssoc ( force_array = false,
first2cols = false 
)

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.

Parameters:
[force_array] 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.
[first2cols] 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
Returns:
an associative array indexed by the first column of the array, or false if the data has less than 2 cols.

Reimplemented in ADORecordSet_ldap.

Definition at line 2932 of file adodb.inc.php.

References MoveNext().

ADORecordSet::UserTimeStamp ( v,
fmt = 'Y-m-d H:i:s' 
)

Parameters:
v is the character timestamp in YYYY-MM-DD hh:mm:ss format
fmt is the format to apply to it, using date()
Returns:
a timestamp formated as user desires

Definition at line 3035 of file adodb.inc.php.

References UnixTimeStamp().

ADORecordSet::UserDate ( v,
fmt = 'Y-m-d' 
)

Parameters:
v is the character date in YYYY-MM-DD format, returned by database
fmt is the format to apply to it, using date()
Returns:
a date formated as user desires

Definition at line 3052 of file adodb.inc.php.

References UnixDate().

ADORecordSet::UnixDate ( v  ) 

Parameters:
$v is a date string in YYYY-MM-DD format
Returns:
date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format

Reimplemented in ADORecordset_sybase, and ADORecordSet_array_sybase.

Definition at line 3069 of file adodb.inc.php.

References ADOConnection::UnixDate().

Referenced by ADODB_oracle::DBDate(), ADODB_oci8::DBDate(), and UserDate().

ADORecordSet::UnixTimeStamp ( v  ) 

Parameters:
$v is a timestamp string in YYYY-MM-DD HH-NN-SS format
Returns:
date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format

Reimplemented in ADORecordset_sybase, and ADORecordSet_array_sybase.

Definition at line 3080 of file adodb.inc.php.

References ADOConnection::UnixTimeStamp().

Referenced by ADODB_oracle::DBTimeStamp(), ADODB_oci8::DBTimeStamp(), ADODB_db2::DBTimeStamp(), and UserTimeStamp().

ADORecordSet::Free (  ) 

PEAR DB Compat - do not use internally

Definition at line 3089 of file adodb.inc.php.

References Close().

ADORecordSet::NumRows (  ) 

PEAR DB compat, number of rows

Definition at line 3098 of file adodb.inc.php.

ADORecordSet::NumCols (  ) 

PEAR DB compat, number of cols

Definition at line 3107 of file adodb.inc.php.

& ADORecordSet::FetchRow (  ) 

Fetch a row, returning false if no more rows. This is PEAR DB compat mode.

Returns:
false or array containing the current record

Definition at line 3118 of file adodb.inc.php.

ADORecordSet::FetchInto ( &$  arr  ) 

Fetch a row, returning PEAR_Error if no more rows. This is PEAR DB compat mode.

Returns:
DB_OK or error object

Definition at line 3137 of file adodb.inc.php.

References MoveNext().

ADORecordSet::MoveFirst (  ) 

Move to the first row in the recordset. Many databases do NOT support this.

Returns:
true or false

Reimplemented in ADORecordset_informix72, and ADORecordSet_odbtp.

Definition at line 3151 of file adodb.inc.php.

References Move().

ADORecordSet::MoveLast (  ) 

Move to the last row in the recordset.

Returns:
true or false

Reimplemented in ADORecordset_informix72, and ADORecordSet_odbtp.

Definition at line 3163 of file adodb.inc.php.

References Move(), and MoveNext().

ADORecordSet::MoveNext (  ) 

Move to next record in the recordset.

Returns:
true if there still rows available, or false if there are no more rows (EOF).

Reimplemented in ADORecordSet_array, ADORecordSet_db2, ADORecordSet_mysql, ADORecordSet_ext_mysql, ADORecordSet_mysqli, ADORecordSet_mysqlt, ADORecordSet_ext_mysqlt, ADORecordset_oci8, ADORecordset_oci8po, ADORecordSet_odbc, ADORecordSet_postgres64, ADORecordSet_postgres7, and ADORecordSet_assoc_postgres7.

Definition at line 3182 of file adodb.inc.php.

Referenced by FetchInto(), GetArray(), GetArrayLimit(), GetAssoc(), and MoveLast().

ADORecordSet::Move ( rowNumber = 0  ) 

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:
rowNumber is the row to move to (0-based)
Returns:
true if there still rows available, or false if there are no more rows (EOF).

Definition at line 3208 of file adodb.inc.php.

Referenced by ADORecordSet_odbc::GetArrayLimit(), ADORecordSet_db2::GetArrayLimit(), GetArrayLimit(), MoveFirst(), and MoveLast().

ADORecordSet::Fields ( colname  ) 

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.

Parameters:
colname is the field to access
Returns:
the value of $colname column

Reimplemented in ADORecordSet_array, ADORecordSet_ado, ADORecordSet_ado, ADORecordSet_db2, ADORecordset_ibase, ADORecordSet_mysql, ADORecordSet_mysqli, ADORecordset_oci8, ADORecordset_oci8po, ADORecordSet_odbc, ADORecordset_oracle, ADORecordSet_pdo, ADORecordSet_postgres64, and ADORecordset_sqlite.

Definition at line 3258 of file adodb.inc.php.

Referenced by FetchObject().

& ADORecordSet::GetRowAssoc ( upper = 1  ) 

Use associative array to get fields array for databases that do not support associative arrays. Submitted by Paolo S. Asioli paolo.asioli::libero.it

If you don't want uppercase cols, set $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC before you execute your SQL statement, and access $rs->fields['col'] directly.

$upper 0 = lowercase, 1 = uppercase, 2 = whatever is returned by FetchField

Reimplemented in ADORecordSet_mysql, ADORecordSet_mysqli, and ADORecordSet_postgres64.

Definition at line 3282 of file adodb.inc.php.

References GetAssocKeys().

Referenced by ADORecordset_sybase::_fetch(), ADORecordSet_odbc::_fetch(), ADORecordset_ibase::_fetch(), ADORecordSet_db2::_fetch(), ADORecordSet_ado::_fetch(), ADORecordSet_odbc::GetArrayLimit(), ADORecordSet_db2::GetArrayLimit(), ADORecordSet_postgres64::GetRowAssoc(), ADORecordSet_mysqli::GetRowAssoc(), ADORecordSet_mysql::GetRowAssoc(), ADORecordSet_odbc::MoveNext(), and ADORecordSet_db2::MoveNext().

ADORecordSet::Close (  ) 

Clean up recordset

Returns:
true or false

Definition at line 3304 of file adodb.inc.php.

References _close().

Referenced by Free().

ADORecordSet::RecordCount (  ) 

synonyms RecordCount and RowCount

Returns:
the number of rows or -1 if this is not supported

Definition at line 3321 of file adodb.inc.php.

Referenced by MaxRecordCount().

ADORecordSet::RowCount (  ) 

synonyms RecordCount and RowCount

Returns:
the number of rows or -1 if this is not supported

Definition at line 3338 of file adodb.inc.php.

ADORecordSet::PO_RecordCount ( table = "",
condition = "" 
)

Portable RecordCount. Pablo Roca <pabloroca@mvps.org>

Returns:
the number of records from a previous SELECT. All databases support this.
But aware possible problems in multiuser environments. For better speed the table must be indexed by the condition. Heavy test this before deploying.

Definition at line 3349 of file adodb.inc.php.

ADORecordSet::CurrentRow (  ) 

Returns:
the current row in the recordset. If at EOF, will return the last row. 0-based.

Definition at line 3367 of file adodb.inc.php.

ADORecordSet::AbsolutePosition (  ) 

synonym for CurrentRow -- for ADO compat

Returns:
the current row in the recordset. If at EOF, will return the last row. 0-based.

Definition at line 3374 of file adodb.inc.php.

ADORecordSet::FieldCount (  ) 

Returns:
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.

Definition at line 3380 of file adodb.inc.php.

& ADORecordSet::FetchField ( fieldoffset  ) 

Get the ADOFieldObject of a specific column.

Parameters:
fieldoffset is the column position to access(0-based).
Returns:
the ADOFieldObject for that column, or false.

Reimplemented in ADORecordSet_array, ADORecordSet_ado, ADORecordSet_ado, ADORecordSet_db2, ADORecordSet_fbsql, ADORecordset_ibase, ADORecordset_informix72, ADORecordSet_mysql, ADORecordSet_mysqli, ADORecordset_oci8, ADORecordSet_odbc, ADORecordSet_odbtp, ADORecordset_oracle, ADORecordSet_pdo, ADORecordSet_postgres64, ADORecordset_sqlite, and ADORecordset_sybase.

Definition at line 3390 of file adodb.inc.php.

Referenced by FetchObject(), FieldTypesArray(), and GetAssocKeys().

& ADORecordSet::FieldTypesArray (  ) 

Get the ADOFieldObjects of all columns in an array.

Definition at line 3399 of file adodb.inc.php.

References FetchField().

& ADORecordSet::FetchObj (  ) 

Return the fields array of the current row as an object for convenience. The default case is lowercase field names.

Returns:
the object with the properties set to the fields of the current row

Definition at line 3413 of file adodb.inc.php.

References FetchObject().

& ADORecordSet::FetchObject ( isupper = true  ) 

Return the fields array of the current row as an object for convenience. The default case is uppercase.

Parameters:
$isupper to set the object property names to uppercase
Returns:
the object with the properties set to the fields of the current row

Definition at line 3427 of file adodb.inc.php.

References FetchField(), and Fields().

Referenced by FetchNextObject(), and FetchObj().

& ADORecordSet::FetchNextObj (  ) 

Return the fields array of the current row as an object for convenience. The default is lower-case field names.

Returns:
the object with the properties set to the fields of the current row, or false if EOF
Fixed bug reported by tim@orotech.net

Definition at line 3460 of file adodb.inc.php.

References FetchNextObject().

& ADORecordSet::FetchNextObject ( isupper = true  ) 

Return the fields array of the current row as an object for convenience. The default is upper case field names.

Parameters:
$isupper to set the object property names to uppercase
Returns:
the object with the properties set to the fields of the current row, or false if EOF
Fixed bug reported by tim@orotech.net

Definition at line 3478 of file adodb.inc.php.

References FetchObject().

Referenced by FetchNextObj().

ADORecordSet::MetaType ( t,
len = -1,
fieldobj = false 
)

Get the metatype of the column. This is used for formatting. This is because many databases use different names for the same type, so we transform the original type to our standardised version which uses 1 character codes:

Parameters:
t is the type passed in. Normally is ADOFieldObject->type.
len is the maximum length of that field. This is because we treat character fields bigger than a certain size as a 'B' (blob).
fieldobj is the field object returned by the database driver. Can hold additional info (eg. primary_key for mysql).
Returns:
the general type of the data: C for character < 250 chars X for teXt (>= 250 chars) B for Binary N for numeric or floating point D for date T for timestamp L for logical/Boolean I for integer R for autoincrement counter/integer

Reimplemented in ADORecordSet_ado, ADORecordSet_ado, ADORecordSet_fbsql, ADORecordset_ibase, ADORecordSet_mysql, ADORecordSet_mysqli, ADORecordSet_odbc_db2, and ADORecordSet_postgres64.

Definition at line 3514 of file adodb.inc.php.

Referenced by ADODB_DataDict::MetaType().

ADORecordSet::AbsolutePage ( page = -1  ) 

set/returns the current recordset page when paginating

Definition at line 3666 of file adodb.inc.php.

ADORecordSet::AtFirstPage ( status = false  ) 

set/returns the status of the atFirstPage flag when paginating

Definition at line 3675 of file adodb.inc.php.

ADORecordSet::AtLastPage ( status = false  ) 

set/returns the status of the atLastPage flag when paginating

Definition at line 3690 of file adodb.inc.php.


Member Data Documentation

ADORecordSet::$canSeek = false

in other words, we use a text area for editing.

any varchar/char field this size or greater is treated as a blob

Reimplemented in ADORecordSet_array, ADORecordSet_ado, ADORecordSet_fbsql, ADORecordset_informix72, ADORecordSet_ldap, ADORecordSet_mysql, ADORecordSet_mysqli, ADORecordSet_netezza, ADORecordSet_odbtp, ADORecordSet_postgres64, and ADORecordset_sybase.

Definition at line 2715 of file adodb.inc.php.

ADORecordSet::$_numOfFields = -1

number of rows, or -1

Definition at line 2731 of file adodb.inc.php.

ADORecordSet::$_queryID = -1

number of fields in recordset

Definition at line 2732 of file adodb.inc.php.

ADORecordSet::$_currentRow = -1

This variable keeps the result link identifier.

Definition at line 2733 of file adodb.inc.php.

ADORecordSet::$_closed = false

This variable keeps the current row in the Recordset.

Definition at line 2734 of file adodb.inc.php.

ADORecordSet::$_inited = false

has recordset been closed

Definition at line 2735 of file adodb.inc.php.

ADORecordSet::$_obj

Init() should only be called once

Definition at line 2736 of file adodb.inc.php.

ADORecordSet::$_names

Used by FetchObj

Definition at line 2737 of file adodb.inc.php.

ADORecordSet::$_currentPage = -1

Used by FetchObj

Definition at line 2739 of file adodb.inc.php.

ADORecordSet::$_atFirstPage = false

Added by Iván Oliva to implement recordset pagination

Definition at line 2740 of file adodb.inc.php.

ADORecordSet::$_atLastPage = false

Added by Iván Oliva to implement recordset pagination

Definition at line 2741 of file adodb.inc.php.

ADORecordSet::$_lastPageNo = -1

Added by Iván Oliva to implement recordset pagination

Definition at line 2742 of file adodb.inc.php.


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


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6