\ADORecordSet_array_mssqlnative

This class encapsulates the concept of a recordset created in memory as an array. This is useful for the creation of cached recordsets.

Note that the constructor is different from the standard ADORecordSet

Summary

Methods
Properties
Constants
ADORecordSet_array()
_transpose()
InitArray()
InitArrayFields()
GetArray()
_initrs()
Fields()
FetchField()
_seek()
MoveNext()
_fetch()
_close()
ADORecordSet()
getIterator()
__toString()
Init()
GetMenu()
GetMenu2()
GetMenu3()
GetAll()
NextRecordSet()
GetArrayLimit()
GetRows()
GetAssoc()
UserTimeStamp()
UserDate()
UnixDate()
UnixTimeStamp()
Free()
NumRows()
NumCols()
FetchRow()
FetchInto()
MoveFirst()
MoveLast()
Move()
GetAssocKeys()
GetRowAssoc()
Close()
RecordCount()
MaxRecordCount()
RowCount()
PO_RecordCount()
CurrentRow()
AbsolutePosition()
FieldCount()
FieldTypesArray()
FetchObj()
FetchObject()
FetchNextObj()
FetchNextObject()
MetaType()
AbsolutePage()
AtFirstPage()
LastPageNo()
AtLastPage()
ADORecordSet_array_mssqlnative()
$databaseType
$_array
$_types
$_colnames
$_skiprow1
$_fieldobjects
$canSeek
$affectedrows
$insertid
$sql
$compat
$dataProvider
$fields
$blobSize
$EOF
$emptyTimeStamp
$emptyDate
$debug
$timeCreated
$bind
$fetchMode
$connection
$_numOfRows
$_numOfFields
$_queryID
$_currentRow
$_closed
$_inited
$_obj
$_names
$_currentPage
$_atFirstPage
$_atLastPage
$_lastPageNo
$_maxRecordCount
$datetime
No constants found
AssocCaseConvertFunction()
_updatefields()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$databaseType

$databaseType : 

Type

$_array

$_array : 

Type

$_types

$_types : 

Type

$_colnames

$_colnames : 

Type

$_skiprow1

$_skiprow1 : 

Type

$_fieldobjects

$_fieldobjects : 

Type

$canSeek

$canSeek : 

Type

$affectedrows

$affectedrows : 

Type

$insertid

$insertid : 

Type

$sql

$sql : 

Type

$compat

$compat : 

Type

$dataProvider

$dataProvider : 

public variables

Type

$fields

$fields : 

Type

$blobSize

$blobSize : 

Type

$EOF

$EOF : 

Type

$emptyTimeStamp

$emptyTimeStamp : 

Type

$emptyDate

$emptyDate : 

Type

$debug

$debug : 

Type

$timeCreated

$timeCreated : 

Type

$bind

$bind : 

Type

$fetchMode

$fetchMode : 

Type

$connection

$connection : 

Type

$_numOfRows

$_numOfRows : 

private variables

Type

$_numOfFields

$_numOfFields : 

number of rows, or -1

Type

$_queryID

$_queryID : 

number of fields in recordset

Type

$_currentRow

$_currentRow : 

This variable keeps the result link identifier.

Type

$_closed

$_closed : 

This variable keeps the current row in the Recordset.

Type

$_inited

$_inited : 

has recordset been closed

Type

$_obj

$_obj : 

Init() should only be called once

Type

$_names

$_names : 

Used by FetchObj

Type

$_currentPage

$_currentPage : 

Used by FetchObj

Type

$_atFirstPage

$_atFirstPage : 

Added by Iván Oliva to implement recordset pagination

Type

$_atLastPage

$_atLastPage : 

Added by Iván Oliva to implement recordset pagination

Type

$_lastPageNo

$_lastPageNo : 

Added by Iván Oliva to implement recordset pagination

Type

$_maxRecordCount

$_maxRecordCount : 

Type

$datetime

$datetime : 

Type

Methods

ADORecordSet_array()

ADORecordSet_array(  $fakeid = 1) 

Constructor

Parameters

$fakeid

_transpose()

_transpose(  $addfieldnames = true) 

Parameters

$addfieldnames

InitArray()

InitArray(  $array,   $typearr,   $colnames = false) 

Setup the array.

Parameters

$array
$typearr
$colnames

InitArrayFields()

InitArrayFields(  $array,   $fieldarr) 

Setup the Array and datatype file objects

Parameters

$array
$fieldarr

GetArray()

GetArray(  $nRows = -1) : \an

return recordset as a 2-dimensional array.

Parameters

$nRows

Returns

\an —

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

_initrs()

_initrs() 

Fields()

Fields(  $colname) : \the

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

Returns

\the —

value of $colname column

FetchField()

FetchField(  $fieldoffset = -1) : \the

Get the ADOFieldObject of a specific column.

Parameters

$fieldoffset

Returns

\the —

ADOFieldObject for that column, or false.

_seek()

_seek(  $row) 

Parameters

$row

MoveNext()

MoveNext() : true

Move to next record in the recordset.

Returns

true —

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

_fetch()

_fetch() 

_close()

_close() 

ADORecordSet()

ADORecordSet(  $queryID) 

Constructor

Parameters

$queryID

getIterator()

getIterator() 

__toString()

__toString() 

Init()

Init() 

GetMenu()

GetMenu(  $name,   $defstr = '',   $blank1stItem = true,   $multiple = false,   $size,   $selectAttr = '',   $compareFields0 = true) : \HTML

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
$defstr
$blank1stItem
$multiple
$size
$selectAttr
$compareFields0

Returns

\HTML —

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

GetMenu2()

GetMenu2(  $name,   $defstr = '',   $blank1stItem = true,   $multiple = false,   $size,   $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

GetMenu3()

GetMenu3(  $name,   $defstr = '',   $blank1stItem = true,   $multiple = false,   $size,   $selectAttr = '') 

Parameters

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

GetAll()

GetAll(  $nRows = -1) 

Parameters

$nRows

NextRecordSet()

NextRecordSet() 

GetArrayLimit()

GetArrayLimit(  $nrows,   $offset = -1) : \an

return recordset as a 2-dimensional array.

Helper function for ADOConnection->SelectLimit()

Parameters

$nrows
$offset

Returns

\an —

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

GetRows()

GetRows(  $nRows = -1) : \an

Synonym for GetArray() for compatibility with ADO.

Parameters

$nRows

Returns

\an —

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

GetAssoc()

GetAssoc(  $force_array = false,   $first2cols = false) : \an

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
$first2cols

Returns

\an —

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

UserTimeStamp()

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

Parameters

$v
$fmt

Returns

\a —

timestamp formated as user desires

UserDate()

UserDate(  $v,   $fmt = 'Y-m-d') : \a

Parameters

$v
$fmt

Returns

\a —

date formated as user desires

UnixDate()

UnixDate(  $v) 

Parameters

$v

UnixTimeStamp()

UnixTimeStamp(  $v) 

Parameters

$v

Free()

Free() 

PEAR DB Compat - do not use internally

NumRows()

NumRows() 

PEAR DB compat, number of rows

NumCols()

NumCols() 

PEAR DB compat, number of cols

FetchRow()

FetchRow() : false

Fetch a row, returning false if no more rows.

This is PEAR DB compat mode.

Returns

false —

or array containing the current record

FetchInto()

FetchInto(  $arr) : \DB_OK

Fetch a row, returning PEAR_Error if no more rows.

This is PEAR DB compat mode.

Parameters

$arr

Returns

\DB_OK

or error object

MoveFirst()

MoveFirst() : true

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

Returns

true —

or false

MoveLast()

MoveLast() : true

Move to the last row in the recordset.

Returns

true —

or false

Move()

Move(  $rowNumber) : true

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

Returns

true —

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

GetAssocKeys()

GetAssocKeys(integer  $upper = ADODB_ASSOC_CASE) 

Builds the bind array associating keys to recordset fields

Parameters

integer $upper

Case for the array keys, defaults to uppercase (see ADODB_ASSOC_CASE_xxx constants)

GetRowAssoc()

GetRowAssoc(integer  $upper = ADODB_ASSOC_CASE) 

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

integer $upper

Case for the array keys, defaults to uppercase (see ADODB_ASSOC_CASE_xxx constants)

Close()

Close() : true

Clean up recordset

Returns

true —

or false

RecordCount()

RecordCount() : \the

synonyms RecordCount and RowCount

Returns

\the —

number of rows or -1 if this is not supported

MaxRecordCount()

MaxRecordCount() 

RowCount()

RowCount() : \the

synonyms RecordCount and RowCount

Returns

\the —

number of rows or -1 if this is not supported

PO_RecordCount()

PO_RecordCount(  $table = "",   $condition = "") : \the

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

Parameters

$table
$condition

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.

CurrentRow()

CurrentRow() : \the

Returns

\the —

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

AbsolutePosition()

AbsolutePosition() : \the

synonym for CurrentRow -- for ADO compat

Returns

\the —

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

FieldCount()

FieldCount() : \the

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.

FieldTypesArray()

FieldTypesArray() 

Get the ADOFieldObjects of all columns in an array.

FetchObj()

FetchObj() : \the

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

FetchObject()

FetchObject(  $isupper = true) : \the

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

FetchNextObj()

FetchNextObj() : \the

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

FetchNextObject()

FetchNextObject(  $isupper = true) : \the

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

MetaType()

MetaType(  $t,   $len = -1,   $fieldobj = false) : \the

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
$len
$fieldobj

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

AbsolutePage()

AbsolutePage(  $page = -1) 

set/returns the current recordset page when paginating

Parameters

$page

AtFirstPage()

AtFirstPage(  $status = false) 

set/returns the status of the atFirstPage flag when paginating

Parameters

$status

LastPageNo()

LastPageNo(  $page = false) 

Parameters

$page

AtLastPage()

AtLastPage(  $status = false) 

set/returns the status of the atLastPage flag when paginating

Parameters

$status

ADORecordSet_array_mssqlnative()

ADORecordSet_array_mssqlnative(  $id = -1,   $mode = false) 

Parameters

$id
$mode

AssocCaseConvertFunction()

AssocCaseConvertFunction(  $case = ADODB_ASSOC_CASE) : string

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

Parameters

$case

Returns

string —

strtolower/strtoupper or false if no conversion needed

_updatefields()

_updatefields() : void

Convert case of field names associative array, if needed