Zikula 1.0.1
[ class tree: Zikula 1.0.1 ] [ index: Zikula 1.0.1 ] [ all elements ]

Class: ADORecordSet

Source Location: /includes/classes/adodb/adodb.inc.php

Class Overview

ADODB_BASE_RS
   |
   --ADORecordSet

RecordSet class that represents the dataset returned by the database.


Variables

Methods


Child classes:

ADORecordSet_array
This class encapsulates the concept of a recordset created in memory as an array. This is useful for the creation of cached recordsets.
RecordSet class that represents the dataset returned by the database.
ADORecordSet_db2
RecordSet class that represents the dataset returned by the database.
ADORecordSet_fbsql
RecordSet class that represents the dataset returned by the database.
ADORecordset_ibase
RecordSet class that represents the dataset returned by the database.
ADORecordset_informix72
RecordSet class that represents the dataset returned by the database.
ADORecordSet_ldap
RecordSet class that represents the dataset returned by the database.
ADORecordset_mssql
RecordSet class that represents the dataset returned by the database.
ADORecordSet_mysql
RecordSet class that represents the dataset returned by the database.
ADORecordSet_mysqli
RecordSet class that represents the dataset returned by the database.
ADORecordset_oci8
RecordSet class that represents the dataset returned by the database.
ADORecordSet_odbc
RecordSet class that represents the dataset returned by the database.
ADORecordSet_odbtp
RecordSet class that represents the dataset returned by the database.
ADORecordset_oracle
RecordSet class that represents the dataset returned by the database.
ADORecordSet_pdo
RecordSet class that represents the dataset returned by the database.
ADORecordSet_postgres64
RecordSet class that represents the dataset returned by the database.
ADORecordset_sqlite
RecordSet class that represents the dataset returned by the database.
ADORecordset_sybase
RecordSet class that represents the dataset returned by the database.

Class Details

[line 2737]
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).




[ Top ]


Class Variables

$bind =  false

[line 2754]


Type:   mixed


[ Top ]

$blobSize =  100

[line 2743]


Type:   mixed


[ Top ]

$canSeek =  false

[line 2745]


Type:   mixed


[ Top ]

$connection =  false

[line 2756]


Type:   mixed


[ Top ]

$dataProvider =  "native"

[line 2741]


Type:   mixed


[ Top ]

$datetime =  false

[line 2774]


Type:   mixed


[ Top ]

$debug =  false

[line 2751]


Type:   mixed


[ Top ]

$emptyDate =  ' '

[line 2750]


Type:   mixed


[ Top ]

$emptyTimeStamp =  ' '

[line 2749]


Type:   mixed


[ Top ]

$EOF =  false

[line 2747]


Type:   mixed


[ Top ]

$fetchMode =

[line 2755]


Type:   mixed


[ Top ]

$fields =  false

[line 2742]


Type:   mixed


[ Top ]

$sql =

[line 2746]


Type:   mixed


[ Top ]

$timeCreated = 0

[line 2752]


Type:   mixed


[ Top ]

$_atFirstPage =  false

[line 2770]

Added by Iván Oliva to implement recordset pagination


Type:   mixed


[ Top ]

$_atLastPage =  false

[line 2771]

Added by Iván Oliva to implement recordset pagination


Type:   mixed


[ Top ]

$_closed =  false

[line 2764]

This variable keeps the current row in the Recordset.


Type:   mixed


[ Top ]

$_currentPage =  -1

[line 2769]

Used by FetchObj


Type:   mixed


[ Top ]

$_currentRow =  -1

[line 2763]

This variable keeps the result link identifier.


Type:   mixed


[ Top ]

$_inited =  false

[line 2765]

has recordset been closed


Type:   mixed


[ Top ]

$_lastPageNo =  -1

[line 2772]

Added by Iván Oliva to implement recordset pagination


Type:   mixed


[ Top ]

$_maxRecordCount =  0

[line 2773]


Type:   mixed


[ Top ]

$_names =

[line 2767]

Used by FetchObj


Type:   mixed


[ Top ]

$_numOfFields =  -1

[line 2761]

number of rows, or -1


Type:   mixed


[ Top ]

$_numOfRows =  -1

[line 2760]


Type:   mixed


[ Top ]

$_obj =

[line 2766]

Init() should only be called once


Type:   mixed


[ Top ]

$_queryID =  -1

[line 2762]

number of fields in recordset


Type:   mixed


[ Top ]



Class Methods


constructor ADORecordSet [line 2782]

ADORecordSet ADORecordSet( queryID $queryID)

Constructor



Parameters:

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

[ Top ]

method AbsolutePage [line 3699]

void AbsolutePage( [ $page = -1])

set/returns the current recordset page when paginating



Parameters:

   $page  

[ Top ]

method AbsolutePosition [line 3404]

the AbsolutePosition( )

synonym for CurrentRow -- for ADO compat



Tags:

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


[ Top ]

method AtFirstPage [line 3708]

void AtFirstPage( [ $status = false])

set/returns the status of the atFirstPage flag when paginating



Parameters:

   $status  

[ Top ]

method AtLastPage [line 3723]

void AtLastPage( [ $status = false])

set/returns the status of the atLastPage flag when paginating



Parameters:

   $status  

[ Top ]

method Close [line 3334]

true Close( )

Clean up recordset



Tags:

return:  or false


[ Top ]

method CurrentRow [line 3397]

the CurrentRow( )



Tags:

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


[ Top ]

method FetchField [line 3420]


method FetchInto [line 3167]

DB_OK FetchInto( &$arr)

Fetch a row, returning PEAR_Error if no more rows.

This is PEAR DB compat mode.




Tags:

return:  or error object


Parameters:

   &$arr  

[ Top ]

method FetchNextObj [line 3493]

the &FetchNextObj( )

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

The default is lower-case field names.




Tags:

return:  

object with the properties set to the fields of the current row, or false if EOF

Fixed bug reported by tim@orotech.net



[ Top ]

method FetchNextObject [line 3511]

the &FetchNextObject( [$isupper $isupper = true])

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

The default is upper case field names.




Tags:

return:  

object with the properties set to the fields of the current row, or false if EOF

Fixed bug reported by tim@orotech.net



Parameters:

$isupper   $isupper   to set the object property names to uppercase

[ Top ]

method FetchObj [line 3446]

the &FetchObj( )

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

The default case is lowercase field names.




Tags:

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


[ Top ]

method FetchObject [line 3460]

the &FetchObject( [$isupper $isupper = true])

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

The default case is uppercase.




Tags:

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


Parameters:

$isupper   $isupper   to set the object property names to uppercase

[ Top ]

method FetchRow [line 3148]

false &FetchRow( )

Fetch a row, returning false if no more rows.

This is PEAR DB compat mode.




Tags:

return:  or array containing the current record


[ Top ]

method FieldCount [line 3410]

the FieldCount( )



Tags:

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


[ Top ]

method Fields [line 3288]

the Fields( colname $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.




Tags:

return:  value of $colname column


Overridden in child classes as:

ADORecordSet_array::Fields()
ADORecordSet_ado::Fields()
ADORecordSet_db2::Fields()
ADORecordset_ibase::Fields()
ADORecordset_mssql::Fields()
ADORecordSet_mysql::Fields()
ADORecordSet_mysqli::Fields()
ADORecordset_oci8::Fields()
ADORecordset_oci8po::Fields()
ADORecordSet_odbc::Fields()
ADORecordset_oracle::Fields()
ADORecordSet_pdo::Fields()
ADORecordSet_postgres64::Fields()
ADORecordset_sqlite::Fields()

Parameters:

colname   $colname   is the field to access

[ Top ]

method FieldTypesArray [line 3432]

void &FieldTypesArray( )

Get the ADOFieldObjects of all columns in an array.



[ Top ]

method Free [line 3119]

void Free( )

PEAR DB Compat - do not use internally



[ Top ]

method GetAll [line 2889]

void &GetAll( [ $nRows = -1])



Parameters:

   $nRows  

[ Top ]

method GetArray [line 2873]

an &GetArray( [[nRows] $nRows = -1])

return recordset as a 2-dimensional array.



Tags:

return:  array indexed by the rows (0-based) from the recordset


Overridden in child classes as:

ADORecordSet_array::GetArray()

Parameters:

[nRows]   $nRows   is the number of rows to return. -1 means every row.

[ Top ]

method GetArrayLimit [line 2913]

an &GetArrayLimit( offset $nrows, [[nrows] $offset = -1])

return recordset as a 2-dimensional array.

Helper function for ADOConnection->SelectLimit()




Tags:

return:  array indexed by the rows (0-based) from the recordset


Overridden in child classes as:

ADORecordSet_db2::GetArrayLimit()
ADORecordset_oci8::GetArrayLimit()
ADORecordset_oci8po::GetArrayLimit()
ADORecordSet_odbc::GetArrayLimit()

Parameters:

offset   $nrows   is the row to start calculations from (1-based)
[nrows]   $offset   is the number of rows to return

[ Top ]

method GetAssoc [line 2962]

an &GetAssoc( [[force_array] $force_array = false], [[first2cols] $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.




Tags:

return:  associative array indexed by the first column of the array, or false if the data has less than 2 cols.


Overridden in child classes as:

ADORecordSet_ldap::GetAssoc()

Parameters:

[force_array]   $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]   $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

[ Top ]

method GetAssocKeys [line 3293]

void GetAssocKeys( [ $upper = true])



Parameters:

   $upper  

[ Top ]

method GetMenu [line 2830]

HTML GetMenu( name $name, [[defstr] $defstr = ''], [[blank1stItem] $blank1stItem = true], [[multiple] $multiple = false], [[size] $size = 0], [[selectAttr] $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.




Tags:

return:  changes by glen.davies@cce.ac.nz to support multiple hilited items


Parameters:

name   $name   name of SELECT tag
[defstr]   $defstr   the value to hilite. Use an array for multiple hilites for listbox.
[blank1stItem]   $blank1stItem   true to leave the 1st item in list empty
[multiple]   $multiple   true for listbox, false for popup
[size]   $size   #rows to show for listbox. not used by popup
[selectAttr]   $selectAttr   additional attributes to defined for SELECT tag. useful for holding javascript onChange='...' handlers. column 0 (1st col) if this is true. This is not documented.
   $compareFields0  

[ Top ]

method GetMenu2 [line 2848]

void 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.




Parameters:

   $name  
   $defstr  
   $blank1stItem  
   $multiple  
   $size  
   $selectAttr  

[ Top ]

method GetMenu3 [line 2857]

void GetMenu3( $name, [ $defstr = ''], [ $blank1stItem = true], [ $multiple = false], [ $size = 0], [ $selectAttr = ''])



Parameters:

   $name  
   $defstr  
   $blank1stItem  
   $multiple  
   $size  
   $selectAttr  

[ Top ]

method GetRowAssoc [line 3312]

void &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




Overridden in child classes as:

ADORecordSet_ldap::GetRowAssoc()
ADORecordSet_mysql::GetRowAssoc()
ADORecordSet_mysqli::GetRowAssoc()
ADORecordSet_postgres64::GetRowAssoc()

Parameters:

   $upper  

[ Top ]

method GetRows [line 2940]

an &GetRows( [[nRows] $nRows = -1])

Synonym for GetArray() for compatibility with ADO.



Tags:

return:  array indexed by the rows (0-based) from the recordset


Parameters:

[nRows]   $nRows   is the number of rows to return. -1 means every row.

[ Top ]

method Init [line 2789]

void Init( )



Overridden in child classes as:

ADORecordset_oci8::Init()
ADORecordSet_pdo::Init()

[ Top ]

method LastPageNo [line 3714]

void LastPageNo( [ $page = false])



Parameters:

   $page  

[ Top ]

method MaxRecordCount [line 3358]

void MaxRecordCount( )



[ Top ]

method MetaType [line 3547]

the MetaType( t $t, [len $len = -1], [fieldobj $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:



Tags:

return:  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


Overridden in child classes as:

ADORecordSet_array_mysqli::MetaType()
ADORecordSet_ado::MetaType()
ADORecordSet_fbsql::MetaType()
ADORecordset_ibase::MetaType()
ADORecordSet_mysql::MetaType()
ADORecordSet_mysqli::MetaType()
ADORecordset_oci8::MetaType()
ADORecordSet_odbc_db2::MetaType()
ADORecordSet_vfp::MetaType()
ADORecordset_oracle::MetaType()
ADORecordSet_postgres64::MetaType()

Parameters:

t   $t   is the type passed in. Normally is ADOFieldObject->type.
len   $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   $fieldobj   is the field object returned by the database driver. Can hold additional info (eg. primary_key for mysql).

[ Top ]

method Move [line 3238]

true Move( [rowNumber $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).



Tags:

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


Parameters:

rowNumber   $rowNumber   is the row to move to (0-based)

[ Top ]

method MoveFirst [line 3181]

true MoveFirst( )

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



Tags:

return:  or false


Overridden in child classes as:

ADORecordset_informix72::MoveFirst()
ADORecordSet_odbtp::MoveFirst()

[ Top ]

method MoveLast [line 3193]

true MoveLast( )

Move to the last row in the recordset.



Tags:

return:  or false


Overridden in child classes as:

ADORecordset_informix72::MoveLast()
ADORecordSet_odbtp::MoveLast()

[ Top ]

method MoveNext [line 3212]


method NextRecordSet [line 2899]


method NumCols [line 3137]

void NumCols( )

PEAR DB compat, number of cols



[ Top ]

method NumRows [line 3128]

void NumRows( )

PEAR DB compat, number of rows



[ Top ]

method PO_RecordCount [line 3379]

the PO_RecordCount( [ $table = ""], [ $condition = ""])

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



Tags:

return:  

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.



Parameters:

   $table  
   $condition  

[ Top ]

method RecordCount [line 3351]

the RecordCount( )

synonyms RecordCount and RowCount



Tags:

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


[ Top ]

method RowCount [line 3368]

the RowCount( )

synonyms RecordCount and RowCount



Tags:

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


[ Top ]

method UnixDate [line 3099]

date UnixDate( $v $v)



Tags:

return:  in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format


Overridden in child classes as:

ADORecordSet_array_mssql::UnixDate()
ADORecordSet_array_sybase::UnixDate()
ADORecordset_mssql::UnixDate()
ADORecordset_sybase::UnixDate()

Parameters:

$v   $v   is a date string in YYYY-MM-DD format

[ Top ]

method UnixTimeStamp [line 3110]

date UnixTimeStamp( $v $v)



Tags:

return:  in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format


Overridden in child classes as:

ADORecordSet_array_mssql::UnixTimeStamp()
ADORecordSet_array_sybase::UnixTimeStamp()
ADORecordset_mssql::UnixTimeStamp()
ADORecordset_sybase::UnixTimeStamp()

Parameters:

$v   $v   is a timestamp string in YYYY-MM-DD HH-NN-SS format

[ Top ]

method UserDate [line 3082]

a UserDate( v $v, [fmt $fmt = 'Y-m-d'])



Tags:

return:  date formated as user desires


Parameters:

v   $v   is the character date in YYYY-MM-DD format, returned by database
fmt   $fmt   is the format to apply to it, using date()

[ Top ]

method UserTimeStamp [line 3065]

a UserTimeStamp( v $v, [fmt $fmt = 'Y-m-d H:i:s'])



Tags:

return:  timestamp formated as user desires


Parameters:

v   $v   is the character timestamp in YYYY-MM-DD hh:mm:ss format
fmt   $fmt   is the format to apply to it, using date()

[ Top ]

method _close [line 3694]



Documentation generated on Fri, 18 Jul 2008 21:43:03 +0200 by phpDocumentor 1.4.1