3 V5.14 8 Sept 2011 (c) 2000-2011 John Lim (jlim#natsoft.com). All rights reserved.
4 Released under both BSD license and Lesser GPL library license.
5 Whenever there is any discrepancy between the two licenses,
6 the BSD license will take precedence.
8 Latest version is available at http://adodb.sourceforge.net
10 Interbase data driver. Requires interbase client. Works on Windows and Unix.
12 3 Jan 2002 -- suggestions by Hans-Peter Oeri <kampfcaspar75@oeri.ch>
13 changed transaction handling and added experimental blob stuff
15 Docs to interbase at the website
16 http://www.synectics.co.za/php3/tutorial/IB_PHP3_API.html
19 http://www.volny.cz/iprenosil/interbase/ip_ib_code.htm#_code_creategen
21 $rs = $conn->Execute('select gen_id(adodb,1) from rdb$database');
23 $conn->Execute("insert into table (id, col1,...) values ($id, $val1,...)");
26 // security - hide paths
27 if (!defined('ADODB_DIR')) die();
29 class ADODB_ibase
extends ADOConnection
{
30 var $databaseType = "ibase";
31 var $dataProvider = "ibase";
32 var $replaceQuote = "''"; // string to use to replace quotes
33 var $ibase_datefmt = '%Y-%m-%d'; // For hours,mins,secs change to '%Y-%m-%d %H:%M:%S';
34 var $fmtDate = "'Y-m-d'";
35 var $ibase_timestampfmt = "%Y-%m-%d %H:%M:%S";
36 var $ibase_timefmt = "%H:%M:%S";
37 var $fmtTimeStamp = "'Y-m-d, H:i:s'";
38 var $concat_operator='||';
40 var $metaTablesSQL = "select rdb\$relation_name from rdb\$relations where rdb\$relation_name not like 'RDB\$%'";
42 var $metaColumnsSQL = "select a.rdb\$field_name, a.rdb\$null_flag, a.rdb\$default_source, b.rdb\$field_length, b.rdb\$field_scale, b.rdb\$field_sub_type, b.rdb\$field_precision, b.rdb\$field_type from rdb\$relation_fields a, rdb\$fields b where a.rdb\$field_source = b.rdb\$field_name and a.rdb\$relation_name = '%s' order by a.rdb\$field_position asc";
46 var $_bindInputArray = true;
49 var $sysDate = "cast('TODAY' as timestamp)";
50 var $sysTimeStamp = "CURRENT_TIMESTAMP"; //"cast('NOW' as timestamp)";
51 var $ansiOuter = true;
52 var $hasAffectedRows = false;
53 var $poorAffectedRows = true;
54 var $blobEncodeType = 'C';
57 function ADODB_ibase()
59 if (defined('IBASE_DEFAULT')) $this->ibasetrans
= IBASE_DEFAULT
;
63 // returns true or false
64 function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$persist=false)
66 if (!function_exists('ibase_pconnect')) return null;
67 if ($argDatabasename) $argHostname .= ':'.$argDatabasename;
68 $fn = ($persist) ?
'ibase_pconnect':'ibase_connect';
70 $this->_connectionID
= $fn($argHostname,$argUsername,$argPassword,
71 $this->charSet
,$this->buffers
,$this->dialect
,$this->role
);
73 $this->_connectionID
= $fn($argHostname,$argUsername,$argPassword,
74 $this->charSet
,$this->buffers
,$this->dialect
);
76 if ($this->dialect
!= 1) { // http://www.ibphoenix.com/ibp_60_del_id_ds.html
77 $this->replaceQuote
= "''";
79 if ($this->_connectionID
=== false) {
80 $this->_handleerror();
85 if (function_exists('ibase_timefmt')) {
86 ibase_timefmt($this->ibase_datefmt
,IBASE_DATE
);
87 if ($this->dialect
== 1) ibase_timefmt($this->ibase_datefmt
,IBASE_TIMESTAMP
);
88 else ibase_timefmt($this->ibase_timestampfmt
,IBASE_TIMESTAMP
);
89 ibase_timefmt($this->ibase_timefmt
,IBASE_TIME
);
92 ini_set("ibase.timestampformat", $this->ibase_timestampfmt
);
93 ini_set("ibase.dateformat", $this->ibase_datefmt
);
94 ini_set("ibase.timeformat", $this->ibase_timefmt
);
98 // returns true or false
99 function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
101 return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename,true);
105 function MetaPrimaryKeys($table,$owner_notused=false,$internalKey=false)
107 if ($internalKey) return array('RDB$DB_KEY');
109 $table = strtoupper($table);
111 $sql = 'SELECT S.RDB$FIELD_NAME AFIELDNAME
112 FROM RDB$INDICES I JOIN RDB$INDEX_SEGMENTS S ON I.RDB$INDEX_NAME=S.RDB$INDEX_NAME
113 WHERE I.RDB$RELATION_NAME=\''.$table.'\' and I.RDB$INDEX_NAME like \'RDB$PRIMARY%\'
114 ORDER BY I.RDB$INDEX_NAME,S.RDB$FIELD_POSITION';
116 $a = $this->GetCol($sql,false,true);
117 if ($a && sizeof($a)>0) return $a;
121 function ServerInfo()
123 $arr['dialect'] = $this->dialect
;
124 switch($arr['dialect']) {
126 case '1': $s = 'Interbase 5.5 or earlier'; break;
127 case '2': $s = 'Interbase 5.6'; break;
129 case '3': $s = 'Interbase 6.0'; break;
131 $arr['version'] = ADOConnection
::_findvers($s);
132 $arr['description'] = $s;
136 function BeginTrans()
138 if ($this->transOff
) return true;
139 $this->transCnt +
= 1;
140 $this->autoCommit
= false;
141 $this->_transactionID
= $this->_connectionID
;//ibase_trans($this->ibasetrans, $this->_connectionID);
142 return $this->_transactionID
;
145 function CommitTrans($ok=true)
147 if (!$ok) return $this->RollbackTrans();
148 if ($this->transOff
) return true;
149 if ($this->transCnt
) $this->transCnt
-= 1;
151 $this->autoCommit
= true;
152 if ($this->_transactionID
) {
154 $ret = ibase_commit($this->_transactionID
);
156 $this->_transactionID
= false;
160 // there are some compat problems with ADODB_COUNTRECS=false and $this->_logsql currently.
161 // it appears that ibase extension cannot support multiple concurrent queryid's
162 function _Execute($sql,$inputarr=false)
164 global $ADODB_COUNTRECS;
166 if ($this->_logsql
) {
167 $savecrecs = $ADODB_COUNTRECS;
168 $ADODB_COUNTRECS = true; // force countrecs
169 $ret = ADOConnection
::_Execute($sql,$inputarr);
170 $ADODB_COUNTRECS = $savecrecs;
172 $ret = ADOConnection
::_Execute($sql,$inputarr);
177 function RollbackTrans()
179 if ($this->transOff
) return true;
180 if ($this->transCnt
) $this->transCnt
-= 1;
182 $this->autoCommit
= true;
183 if ($this->_transactionID
)
184 $ret = ibase_rollback($this->_transactionID
);
185 $this->_transactionID
= false;
190 function MetaIndexes ($table, $primary = FALSE, $owner=false)
192 // save old fetch mode
193 global $ADODB_FETCH_MODE;
195 $save = $ADODB_FETCH_MODE;
196 $ADODB_FETCH_MODE = ADODB_FETCH_NUM
;
197 if ($this->fetchMode
!== FALSE) {
198 $savem = $this->SetFetchMode(FALSE);
200 $table = strtoupper($table);
201 $sql = "SELECT * FROM RDB\$INDICES WHERE RDB\$RELATION_NAME = '".$table."'";
203 $sql .= " AND RDB\$INDEX_NAME NOT LIKE 'RDB\$%'";
205 $sql .= " AND RDB\$INDEX_NAME NOT LIKE 'RDB\$FOREIGN%'";
208 $rs = $this->Execute($sql);
209 if (!is_object($rs)) {
212 $this->SetFetchMode($savem);
214 $ADODB_FETCH_MODE = $save;
219 while ($row = $rs->FetchRow()) {
221 if (!isset($indexes[$index])) {
222 if (is_null($row[3])) {$row[3] = 0;}
223 $indexes[$index] = array(
224 'unique' => ($row[3] == 1),
228 $sql = "SELECT * FROM RDB\$INDEX_SEGMENTS WHERE RDB\$INDEX_NAME = '".$index."' ORDER BY RDB\$FIELD_POSITION ASC";
229 $rs1 = $this->Execute($sql);
230 while ($row1 = $rs1->FetchRow()) {
231 $indexes[$index]['columns'][$row1[2]] = $row1[1];
236 $this->SetFetchMode($savem);
238 $ADODB_FETCH_MODE = $save;
244 // See http://community.borland.com/article/0,1410,25844,00.html
245 function RowLock($tables,$where,$col=false)
247 if ($this->autoCommit
) $this->BeginTrans();
248 $this->Execute("UPDATE $table SET $col=$col WHERE $where "); // is this correct - jlim?
253 function CreateSequence($seqname,$startID=1)
255 $ok = $this->Execute(("INSERT INTO RDB\$GENERATORS (RDB\$GENERATOR_NAME) VALUES (UPPER('$seqname'))" ));
256 if (!$ok) return false;
257 return $this->Execute("SET GENERATOR $seqname TO ".($startID-1).';');
260 function DropSequence($seqname)
262 $seqname = strtoupper($seqname);
263 $this->Execute("delete from RDB\$GENERATORS where RDB\$GENERATOR_NAME='$seqname'");
266 function GenID($seqname='adodbseq',$startID=1)
268 $getnext = ("SELECT Gen_ID($seqname,1) FROM RDB\$DATABASE");
269 $rs = @$this->Execute($getnext);
271 $this->Execute(("INSERT INTO RDB\$GENERATORS (RDB\$GENERATOR_NAME) VALUES (UPPER('$seqname'))" ));
272 $this->Execute("SET GENERATOR $seqname TO ".($startID-1).';');
273 $rs = $this->Execute($getnext);
275 if ($rs && !$rs->EOF
) $this->genID
= (integer) reset($rs->fields
);
276 else $this->genID
= 0; // false
278 if ($rs) $rs->Close();
283 function SelectDB($dbName)
288 function _handleerror()
290 $this->_errorMsg
= ibase_errmsg();
295 if (preg_match('/error code = ([\-0-9]*)/i', $this->_errorMsg
,$arr)) return (integer) $arr[1];
301 return $this->_errorMsg
;
304 function Prepare($sql)
306 $stmt = ibase_prepare($this->_connectionID
,$sql);
307 if (!$stmt) return false;
308 return array($sql,$stmt);
311 // returns query ID if successful, otherwise false
312 // there have been reports of problems with nested queries - the code is probably not re-entrant?
313 function _query($sql,$iarr=false)
316 if (!$this->autoCommit
&& $this->_transactionID
) {
317 $conn = $this->_transactionID
;
320 $conn = $this->_connectionID
;
323 if (is_array($sql)) {
324 $fn = 'ibase_execute';
326 if (is_array($iarr)) {
327 if (ADODB_PHPVER
>= 0x4050) { // actually 4.0.4
328 if ( !isset($iarr[0]) ) $iarr[0] = ''; // PHP5 compat hack
329 $fnarr = array_merge( array($sql) , $iarr);
330 $ret = call_user_func_array($fn,$fnarr);
332 switch(sizeof($iarr)) {
333 case 1: $ret = $fn($sql,$iarr[0]); break;
334 case 2: $ret = $fn($sql,$iarr[0],$iarr[1]); break;
335 case 3: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2]); break;
336 case 4: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3]); break;
337 case 5: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4]); break;
338 case 6: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5]); break;
339 case 7: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6]); break;
340 default: ADOConnection
::outp( "Too many parameters to ibase query $sql");
341 case 8: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6],$iarr[7]); break;
344 } else $ret = $fn($sql);
348 if (is_array($iarr)) {
349 if (ADODB_PHPVER
>= 0x4050) { // actually 4.0.4
350 if (sizeof($iarr) == 0) $iarr[0] = ''; // PHP5 compat hack
351 $fnarr = array_merge( array($conn,$sql) , $iarr);
352 $ret = call_user_func_array($fn,$fnarr);
354 switch(sizeof($iarr)) {
355 case 1: $ret = $fn($conn,$sql,$iarr[0]); break;
356 case 2: $ret = $fn($conn,$sql,$iarr[0],$iarr[1]); break;
357 case 3: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2]); break;
358 case 4: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3]); break;
359 case 5: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4]); break;
360 case 6: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5]); break;
361 case 7: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6]); break;
362 default: ADOConnection
::outp( "Too many parameters to ibase query $sql");
363 case 8: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6],$iarr[7]); break;
366 } else $ret = $fn($conn,$sql);
368 if ($docommit && $ret === true) ibase_commit($this->_connectionID
);
370 $this->_handleerror();
374 // returns true or false
377 if (!$this->autoCommit
) @ibase_rollback
($this->_connectionID
);
378 return @ibase_close
($this->_connectionID
);
382 function _ConvertFieldType(&$fld, $ftype, $flen, $fscale, $fsubtype, $fprecision, $dialect3)
384 $fscale = abs($fscale);
385 $fld->max_length
= $flen;
393 $fld->type
= ($ftype == 7 ?
'smallint' : 'integer');
396 $fld->type
= 'numeric';
397 $fld->max_length
= $fprecision;
398 $fld->scale
= $fscale;
401 $fld->type
= 'decimal';
402 $fld->max_length
= $fprecision;
403 $fld->scale
= $fscale;
408 $fld->type
= 'decimal';
409 $fld->scale
= $fscale;
410 $fld->max_length
= ($ftype == 7 ?
4 : 9);
412 $fld->type
= ($ftype == 7 ?
'smallint' : 'integer');
420 $fld->type
= 'decimal';
421 $fld->max_length
= 18;
425 $fld->type
= 'numeric';
426 $fld->max_length
= $fprecision;
427 $fld->scale
= $fscale;
430 $fld->type
= 'decimal';
431 $fld->max_length
= $fprecision;
432 $fld->scale
= $fscale;
438 $fld->type
= 'float';
445 $fld->type
= 'decimal';
446 $fld->max_length
= 15;
449 $fld->type
= 'double';
454 $fld->type
= 'timestamp';
466 $fld->type
= 'varchar';
469 $fld->type
= 'cstring';
473 $fld->max_length
= -1;
478 // returns array of ADOFieldObjects for current table
479 function MetaColumns($table, $normalize=true)
481 global $ADODB_FETCH_MODE;
483 $save = $ADODB_FETCH_MODE;
484 $ADODB_FETCH_MODE = ADODB_FETCH_NUM
;
486 $rs = $this->Execute(sprintf($this->metaColumnsSQL
,strtoupper($table)));
488 $ADODB_FETCH_MODE = $save;
496 $dialect3 = ($this->dialect
==3 ?
true : false);
498 while (!$rs->EOF
) { //print_r($rs->fields);
499 $fld = new ADOFieldObject();
500 $fld->name
= trim($rs->fields
[0]);
502 $this->_ConvertFieldType($fld, $rs->fields
[7], $rs->fields
[3], $rs->fields
[4], $rs->fields
[5], $rs->fields
[6], $dialect3);
503 if (isset($rs->fields
[1]) && $rs->fields
[1]) {
504 $fld->not_null
= true;
506 if (isset($rs->fields
[2])) {
508 $fld->has_default
= true;
509 $d = substr($rs->fields
[2],strlen('default '));
513 case 'integer': $fld->default_value
= (int) $d; break;
517 case 'varchar': $fld->default_value
= (string) substr($d,1,strlen($d)-2); break;
519 case 'float': $fld->default_value
= (float) $d; break;
520 default: $fld->default_value
= $d; break;
522 // case 35:$tt = 'TIMESTAMP'; break;
524 if ((isset($rs->fields
[5])) && ($fld->type
== 'blob')) {
525 $fld->sub_type
= $rs->fields
[5];
527 $fld->sub_type
= null;
530 if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM
) $retarr[] = $fld;
531 else $retarr[strtoupper($fld->name
)] = $fld;
536 if ( empty($retarr)) return $false;
540 function BlobEncode( $blob )
542 $blobid = ibase_blob_create( $this->_connectionID
);
543 ibase_blob_add( $blobid, $blob );
544 return ibase_blob_close( $blobid );
547 // since we auto-decode all blob's since 2.42,
548 // BlobDecode should not do any transforms
549 function BlobDecode($blob)
557 // old blobdecode function
558 // still used to auto-decode all blob's
559 function _BlobDecode_old( $blob )
561 $blobid = ibase_blob_open($this->_connectionID
, $blob );
562 $realblob = ibase_blob_get( $blobid,$this->maxblobsize
); // 2nd param is max size of blob -- Kevin Boillet <kevinboillet@yahoo.fr>
563 while($string = ibase_blob_get($blobid, 8192)){
564 $realblob .= $string;
566 ibase_blob_close( $blobid );
571 function _BlobDecode( $blob )
573 if (ADODB_PHPVER
>= 0x5000) {
574 $blob_data = ibase_blob_info($this->_connectionID
, $blob );
575 $blobid = ibase_blob_open($this->_connectionID
, $blob );
578 $blob_data = ibase_blob_info( $blob );
579 $blobid = ibase_blob_open( $blob );
582 if( $blob_data[0] > $this->maxblobsize
) {
584 $realblob = ibase_blob_get($blobid, $this->maxblobsize
);
586 while($string = ibase_blob_get($blobid, 8192)){
587 $realblob .= $string;
590 $realblob = ibase_blob_get($blobid, $blob_data[0]);
593 ibase_blob_close( $blobid );
597 function UpdateBlobFile($table,$column,$path,$where,$blobtype='BLOB')
599 $fd = fopen($path,'rb');
600 if ($fd === false) return false;
601 $blob_id = ibase_blob_create($this->_connectionID
);
605 while ($val = fread($fd,32768)){
606 ibase_blob_add($blob_id, $val);
609 /* close and get $blob_id_str for inserting into table */
610 $blob_id_str = ibase_blob_close($blob_id);
613 return $this->Execute("UPDATE $table SET $column=(?) WHERE $where",array($blob_id_str)) != false;
617 Insert a null into the blob field of the table first.
618 Then use UpdateBlob to store the blob.
622 $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
623 $conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');
625 function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
627 $blob_id = ibase_blob_create($this->_connectionID
);
629 // ibase_blob_add($blob_id, $val);
631 // replacement that solves the problem by which only the first modulus 64K /
632 // of $val are stored at the blob field ////////////////////////////////////
633 // Thx Abel Berenstein aberenstein#afip.gov.ar
636 $tail_size = $len %
$chunk_size;
637 $n_chunks = ($len - $tail_size) / $chunk_size;
639 for ($n = 0; $n < $n_chunks; $n++
) {
640 $start = $n * $chunk_size;
641 $data = substr($val, $start, $chunk_size);
642 ibase_blob_add($blob_id, $data);
646 $start = $n_chunks * $chunk_size;
647 $data = substr($val, $start, $tail_size);
648 ibase_blob_add($blob_id, $data);
650 // end replacement /////////////////////////////////////////////////////////
652 $blob_id_str = ibase_blob_close($blob_id);
654 return $this->Execute("UPDATE $table SET $column=(?) WHERE $where",array($blob_id_str)) != false;
659 function OldUpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
661 $blob_id = ibase_blob_create($this->_connectionID
);
662 ibase_blob_add($blob_id, $val);
663 $blob_id_str = ibase_blob_close($blob_id);
664 return $this->Execute("UPDATE $table SET $column=(?) WHERE $where",array($blob_id_str)) != false;
667 // Format date column in sql string given an input format that understands Y M D
668 // Only since Interbase 6.0 - uses EXTRACT
669 // problem - does not zero-fill the day and month yet
670 function SQLDate($fmt, $col=false)
672 if (!$col) $col = $this->sysDate
;
676 for ($i=0; $i < $len; $i++
) {
682 $s .= "extract(year from $col)";
686 $s .= "extract(month from $col)";
690 $s .= "cast(((extract(month from $col)+2) / 3) as integer)";
694 $s .= "(extract(day from $col))";
698 $s .= "(extract(hour from $col))";
702 $s .= "(extract(minute from $col))";
706 $s .= "CAST((extract(second from $col)) AS INTEGER)";
712 $ch = substr($fmt,$i,1);
714 $s .= $this->qstr($ch);
722 /*--------------------------------------------------------------------------------------
723 Class Name: Recordset
724 --------------------------------------------------------------------------------------*/
726 class ADORecordset_ibase
extends ADORecordSet
729 var $databaseType = "ibase";
733 function ADORecordset_ibase($id,$mode=false)
735 global $ADODB_FETCH_MODE;
737 $this->fetchMode
= ($mode === false) ?
$ADODB_FETCH_MODE : $mode;
738 $this->ADORecordSet($id);
741 /* Returns: an object containing field information.
742 Get column information in the Recordset object. fetchField() can be used in order to obtain information about
743 fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by
744 fetchField() is retrieved. */
746 function FetchField($fieldOffset = -1)
748 $fld = new ADOFieldObject
;
749 $ibf = ibase_field_info($this->_queryID
,$fieldOffset);
750 switch (ADODB_ASSOC_CASE
) {
751 case 2: // the default
752 $fld->name
= ($ibf['alias']);
753 if (empty($fld->name
)) $fld->name
= ($ibf['name']);
756 $fld->name
= strtoupper($ibf['alias']);
757 if (empty($fld->name
)) $fld->name
= strtoupper($ibf['name']);
760 $fld->name
= strtolower($ibf['alias']);
761 if (empty($fld->name
)) $fld->name
= strtolower($ibf['name']);
765 $fld->type
= $ibf['type'];
766 $fld->max_length
= $ibf['length'];
768 /* This needs to be populated from the metadata */
769 $fld->not_null
= false;
770 $fld->has_default
= false;
771 $fld->default_value
= 'null';
777 $this->_numOfRows
= -1;
778 $this->_numOfFields
= @ibase_num_fields
($this->_queryID
);
780 // cache types for blob decode check
781 for ($i=0, $max = $this->_numOfFields
; $i < $max; $i++
) {
782 $f1 = $this->FetchField($i);
783 $this->_cacheType
[] = $f1->type
;
794 $f = @ibase_fetch_row
($this->_queryID
);
796 $this->fields
= false;
799 // OPN stuff start - optimized
800 // fix missing nulls and decode blobs automatically
802 global $ADODB_ANSI_PADDING_OFF;
803 //$ADODB_ANSI_PADDING_OFF=1;
804 $rtrim = !empty($ADODB_ANSI_PADDING_OFF);
806 for ($i=0, $max = $this->_numOfFields
; $i < $max; $i++
) {
807 if ($this->_cacheType
[$i]=="BLOB") {
809 $f[$i] = $this->connection
->_BlobDecode($f[$i]);
814 if (!isset($f[$i])) {
816 } else if ($rtrim && is_string($f[$i])) {
817 $f[$i] = rtrim($f[$i]);
824 if ($this->fetchMode
== ADODB_FETCH_ASSOC
) {
825 $this->fields
= $this->GetRowAssoc(ADODB_ASSOC_CASE
);
826 } else if ($this->fetchMode
== ADODB_FETCH_BOTH
) {
827 $this->fields
= array_merge($this->fields
,$this->GetRowAssoc(ADODB_ASSOC_CASE
));
832 /* Use associative array to get fields array */
833 function Fields($colname)
835 if ($this->fetchMode
& ADODB_FETCH_ASSOC
) return $this->fields
[$colname];
837 $this->bind
= array();
838 for ($i=0; $i < $this->_numOfFields
; $i++
) {
839 $o = $this->FetchField($i);
840 $this->bind
[strtoupper($o->name
)] = $i;
844 return $this->fields
[$this->bind
[strtoupper($colname)]];
851 return @ibase_free_result
($this->_queryID
);
854 function MetaType($t,$len=-1,$fieldobj=false)
858 $t = $fieldobj->type
;
859 $len = $fieldobj->max_length
;
861 switch (strtoupper($t)) {
868 if ($len <= $this->blobSize
) return 'C';
874 case 'DATE': return 'D';
875 case 'TIME': return 'T';
876 //case 'T': return 'T';
878 //case 'L': return 'L';
881 case 'INTEGER': return 'I';