3 @version v5.20.19 13-Dec-2020
4 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
5 @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
6 Released under both BSD license and Lesser GPL library license.
7 Whenever there is any discrepancy between the two licenses,
8 the BSD license will take precedence.
10 Latest version is available at http://adodb.org/
12 Interbase data driver. Requires interbase client. Works on Windows and Unix.
14 3 Jan 2002 -- suggestions by Hans-Peter Oeri <kampfcaspar75@oeri.ch>
15 changed transaction handling and added experimental blob stuff
17 Docs to interbase at the website
18 http://www.synectics.co.za/php3/tutorial/IB_PHP3_API.html
21 http://www.volny.cz/iprenosil/interbase/ip_ib_code.htm#_code_creategen
23 $rs = $conn->Execute('select gen_id(adodb,1) from rdb$database');
25 $conn->Execute("insert into table (id, col1,...) values ($id, $val1,...)");
28 // security - hide paths
29 if (!defined('ADODB_DIR')) die();
31 class ADODB_ibase extends ADOConnection {
32 var $databaseType = "ibase";
33 var $dataProvider = "ibase";
34 var $replaceQuote = "''"; // string to use to replace quotes
35 var $ibase_datefmt = '%Y-%m-%d'; // For hours,mins,secs change to '%Y-%m-%d %H:%M:%S';
36 var $fmtDate = "'Y-m-d'";
37 var $ibase_timestampfmt = "%Y-%m-%d %H:%M:%S";
38 var $ibase_timefmt = "%H:%M:%S";
39 var $fmtTimeStamp = "'Y-m-d, H:i:s'";
40 var $concat_operator='||';
42 var $metaTablesSQL = "select rdb\$relation_name from rdb\$relations where rdb\$relation_name not like 'RDB\$%'";
44 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";
48 var $_bindInputArray = true;
51 var $sysDate = "cast('TODAY' as timestamp)";
52 var $sysTimeStamp = "CURRENT_TIMESTAMP"; //"cast('NOW' as timestamp)";
53 var $ansiOuter = true;
54 var $hasAffectedRows = false;
55 var $poorAffectedRows = true;
56 var $blobEncodeType = 'C';
59 function __construct()
61 if (defined('IBASE_DEFAULT')) $this->ibasetrans = IBASE_DEFAULT;
65 // returns true or false
66 function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$persist=false)
68 if (!function_exists('ibase_pconnect')) return null;
69 if ($argDatabasename) $argHostname .= ':'.$argDatabasename;
70 $fn = ($persist) ? 'ibase_pconnect':'ibase_connect';
72 $this->_connectionID = $fn($argHostname,$argUsername,$argPassword,
73 $this->charSet,$this->buffers,$this->dialect,$this->role);
75 $this->_connectionID = $fn($argHostname,$argUsername,$argPassword,
76 $this->charSet,$this->buffers,$this->dialect);
78 if ($this->dialect != 1) { // http://www.ibphoenix.com/ibp_60_del_id_ds.html
79 $this->replaceQuote = "''";
81 if ($this->_connectionID === false) {
82 $this->_handleerror();
87 if (function_exists('ibase_timefmt')) {
88 ibase_timefmt($this->ibase_datefmt,IBASE_DATE );
89 if ($this->dialect == 1) {
90 ibase_timefmt($this->ibase_datefmt,IBASE_TIMESTAMP );
93 ibase_timefmt($this->ibase_timestampfmt,IBASE_TIMESTAMP );
95 ibase_timefmt($this->ibase_timefmt,IBASE_TIME );
98 ini_set("ibase.timestampformat", $this->ibase_timestampfmt);
99 ini_set("ibase.dateformat", $this->ibase_datefmt);
100 ini_set("ibase.timeformat", $this->ibase_timefmt);
105 // returns true or false
106 function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
108 return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename,true);
112 function MetaPrimaryKeys($table,$owner_notused=false,$internalKey=false)
115 return array('RDB$DB_KEY');
118 $table = strtoupper($table);
120 $sql = 'SELECT S.RDB$FIELD_NAME AFIELDNAME
121 FROM RDB$INDICES I JOIN RDB$INDEX_SEGMENTS S ON I.RDB$INDEX_NAME=S.RDB$INDEX_NAME
122 WHERE I.RDB$RELATION_NAME=\''.$table.'\' and I.RDB$INDEX_NAME like \'RDB$PRIMARY%\'
123 ORDER BY I.RDB$INDEX_NAME,S.RDB$FIELD_POSITION';
125 $a = $this->GetCol($sql,false,true);
126 if ($a && sizeof($a)>0) return $a;
130 function ServerInfo()
132 $arr['dialect'] = $this->dialect;
133 switch($arr['dialect']) {
135 case '1': $s = 'Interbase 5.5 or earlier'; break;
136 case '2': $s = 'Interbase 5.6'; break;
138 case '3': $s = 'Interbase 6.0'; break;
140 $arr['version'] = ADOConnection::_findvers($s);
141 $arr['description'] = $s;
145 function BeginTrans()
147 if ($this->transOff) return true;
148 $this->transCnt += 1;
149 $this->autoCommit = false;
150 $this->_transactionID = $this->_connectionID;//ibase_trans($this->ibasetrans, $this->_connectionID);
151 return $this->_transactionID;
154 function CommitTrans($ok=true)
157 return $this->RollbackTrans();
159 if ($this->transOff) {
162 if ($this->transCnt) {
163 $this->transCnt -= 1;
166 $this->autoCommit = true;
167 if ($this->_transactionID) {
169 $ret = ibase_commit($this->_transactionID);
171 $this->_transactionID = false;
175 // there are some compat problems with ADODB_COUNTRECS=false and $this->_logsql currently.
176 // it appears that ibase extension cannot support multiple concurrent queryid's
177 function _Execute($sql,$inputarr=false)
179 global $ADODB_COUNTRECS;
181 if ($this->_logsql) {
182 $savecrecs = $ADODB_COUNTRECS;
183 $ADODB_COUNTRECS = true; // force countrecs
184 $ret = ADOConnection::_Execute($sql,$inputarr);
185 $ADODB_COUNTRECS = $savecrecs;
187 $ret = ADOConnection::_Execute($sql,$inputarr);
192 function RollbackTrans()
194 if ($this->transOff) return true;
195 if ($this->transCnt) $this->transCnt -= 1;
197 $this->autoCommit = true;
198 if ($this->_transactionID) {
199 $ret = ibase_rollback($this->_transactionID);
201 $this->_transactionID = false;
206 function MetaIndexes ($table, $primary = FALSE, $owner=false)
208 // save old fetch mode
209 global $ADODB_FETCH_MODE;
211 $save = $ADODB_FETCH_MODE;
212 $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
213 if ($this->fetchMode !== FALSE) {
214 $savem = $this->SetFetchMode(FALSE);
216 $table = strtoupper($table);
217 $sql = "SELECT * FROM RDB\$INDICES WHERE RDB\$RELATION_NAME = '".$table."'";
219 $sql .= " AND RDB\$INDEX_NAME NOT LIKE 'RDB\$%'";
221 $sql .= " AND RDB\$INDEX_NAME NOT LIKE 'RDB\$FOREIGN%'";
224 $rs = $this->Execute($sql);
225 if (!is_object($rs)) {
228 $this->SetFetchMode($savem);
230 $ADODB_FETCH_MODE = $save;
235 while ($row = $rs->FetchRow()) {
237 if (!isset($indexes[$index])) {
238 if (is_null($row[3])) {
241 $indexes[$index] = array(
242 'unique' => ($row[3] == 1),
246 $sql = "SELECT * FROM RDB\$INDEX_SEGMENTS WHERE RDB\$INDEX_NAME = '".$index."' ORDER BY RDB\$FIELD_POSITION ASC";
247 $rs1 = $this->Execute($sql);
248 while ($row1 = $rs1->FetchRow()) {
249 $indexes[$index]['columns'][$row1[2]] = $row1[1];
254 $this->SetFetchMode($savem);
256 $ADODB_FETCH_MODE = $save;
262 // See http://community.borland.com/article/0,1410,25844,00.html
263 function RowLock($tables,$where,$col=false)
265 if ($this->autoCommit) {
268 $this->Execute("UPDATE $table SET $col=$col WHERE $where "); // is this correct - jlim?
273 function CreateSequence($seqname = 'adodbseq', $startID = 1)
275 $ok = $this->Execute(("INSERT INTO RDB\$GENERATORS (RDB\$GENERATOR_NAME) VALUES (UPPER('$seqname'))" ));
276 if (!$ok) return false;
277 return $this->Execute("SET GENERATOR $seqname TO ".($startID-1).';');
280 function DropSequence($seqname = 'adodbseq')
282 $seqname = strtoupper($seqname);
283 $this->Execute("delete from RDB\$GENERATORS where RDB\$GENERATOR_NAME='$seqname'");
286 function GenID($seqname='adodbseq',$startID=1)
288 $getnext = ("SELECT Gen_ID($seqname,1) FROM RDB\$DATABASE");
289 $rs = @$this->Execute($getnext);
291 $this->Execute(("INSERT INTO RDB\$GENERATORS (RDB\$GENERATOR_NAME) VALUES (UPPER('$seqname'))" ));
292 $this->Execute("SET GENERATOR $seqname TO ".($startID-1).';');
293 $rs = $this->Execute($getnext);
295 if ($rs && !$rs->EOF) {
296 $this->genID = (integer) reset($rs->fields);
299 $this->genID = 0; // false
309 function SelectDB($dbName)
314 function _handleerror()
316 $this->_errorMsg = ibase_errmsg();
321 if (preg_match('/error code = ([\-0-9]*)/i', $this->_errorMsg,$arr)) return (integer) $arr[1];
327 return $this->_errorMsg;
330 function Prepare($sql)
332 $stmt = ibase_prepare($this->_connectionID,$sql);
333 if (!$stmt) return false;
334 return array($sql,$stmt);
337 // returns query ID if successful, otherwise false
338 // there have been reports of problems with nested queries - the code is probably not re-entrant?
339 function _query($sql,$iarr=false)
342 if (!$this->autoCommit && $this->_transactionID) {
343 $conn = $this->_transactionID;
346 $conn = $this->_connectionID;
349 if (is_array($sql)) {
350 $fn = 'ibase_execute';
352 if (is_array($iarr)) {
353 if (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
354 if ( !isset($iarr[0]) ) $iarr[0] = ''; // PHP5 compat hack
355 $fnarr = array_merge( array($sql) , $iarr);
356 $ret = call_user_func_array($fn,$fnarr);
358 switch(sizeof($iarr)) {
359 case 1: $ret = $fn($sql,$iarr[0]); break;
360 case 2: $ret = $fn($sql,$iarr[0],$iarr[1]); break;
361 case 3: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2]); break;
362 case 4: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3]); break;
363 case 5: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4]); break;
364 case 6: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5]); break;
365 case 7: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6]); break;
366 default: ADOConnection::outp( "Too many parameters to ibase query $sql");
367 case 8: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6],$iarr[7]); break;
370 } else $ret = $fn($sql);
374 if (is_array($iarr)) {
375 if (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
376 if (sizeof($iarr) == 0) $iarr[0] = ''; // PHP5 compat hack
377 $fnarr = array_merge( array($conn,$sql) , $iarr);
378 $ret = call_user_func_array($fn,$fnarr);
380 switch(sizeof($iarr)) {
381 case 1: $ret = $fn($conn,$sql,$iarr[0]); break;
382 case 2: $ret = $fn($conn,$sql,$iarr[0],$iarr[1]); break;
383 case 3: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2]); break;
384 case 4: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3]); break;
385 case 5: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4]); break;
386 case 6: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5]); break;
387 case 7: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6]); break;
388 default: ADOConnection::outp( "Too many parameters to ibase query $sql");
389 case 8: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6],$iarr[7]); break;
392 } else $ret = $fn($conn,$sql);
394 if ($docommit && $ret === true) {
395 ibase_commit($this->_connectionID);
398 $this->_handleerror();
402 // returns true or false
405 if (!$this->autoCommit) {
406 @ibase_rollback($this->_connectionID);
408 return @ibase_close($this->_connectionID);
412 function _ConvertFieldType(&$fld, $ftype, $flen, $fscale, $fsubtype, $fprecision, $dialect3)
414 $fscale = abs($fscale);
415 $fld->max_length = $flen;
423 $fld->type = ($ftype == 7 ? 'smallint' : 'integer');
426 $fld->type = 'numeric';
427 $fld->max_length = $fprecision;
428 $fld->scale = $fscale;
431 $fld->type = 'decimal';
432 $fld->max_length = $fprecision;
433 $fld->scale = $fscale;
438 $fld->type = 'decimal';
439 $fld->scale = $fscale;
440 $fld->max_length = ($ftype == 7 ? 4 : 9);
442 $fld->type = ($ftype == 7 ? 'smallint' : 'integer');
450 $fld->type = 'decimal';
451 $fld->max_length = 18;
455 $fld->type = 'numeric';
456 $fld->max_length = $fprecision;
457 $fld->scale = $fscale;
460 $fld->type = 'decimal';
461 $fld->max_length = $fprecision;
462 $fld->scale = $fscale;
468 $fld->type = 'float';
475 $fld->type = 'decimal';
476 $fld->max_length = 15;
479 $fld->type = 'double';
484 $fld->type = 'timestamp';
496 $fld->type = 'varchar';
499 $fld->type = 'cstring';
503 $fld->max_length = -1;
509 // returns array of ADOFieldObjects for current table
510 function MetaColumns($table, $normalize=true)
512 global $ADODB_FETCH_MODE;
514 $save = $ADODB_FETCH_MODE;
515 $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
517 $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
519 $ADODB_FETCH_MODE = $save;
527 $dialect3 = ($this->dialect==3 ? true : false);
529 while (!$rs->EOF) { //print_r($rs->fields);
530 $fld = new ADOFieldObject();
531 $fld->name = trim($rs->fields[0]);
533 $this->_ConvertFieldType($fld, $rs->fields[7], $rs->fields[3], $rs->fields[4], $rs->fields[5], $rs->fields[6], $dialect3);
534 if (isset($rs->fields[1]) && $rs->fields[1]) {
535 $fld->not_null = true;
537 if (isset($rs->fields[2])) {
539 $fld->has_default = true;
540 $d = substr($rs->fields[2],strlen('default '));
544 case 'integer': $fld->default_value = (int) $d; break;
548 case 'varchar': $fld->default_value = (string) substr($d,1,strlen($d)-2); break;
550 case 'float': $fld->default_value = (float) $d; break;
551 default: $fld->default_value = $d; break;
553 // case 35:$tt = 'TIMESTAMP'; break;
555 if ((isset($rs->fields[5])) && ($fld->type == 'blob')) {
556 $fld->sub_type = $rs->fields[5];
558 $fld->sub_type = null;
561 if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
562 else $retarr[strtoupper($fld->name)] = $fld;
567 if ( empty($retarr)) return $false;
571 function BlobEncode( $blob )
573 $blobid = ibase_blob_create( $this->_connectionID);
574 ibase_blob_add( $blobid, $blob );
575 return ibase_blob_close( $blobid );
578 // since we auto-decode all blob's since 2.42,
579 // BlobDecode should not do any transforms
580 function BlobDecode($blob)
588 // old blobdecode function
589 // still used to auto-decode all blob's
590 function _BlobDecode_old( $blob )
592 $blobid = ibase_blob_open($this->_connectionID, $blob );
593 $realblob = ibase_blob_get( $blobid,$this->maxblobsize); // 2nd param is max size of blob -- Kevin Boillet <kevinboillet@yahoo.fr>
594 while($string = ibase_blob_get($blobid, 8192)){
595 $realblob .= $string;
597 ibase_blob_close( $blobid );
602 function _BlobDecode( $blob )
604 if (ADODB_PHPVER >= 0x5000) {
605 $blob_data = ibase_blob_info($this->_connectionID, $blob );
606 $blobid = ibase_blob_open($this->_connectionID, $blob );
609 $blob_data = ibase_blob_info( $blob );
610 $blobid = ibase_blob_open( $blob );
613 if( $blob_data[0] > $this->maxblobsize ) {
615 $realblob = ibase_blob_get($blobid, $this->maxblobsize);
617 while($string = ibase_blob_get($blobid, 8192)){
618 $realblob .= $string;
621 $realblob = ibase_blob_get($blobid, $blob_data[0]);
624 ibase_blob_close( $blobid );
628 function UpdateBlobFile($table,$column,$path,$where,$blobtype='BLOB')
630 $fd = fopen($path,'rb');
631 if ($fd === false) return false;
632 $blob_id = ibase_blob_create($this->_connectionID);
636 while ($val = fread($fd,32768)){
637 ibase_blob_add($blob_id, $val);
640 /* close and get $blob_id_str for inserting into table */
641 $blob_id_str = ibase_blob_close($blob_id);
644 return $this->Execute("UPDATE $table SET $column=(?) WHERE $where",array($blob_id_str)) != false;
648 Insert a null into the blob field of the table first.
649 Then use UpdateBlob to store the blob.
653 $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
654 $conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');
656 function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
658 $blob_id = ibase_blob_create($this->_connectionID);
660 // ibase_blob_add($blob_id, $val);
662 // replacement that solves the problem by which only the first modulus 64K /
663 // of $val are stored at the blob field ////////////////////////////////////
664 // Thx Abel Berenstein aberenstein#afip.gov.ar
667 $tail_size = $len % $chunk_size;
668 $n_chunks = ($len - $tail_size) / $chunk_size;
670 for ($n = 0; $n < $n_chunks; $n++) {
671 $start = $n * $chunk_size;
672 $data = substr($val, $start, $chunk_size);
673 ibase_blob_add($blob_id, $data);
677 $start = $n_chunks * $chunk_size;
678 $data = substr($val, $start, $tail_size);
679 ibase_blob_add($blob_id, $data);
681 // end replacement /////////////////////////////////////////////////////////
683 $blob_id_str = ibase_blob_close($blob_id);
685 return $this->Execute("UPDATE $table SET $column=(?) WHERE $where",array($blob_id_str)) != false;
690 function OldUpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
692 $blob_id = ibase_blob_create($this->_connectionID);
693 ibase_blob_add($blob_id, $val);
694 $blob_id_str = ibase_blob_close($blob_id);
695 return $this->Execute("UPDATE $table SET $column=(?) WHERE $where",array($blob_id_str)) != false;
698 // Format date column in sql string given an input format that understands Y M D
699 // Only since Interbase 6.0 - uses EXTRACT
700 // problem - does not zero-fill the day and month yet
701 function SQLDate($fmt, $col=false)
703 if (!$col) $col = $this->sysDate;
707 for ($i=0; $i < $len; $i++) {
713 $s .= "extract(year from $col)";
717 $s .= "extract(month from $col)";
721 $s .= "cast(((extract(month from $col)+2) / 3) as integer)";
725 $s .= "(extract(day from $col))";
729 $s .= "(extract(hour from $col))";
733 $s .= "(extract(minute from $col))";
737 $s .= "CAST((extract(second from $col)) AS INTEGER)";
743 $ch = substr($fmt,$i,1);
745 $s .= $this->qstr($ch);
753 /*--------------------------------------------------------------------------------------
754 Class Name: Recordset
755 --------------------------------------------------------------------------------------*/
757 class ADORecordset_ibase extends ADORecordSet
760 var $databaseType = "ibase";
764 function __construct($id,$mode=false)
766 global $ADODB_FETCH_MODE;
768 $this->fetchMode = ($mode === false) ? $ADODB_FETCH_MODE : $mode;
769 parent::__construct($id);
772 /* Returns: an object containing field information.
773 Get column information in the Recordset object. fetchField() can be used in order to obtain information about
774 fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by
775 fetchField() is retrieved. */
777 function FetchField($fieldOffset = -1)
779 $fld = new ADOFieldObject;
780 $ibf = ibase_field_info($this->_queryID,$fieldOffset);
782 $name = empty($ibf['alias']) ? $ibf['name'] : $ibf['alias'];
784 switch (ADODB_ASSOC_CASE) {
785 case ADODB_ASSOC_CASE_UPPER:
786 $fld->name = strtoupper($name);
788 case ADODB_ASSOC_CASE_LOWER:
789 $fld->name = strtolower($name);
791 case ADODB_ASSOC_CASE_NATIVE:
797 $fld->type = $ibf['type'];
798 $fld->max_length = $ibf['length'];
800 /* This needs to be populated from the metadata */
801 $fld->not_null = false;
802 $fld->has_default = false;
803 $fld->default_value = 'null';
809 $this->_numOfRows = -1;
810 $this->_numOfFields = @ibase_num_fields($this->_queryID);
812 // cache types for blob decode check
813 for ($i=0, $max = $this->_numOfFields; $i < $max; $i++) {
814 $f1 = $this->FetchField($i);
815 $this->_cacheType[] = $f1->type;
826 $f = @ibase_fetch_row($this->_queryID);
828 $this->fields = false;
831 // OPN stuff start - optimized
832 // fix missing nulls and decode blobs automatically
834 global $ADODB_ANSI_PADDING_OFF;
835 //$ADODB_ANSI_PADDING_OFF=1;
836 $rtrim = !empty($ADODB_ANSI_PADDING_OFF);
838 for ($i=0, $max = $this->_numOfFields; $i < $max; $i++) {
839 if ($this->_cacheType[$i]=="BLOB") {
841 $f[$i] = $this->connection->_BlobDecode($f[$i]);
846 if (!isset($f[$i])) {
848 } else if ($rtrim && is_string($f[$i])) {
849 $f[$i] = rtrim($f[$i]);
856 if ($this->fetchMode == ADODB_FETCH_ASSOC) {
857 $this->fields = $this->GetRowAssoc();
858 } else if ($this->fetchMode == ADODB_FETCH_BOTH) {
859 $this->fields = array_merge($this->fields,$this->GetRowAssoc());
864 /* Use associative array to get fields array */
865 function Fields($colname)
867 if ($this->fetchMode & ADODB_FETCH_ASSOC) return $this->fields[$colname];
869 $this->bind = array();
870 for ($i=0; $i < $this->_numOfFields; $i++) {
871 $o = $this->FetchField($i);
872 $this->bind[strtoupper($o->name)] = $i;
876 return $this->fields[$this->bind[strtoupper($colname)]];
883 return @ibase_free_result($this->_queryID);
886 function MetaType($t,$len=-1,$fieldobj=false)
890 $t = $fieldobj->type;
891 $len = $fieldobj->max_length;
893 switch (strtoupper($t)) {
900 if ($len <= $this->blobSize) return 'C';
906 case 'DATE': return 'D';
907 case 'TIME': return 'T';
908 //case 'T': return 'T';
910 //case 'L': return 'L';
913 case 'INTEGER': return 'I';