NewsNewsFeaturesDownloadsDevelopmentSupportForumDocumentsAbout Us

ADORecordSet_ado 類別 參考文件

類別ADORecordSet_ado的繼承圖:

ADORecordSet ADORecordSet ADODB_BASE_RS ADODB_BASE_RS ADORecordSet_ado_access ADORecordSet_ado_mssql 全部成員列表

公開方法(Public Methods)

 ADORecordSet_ado ($id, $mode=false)
FetchField ($fieldOffset=-1)
 Fields ($colname)
 _initrs ()
 _seek ($row)
 MetaType ($t, $len=-1, $fieldobj=false)
 _fetch ()
 NextRecordSet ()
 _close ()
 ADORecordSet_ado ($id, $mode=false)
FetchField ($fieldOffset=-1)
 Fields ($colname)
 _initrs ()
 _seek ($row)
 MetaType ($t, $len=-1, $fieldobj=false)
 _fetch ()
 NextRecordSet ()
 _close ()

公開屬性

 $bind = false
 datetime in Unix format rs created -- for cached recordsets
 $databaseType = "ado"
 $dataProvider = "ado"
 $_tarr = false
 $_flds
 $canSeek = true
 $hideErrors = true

詳細描述

定義在 adodb-ado.inc.php 檔案之第 315 行.


建構子與解構子說明文件

ADORecordSet_ado::ADORecordSet_ado id,
mode = false
 

定義在 adodb-ado.inc.php 檔案之第 325 行.

參考 $ADODB_FETCH_MODE, $mode, 及 ADORecordSet::ADORecordSet().

被參考於 ADORecordSet_ado_access::ADORecordSet_ado_access(), 及 ADORecordSet_ado_mssql::ADORecordSet_ado_mssql().

00326     {
00327         if ($mode === false) { 
00328             global $ADODB_FETCH_MODE;
00329             $mode = $ADODB_FETCH_MODE;
00330         }
00331         $this->fetchMode = $mode;
00332         return $this->ADORecordSet($id,$mode);
00333     }

ADORecordSet_ado::ADORecordSet_ado id,
mode = false
 

定義在 adodb-ado5.inc.php 檔案之第 332 行.

參考 $ADODB_FETCH_MODE, $mode, 及 ADORecordSet::ADORecordSet().

00333     {
00334         if ($mode === false) { 
00335             global $ADODB_FETCH_MODE;
00336             $mode = $ADODB_FETCH_MODE;
00337         }
00338         $this->fetchMode = $mode;
00339         return $this->ADORecordSet($id,$mode);
00340     }


函式成員說明文件

ADORecordSet_ado::_close  ) 
 

依據ADORecordSet重新實作.

定義在 adodb-ado5.inc.php 檔案之第 631 行.

00631                       {
00632         $this->_flds = false;
00633         @$this->_queryID->Close();// by Pete Dishman (peterd@telephonetics.co.uk)
00634         $this->_queryID = false;    
00635     }

ADORecordSet_ado::_close  ) 
 

依據ADORecordSet重新實作.

定義在 adodb-ado.inc.php 檔案之第 623 行.

00623                       {
00624         $this->_flds = false;
00625         @$this->_queryID->Close();// by Pete Dishman (peterd@telephonetics.co.uk)
00626         $this->_queryID = false;    
00627     }

ADORecordSet_ado::_fetch  ) 
 

定義在 adodb-ado5.inc.php 檔案之第 533 行.

參考 $flds, 及 $rs.

00534     {   
00535         $rs = $this->_queryID;
00536         if (!$rs or $rs->EOF) {
00537             $this->fields = false;
00538             return false;
00539         }
00540         $this->fields = array();
00541     
00542         if (!$this->_tarr) {
00543             $tarr = array();
00544             $flds = array();
00545             for ($i=0,$max = $this->_numOfFields; $i < $max; $i++) {
00546                 $f = $rs->Fields($i);
00547                 $flds[] = $f;
00548                 $tarr[] = $f->Type;
00549             }
00550             // bind types and flds only once
00551             $this->_tarr = $tarr; 
00552             $this->_flds = $flds;
00553         }
00554         $t = reset($this->_tarr);
00555         $f = reset($this->_flds);
00556         
00557         if ($this->hideErrors)  $olde = error_reporting(E_ERROR|E_CORE_ERROR);// sometimes $f->value be null
00558         for ($i=0,$max = $this->_numOfFields; $i < $max; $i++) {
00559             //echo "<p>",$t,' ';var_dump($f->value); echo '</p>';
00560             switch($t) {
00561             case 135: // timestamp
00562                 if (!strlen((string)$f->value)) $this->fields[] = false;
00563                 else {
00564                     if (!is_numeric($f->value)) # $val = variant_date_to_timestamp($f->value);
00565                         // VT_DATE stores dates as (float) fractional days since 1899/12/30 00:00:00
00566                         $val= (float) variant_cast($f->value,VT_R8)*3600*24-2209161600;
00567                     else 
00568                         $val = $f->value;
00569                     $this->fields[] = adodb_date('Y-m-d H:i:s',$val);
00570                 }
00571                 break;          
00572             case 133:// A date value (yyyymmdd) 
00573                 if ($val = $f->value) {
00574                     $this->fields[] = substr($val,0,4).'-'.substr($val,4,2).'-'.substr($val,6,2);
00575                 } else
00576                     $this->fields[] = false;
00577                 break;
00578             case 7: // adDate
00579                 if (!strlen((string)$f->value)) $this->fields[] = false;
00580                 else {
00581                     if (!is_numeric($f->value)) $val = variant_date_to_timestamp($f->value);
00582                     else $val = $f->value;
00583                     
00584                     if (($val % 86400) == 0) $this->fields[] = adodb_date('Y-m-d',$val);
00585                     else $this->fields[] = adodb_date('Y-m-d H:i:s',$val);
00586                 }
00587                 break;
00588             case 1: // null
00589                 $this->fields[] = false;
00590                 break;
00591             case 6: // currency is not supported properly;
00592                 ADOConnection::outp( '<b>'.$f->Name.': currency type not supported by PHP</b>');
00593                 $this->fields[] = (float) $f->value;
00594                 break;
00595             default:
00596                 $this->fields[] = $f->value; 
00597                 break;
00598             }
00599             //print " $f->value $t, ";
00600             $f = next($this->_flds);
00601             $t = next($this->_tarr);
00602         } // for
00603         if ($this->hideErrors) error_reporting($olde);
00604         @$rs->MoveNext(); // @ needed for some versions of PHP!
00605         
00606         if ($this->fetchMode & ADODB_FETCH_ASSOC) {
00607             $this->fields = &$this->GetRowAssoc(ADODB_ASSOC_CASE);
00608         }
00609         return true;
00610     }

ADORecordSet_ado::_fetch  ) 
 

定義在 adodb-ado.inc.php 檔案之第 525 行.

參考 $flds, 及 $rs.

00526     {   
00527         $rs = $this->_queryID;
00528         if (!$rs or $rs->EOF) {
00529             $this->fields = false;
00530             return false;
00531         }
00532         $this->fields = array();
00533     
00534         if (!$this->_tarr) {
00535             $tarr = array();
00536             $flds = array();
00537             for ($i=0,$max = $this->_numOfFields; $i < $max; $i++) {
00538                 $f = $rs->Fields($i);
00539                 $flds[] = $f;
00540                 $tarr[] = $f->Type;
00541             }
00542             // bind types and flds only once
00543             $this->_tarr = $tarr; 
00544             $this->_flds = $flds;
00545         }
00546         $t = reset($this->_tarr);
00547         $f = reset($this->_flds);
00548         
00549         if ($this->hideErrors)  $olde = error_reporting(E_ERROR|E_CORE_ERROR);// sometimes $f->value be null
00550         for ($i=0,$max = $this->_numOfFields; $i < $max; $i++) {
00551             //echo "<p>",$t,' ';var_dump($f->value); echo '</p>';
00552             switch($t) {
00553             case 135: // timestamp
00554                 if (!strlen((string)$f->value)) $this->fields[] = false;
00555                 else {
00556                     if (!is_numeric($f->value)) # $val = variant_date_to_timestamp($f->value);
00557                         // VT_DATE stores dates as (float) fractional days since 1899/12/30 00:00:00
00558                         $val=(float) variant_cast($f->value,VT_R8)*3600*24-2209161600;
00559                     else 
00560                         $val = $f->value;
00561                     $this->fields[] = adodb_date('Y-m-d H:i:s',$val);
00562                 }
00563                 break;          
00564             case 133:// A date value (yyyymmdd) 
00565                 if ($val = $f->value) {
00566                     $this->fields[] = substr($val,0,4).'-'.substr($val,4,2).'-'.substr($val,6,2);
00567                 } else
00568                     $this->fields[] = false;
00569                 break;
00570             case 7: // adDate
00571                 if (!strlen((string)$f->value)) $this->fields[] = false;
00572                 else {
00573                     if (!is_numeric($f->value)) $val = variant_date_to_timestamp($f->value);
00574                     else $val = $f->value;
00575                     
00576                     if (($val % 86400) == 0) $this->fields[] = adodb_date('Y-m-d',$val);
00577                     else $this->fields[] = adodb_date('Y-m-d H:i:s',$val);
00578                 }
00579                 break;
00580             case 1: // null
00581                 $this->fields[] = false;
00582                 break;
00583             case 6: // currency is not supported properly;
00584                 ADOConnection::outp( '<b>'.$f->Name.': currency type not supported by PHP</b>');
00585                 $this->fields[] = (float) $f->value;
00586                 break;
00587             default:
00588                 $this->fields[] = $f->value; 
00589                 break;
00590             }
00591             //print " $f->value $t, ";
00592             $f = next($this->_flds);
00593             $t = next($this->_tarr);
00594         } // for
00595         if ($this->hideErrors) error_reporting($olde);
00596         @$rs->MoveNext(); // @ needed for some versions of PHP!
00597         
00598         if ($this->fetchMode & ADODB_FETCH_ASSOC) {
00599             $this->fields = &$this->GetRowAssoc(ADODB_ASSOC_CASE);
00600         }
00601         return true;
00602     }

ADORecordSet_ado::_initrs  ) 
 

定義在 adodb-ado5.inc.php 檔案之第 377 行.

參考 $rs.

00378     {
00379         $rs = $this->_queryID;
00380         $this->_numOfRows = $rs->RecordCount;
00381         
00382         $f = $rs->Fields;
00383         $this->_numOfFields = $f->Count;
00384     }

ADORecordSet_ado::_initrs  ) 
 

定義在 adodb-ado.inc.php 檔案之第 369 行.

參考 $rs.

00370     {
00371         $rs = $this->_queryID;
00372         $this->_numOfRows = $rs->RecordCount;
00373         
00374         $f = $rs->Fields;
00375         $this->_numOfFields = $f->Count;
00376     }

ADORecordSet_ado::_seek row  ) 
 

定義在 adodb-ado5.inc.php 檔案之第 388 行.

參考 $rs.

00389     {
00390        $rs = $this->_queryID; 
00391         // absoluteposition doesn't work -- my maths is wrong ?
00392         //  $rs->AbsolutePosition->$row-2;
00393         //  return true;
00394         if ($this->_currentRow > $row) return false;
00395         @$rs->Move((integer)$row - $this->_currentRow-1); //adBookmarkFirst
00396         return true;
00397     }

ADORecordSet_ado::_seek row  ) 
 

定義在 adodb-ado.inc.php 檔案之第 380 行.

參考 $rs.

00381     {
00382        $rs = $this->_queryID; 
00383         // absoluteposition doesn't work -- my maths is wrong ?
00384         //  $rs->AbsolutePosition->$row-2;
00385         //  return true;
00386         if ($this->_currentRow > $row) return false;
00387         @$rs->Move((integer)$row - $this->_currentRow-1); //adBookmarkFirst
00388         return true;
00389     }

& ADORecordSet_ado::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-ado5.inc.php 檔案之第 344 行.

參考 $rs, $t, 及 MetaType().

00344                                             {
00345         $off=$fieldOffset+1; // offsets begin at 1
00346         
00347         $o= new ADOFieldObject();
00348         $rs = $this->_queryID;
00349         $f = $rs->Fields($fieldOffset);
00350         $o->name = $f->Name;
00351         $t = $f->Type;
00352         $o->type = $this->MetaType($t);
00353         $o->max_length = $f->DefinedSize;
00354         $o->ado_type = $t;
00355         
00356 
00357         //print "off=$off name=$o->name type=$o->type len=$o->max_length<br>";
00358         return $o;
00359     }

& ADORecordSet_ado::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-ado.inc.php 檔案之第 337 行.

參考 $rs, $t, 及 MetaType().

被參考於 Fields().

00337                                             {
00338         $off=$fieldOffset+1; // offsets begin at 1
00339         
00340         $o= new ADOFieldObject();
00341         $rs = $this->_queryID;
00342         $f = $rs->Fields($fieldOffset);
00343         $o->name = $f->Name;
00344         $t = $f->Type;
00345         $o->type = $this->MetaType($t);
00346         $o->max_length = $f->DefinedSize;
00347         $o->ado_type = $t;  
00348 
00349         //print "off=$off name=$o->name type=$o->type len=$o->max_length<br>";
00350         return $o;
00351     }

ADORecordSet_ado::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-ado5.inc.php 檔案之第 362 行.

參考 FetchField().

00363     {
00364         if ($this->fetchMode & ADODB_FETCH_ASSOC) return $this->fields[$colname];
00365         if (!$this->bind) {
00366             $this->bind = array();
00367             for ($i=0; $i < $this->_numOfFields; $i++) {
00368                 $o = $this->FetchField($i);
00369                 $this->bind[strtoupper($o->name)] = $i;
00370             }
00371         }
00372         
00373          return $this->fields[$this->bind[strtoupper($colname)]];
00374     }

ADORecordSet_ado::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-ado.inc.php 檔案之第 354 行.

參考 FetchField().

00355     {
00356         if ($this->fetchMode & ADODB_FETCH_ASSOC) return $this->fields[$colname];
00357         if (!$this->bind) {
00358             $this->bind = array();
00359             for ($i=0; $i < $this->_numOfFields; $i++) {
00360                 $o = $this->FetchField($i);
00361                 $this->bind[strtoupper($o->name)] = $i;
00362             }
00363         }
00364         
00365          return $this->fields[$this->bind[strtoupper($colname)]];
00366     }

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

參數:
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).
傳回值:
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

依據ADORecordSet重新實作.

定義在 adodb-ado5.inc.php 檔案之第 481 行.

參考 $t.

00482     {
00483         if (is_object($t)) {
00484             $fieldobj = $t;
00485             $t = $fieldobj->type;
00486             $len = $fieldobj->max_length;
00487         }
00488         
00489         if (!is_numeric($t)) return $t;
00490         
00491         switch ($t) {
00492         case 0:
00493         case 12: // variant
00494         case 8: // bstr
00495         case 129: //char
00496         case 130: //wc
00497         case 200: // varc
00498         case 202:// varWC
00499         case 128: // bin
00500         case 204: // varBin
00501         case 72: // guid
00502             if ($len <= $this->blobSize) return 'C';
00503         
00504         case 201:
00505         case 203:
00506             return 'X';
00507         case 128:
00508         case 204:
00509         case 205:
00510              return 'B';
00511         case 7:
00512         case 133: return 'D';
00513         
00514         case 134:
00515         case 135: return 'T';
00516         
00517         case 11: return 'L';
00518         
00519         case 16://  adTinyInt   = 16,
00520         case 2://adSmallInt = 2,
00521         case 3://adInteger  = 3,
00522         case 4://adBigInt   = 20,
00523         case 17://adUnsignedTinyInt = 17,
00524         case 18://adUnsignedSmallInt    = 18,
00525         case 19://adUnsignedInt = 19,
00526         case 20://adUnsignedBigInt  = 21,
00527             return 'I';
00528         default: return 'N';
00529         }
00530     }

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

參數:
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).
傳回值:
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

依據ADORecordSet重新實作.

定義在 adodb-ado.inc.php 檔案之第 473 行.

參考 $t.

被參考於 FetchField().

00474     {
00475         if (is_object($t)) {
00476             $fieldobj = $t;
00477             $t = $fieldobj->type;
00478             $len = $fieldobj->max_length;
00479         }
00480         
00481         if (!is_numeric($t)) return $t;
00482         
00483         switch ($t) {
00484         case 0:
00485         case 12: // variant
00486         case 8: // bstr
00487         case 129: //char
00488         case 130: //wc
00489         case 200: // varc
00490         case 202:// varWC
00491         case 128: // bin
00492         case 204: // varBin
00493         case 72: // guid
00494             if ($len <= $this->blobSize) return 'C';
00495         
00496         case 201:
00497         case 203:
00498             return 'X';
00499         case 128:
00500         case 204:
00501         case 205:
00502              return 'B';
00503         case 7:
00504         case 133: return 'D';
00505         
00506         case 134:
00507         case 135: return 'T';
00508         
00509         case 11: return 'L';
00510         
00511         case 16://  adTinyInt   = 16,
00512         case 2://adSmallInt = 2,
00513         case 3://adInteger  = 3,
00514         case 4://adBigInt   = 20,
00515         case 17://adUnsignedTinyInt = 17,
00516         case 18://adUnsignedSmallInt    = 18,
00517         case 19://adUnsignedInt = 19,
00518         case 20://adUnsignedBigInt  = 21,
00519             return 'I';
00520         default: return 'N';
00521         }
00522     }

ADORecordSet_ado::NextRecordSet  ) 
 

依據ADORecordSet重新實作.

定義在 adodb-ado5.inc.php 檔案之第 612 行.

參考 $rs.

00613         {
00614             $rs = $this->_queryID;
00615             $this->_queryID = $rs->NextRecordSet();
00616             //$this->_queryID = $this->_QueryId->NextRecordSet();
00617             if ($this->_queryID == null) return false;
00618             
00619             $this->_currentRow = -1;
00620             $this->_currentPage = -1;
00621             $this->bind = false;
00622             $this->fields = false;
00623             $this->_flds = false;
00624             $this->_tarr = false;
00625             
00626             $this->_inited = false;
00627             $this->Init();
00628             return true;
00629         }

ADORecordSet_ado::NextRecordSet  ) 
 

依據ADORecordSet重新實作.

定義在 adodb-ado.inc.php 檔案之第 604 行.

參考 $rs.

00605         {
00606             $rs = $this->_queryID;
00607             $this->_queryID = $rs->NextRecordSet();
00608             //$this->_queryID = $this->_QueryId->NextRecordSet();
00609             if ($this->_queryID == null) return false;
00610             
00611             $this->_currentRow = -1;
00612             $this->_currentPage = -1;
00613             $this->bind = false;
00614             $this->fields = false;
00615             $this->_flds = false;
00616             $this->_tarr = false;
00617             
00618             $this->_inited = false;
00619             $this->Init();
00620             return true;
00621         }


資料成員說明文件

ADORecordSet_ado::$_flds
 

定義在 adodb-ado.inc.php 檔案之第 321 行.

ADORecordSet_ado::$_tarr = false
 

定義在 adodb-ado.inc.php 檔案之第 320 行.

ADORecordSet_ado::$bind = false
 

datetime in Unix format rs created -- for cached recordsets

依據ADORecordSet重新實作.

定義在 adodb-ado.inc.php 檔案之第 317 行.

ADORecordSet_ado::$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-ado.inc.php 檔案之第 322 行.

ADORecordSet_ado::$databaseType = "ado"
 

ADORecordSet_ado_access, 及 ADORecordSet_ado_mssql重新實作.

定義在 adodb-ado.inc.php 檔案之第 318 行.

ADORecordSet_ado::$dataProvider = "ado"
 

依據ADORecordSet重新實作.

定義在 adodb-ado.inc.php 檔案之第 319 行.

ADORecordSet_ado::$hideErrors = true
 

定義在 adodb-ado.inc.php 檔案之第 323 行.


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