NewsNewsFeaturesDownloadsDevelopmentSupportForumDocumentsAbout Us

ADORecordSet_array 類別 參考文件

類別ADORecordSet_array的繼承圖:

ADORecordSet ADODB_BASE_RS ADORecordSet_array_sybase 全部成員列表

公開方法(Public Methods)

 ADORecordSet_array ($fakeid=1)
 InitArray ($array, $typearr, $colnames=false)
 InitArrayFields (&$array, &$fieldarr)
GetArray ($nRows=-1)
 _initrs ()
 Fields ($colname)
FetchField ($fieldOffset=-1)
 _seek ($row)
 MoveNext ()
 _fetch ()
 _close ()

公開屬性

 $databaseType = 'array'
 $_array
 $_types
 $_colnames
 $_skiprow1
 $_fieldarr
 $canSeek = true
 $affectedrows = false
 $insertid = false
 $sql = ''
 indicates that seek is supported
 $compat = false

詳細描述

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

定義在 adodb.inc.php 檔案之第 3426 行.


建構子與解構子說明文件

ADORecordSet_array::ADORecordSet_array fakeid = 1  ) 
 

Constructor

定義在 adodb.inc.php 檔案之第 3444 行.

參考 ADORecordSet::ADORecordSet().

被參考於 ADORecordSet_array_sybase::ADORecordSet_array_sybase().

03445         {
03446         global $ADODB_FETCH_MODE,$ADODB_COMPAT_FETCH;
03447         
03448             // fetch() on EOF does not delete $this->fields
03449             $this->compat = !empty($ADODB_COMPAT_FETCH);
03450             $this->ADORecordSet($fakeid); // fake queryID       
03451             $this->fetchMode = $ADODB_FETCH_MODE;
03452         }


函式成員說明文件

ADORecordSet_array::_close  ) 
 

依據ADORecordSet重新實作.

定義在 adodb.inc.php 檔案之第 3592 行.

03593         {
03594             return true;    
03595         }

ADORecordSet_array::_fetch  ) 
 

定義在 adodb.inc.php 檔案之第 3579 行.

03580         {
03581             $pos = $this->_currentRow;
03582             
03583             if ($this->_numOfRows <= $pos) {
03584                 if (!$this->compat) $this->fields = false;
03585                 return false;
03586             }
03587             if ($this->_skiprow1) $pos += 1;
03588             $this->fields = $this->_array[$pos];
03589             return true;
03590         }

ADORecordSet_array::_initrs  ) 
 

定義在 adodb.inc.php 檔案之第 3507 行.

03508         {
03509             $this->_numOfRows =  sizeof($this->_array);
03510             if ($this->_skiprow1) $this->_numOfRows -= 1;
03511         
03512             $this->_numOfFields =(isset($this->_fieldobjects)) ?
03513                  sizeof($this->_fieldobjects):sizeof($this->_types);
03514         }

ADORecordSet_array::_seek row  ) 
 

定義在 adodb.inc.php 檔案之第 3548 行.

03549         {
03550             if (sizeof($this->_array) && 0 <= $row && $row < $this->_numOfRows) {
03551                 $this->_currentRow = $row;
03552                 if ($this->_skiprow1) $row += 1;
03553                 $this->fields = $this->_array[$row];
03554                 return true;
03555             }
03556             return false;
03557         }

& ADORecordSet_array::FetchField fieldOffset = -1  ) 
 

Get the ADOFieldObject of a specific column.

參數:
fieldoffset is the column position to access(0-based).
傳回值:
the ADOFieldObject for that column, or false.

依據ADORecordSet重新實作.

定義在 adodb.inc.php 檔案之第 3535 行.

被參考於 Fields().

03536         {
03537             if (isset($this->_fieldobjects)) {
03538                 return $this->_fieldobjects[$fieldOffset];
03539             }
03540             $o =  new ADOFieldObject();
03541             $o->name = $this->_colnames[$fieldOffset];
03542             $o->type =  $this->_types[$fieldOffset];
03543             $o->max_length = -1; // length not known
03544             
03545             return $o;
03546         }

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

參數:
colname is the field to access
傳回值:
the value of $colname column

依據ADORecordSet重新實作.

定義在 adodb.inc.php 檔案之第 3517 行.

參考 $mode, 及 FetchField().

03518         {
03519             $mode = isset($this->adodbFetchMode) ? $this->adodbFetchMode : $this->fetchMode;
03520             
03521             if ($mode & ADODB_FETCH_ASSOC) {
03522                 if (!isset($this->fields[$colname])) $colname = strtolower($colname);
03523                 return $this->fields[$colname];
03524             }
03525             if (!$this->bind) {
03526                 $this->bind = array();
03527                 for ($i=0; $i < $this->_numOfFields; $i++) {
03528                     $o = $this->FetchField($i);
03529                     $this->bind[strtoupper($o->name)] = $i;
03530                 }
03531             }
03532             return $this->fields[$this->bind[strtoupper($colname)]];
03533         }

& ADORecordSet_array::GetArray nRows = -1  ) 
 

return recordset as a 2-dimensional array.

參數:
[nRows] is the number of rows to return. -1 means every row.
傳回值:
an array indexed by the rows (0-based) from the recordset

依據ADORecordSet重新實作.

定義在 adodb.inc.php 檔案之第 3497 行.

參考 $arr, 及 ADORecordSet::GetArray().

03498         {
03499             if ($nRows == -1 && $this->_currentRow <= 0 && !$this->_skiprow1) {
03500                 return $this->_array;
03501             } else {
03502                 $arr =& ADORecordSet::GetArray($nRows);
03503                 return $arr;
03504             }
03505         }

ADORecordSet_array::InitArray array,
typearr,
colnames = false
 

Setup the array.

參數:
array is a 2-dimensional array holding the data. The first row should hold the column names unless paramter $colnames is used.
typearr holds an array of types. These are the same types used in MetaTypes (C,B,L,I,N).
[colnames] array of column names. If set, then the first row of $array should not hold the column names.

定義在 adodb.inc.php 檔案之第 3466 行.

參考 $array, $typearr, 及 ADORecordSet::Init().

03467         {
03468             $this->_array = $array;
03469             $this->_types = $typearr;   
03470             if ($colnames) {
03471                 $this->_skiprow1 = false;
03472                 $this->_colnames = $colnames;
03473             } else  {
03474                 $this->_skiprow1 = true;
03475                 $this->_colnames = $array[0];
03476             }
03477             $this->Init();
03478         }

ADORecordSet_array::InitArrayFields &$  array,
&$  fieldarr
 

Setup the Array and datatype file objects

參數:
array is a 2-dimensional array holding the data. The first row should hold the column names unless paramter $colnames is used.
fieldarr holds an array of ADOFieldObject's.

定義在 adodb.inc.php 檔案之第 3487 行.

參考 $array, 及 ADORecordSet::Init().

03488         {
03489             $this->_array =& $array;
03490             $this->_skiprow1= false;
03491             if ($fieldarr) {
03492                 $this->_fieldobjects =& $fieldarr;
03493             } 
03494             $this->Init();
03495         }

ADORecordSet_array::MoveNext  ) 
 

Move to next record in the recordset.

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

依據ADORecordSet重新實作.

定義在 adodb.inc.php 檔案之第 3559 行.

03560         {
03561             if (!$this->EOF) {      
03562                 $this->_currentRow++;
03563                 
03564                 $pos = $this->_currentRow;
03565                 
03566                 if ($this->_numOfRows <= $pos) {
03567                     if (!$this->compat) $this->fields = false;
03568                 } else {
03569                     if ($this->_skiprow1) $pos += 1;
03570                     $this->fields = $this->_array[$pos];
03571                     return true;
03572                 }       
03573                 $this->EOF = true;
03574             }
03575             
03576             return false;
03577         }   


資料成員說明文件

ADORecordSet_array::$_array
 

定義在 adodb.inc.php 檔案之第 3430 行.

ADORecordSet_array::$_colnames
 

定義在 adodb.inc.php 檔案之第 3432 行.

ADORecordSet_array::$_fieldarr
 

定義在 adodb.inc.php 檔案之第 3434 行.

ADORecordSet_array::$_skiprow1
 

定義在 adodb.inc.php 檔案之第 3433 行.

ADORecordSet_array::$_types
 

定義在 adodb.inc.php 檔案之第 3431 行.

ADORecordSet_array::$affectedrows = false
 

定義在 adodb.inc.php 檔案之第 3436 行.

ADORecordSet_array::$canSeek = true
 

any varchar/char field this size or greater is treated as a blob in other words, we use a text area for editing.

依據ADORecordSet重新實作.

定義在 adodb.inc.php 檔案之第 3435 行.

ADORecordSet_array::$compat = false
 

定義在 adodb.inc.php 檔案之第 3439 行.

ADORecordSet_array::$databaseType = 'array'
 

定義在 adodb.inc.php 檔案之第 3428 行.

ADORecordSet_array::$insertid = false
 

定義在 adodb.inc.php 檔案之第 3437 行.

ADORecordSet_array::$sql = ''
 

indicates that seek is supported

依據ADORecordSet重新實作.

定義在 adodb.inc.php 檔案之第 3438 行.


此類別(class) 文件是由下列檔案中產生: