irm-1.6-b3/MDB/ibase.php
/**
     * returns meta data about the result set
     *
     * @param  mixed $resource FireBird/InterBase result identifier or table name
     * @param mixed $mode depends on implementation
     * @return array an nested array, or a MDB error
     * @access public
     */
returns meta data about the result set
@param  mixed $resource FireBird/InterBase result identifier or table name
@param mixed $mode depends on implementation
@return array an nested array, or a MDB error
@access public
returns meta data about the result set @param mixed $resource FireBird / InterBase result identifier or table name @param mixed $mode depends on implementation @return array an nested array or a MDB error @access public
function tableInfo($result, $mode = NULL)
    {
        $count = 0;
        $id = 0;
        $res = array();
        if (is_string($result)) {
            $id = @ibase_query($this->connection,"SELECT * FROM $result");
            if (empty($id)) {
                return $this->ibaseRaiseError();
            }
        } else { 
            $id = $result;
            if (empty($id)) {
                return $this->ibaseRaiseError();
            }
        }
        $count = @ibase_num_fields($id);
        if (empty($mode)) {
            for ($i=0; $i<$count; $i++) {
                $info = @ibase_field_info($id, $i);
                $res[$i]['table'] = (is_string($result)) ? $result : $info['relation'];
                $res[$i]['name']  = $info['name'];
                $res[$i]['type']  = $info['type'];
                $res[$i]['len']   = $info['length'];
                $res[$i]['flags'] = (is_string($result)) ? $this->_ibaseFieldFlags($id, $i, $result) : '';
            }
        } else { 
            $res['num_fields'] = $count;
            for ($i=0; $i<$count; $i++) {
                $info = @ibase_field_info($id, $i);
                $res[$i]['table'] = (is_string($result)) ? $result : $info['relation'];
                $res[$i]['name']  = $info['name'];
                $res[$i]['type']  = $info['type'];
                $res[$i]['len']   = $info['length'];
                $res[$i]['flags'] = (is_string($result)) ? $this->_ibaseFieldFlags($id, $i, $result) : '';
                if ($mode & MDB_TABLEINFO_ORDER) {
                    $res['order'][$res[$i]['name']] = $i;
                }
                if ($mode & MDB_TABLEINFO_ORDERTABLE) {
                    $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
                }
            }
        }
        if (is_string($result) && is_resource($id)) {
            @ibase_free_result($id);
        }
        return $res;
    }
function tableInfo ( $ result , $ mode = NULL ) { $ count = 0 ; $ id = 0 ; $ res = array ( ) ; if ( is_string ( $ result ) ) { $ id = @ ibase_query ( $ this -> connection , " SELECT * FROM  $ result " ) ; if ( empty ( $ id ) ) { return $ this -> ibaseRaiseError ( ) ; } } else { $ id = $ result ; if ( empty ( $ id ) ) { return $ this -> ibaseRaiseError ( ) ; } } $ count = @ ibase_num_fields ( $ id ) ; if ( empty ( $ mode ) ) { for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ info = @ ibase_field_info ( $ id , $ i ) ; $ res [ $ i ] [ 'table' ] = ( is_string ( $ result ) ) ? $ result : $ info [ 'relation' ] ; $ res [ $ i ] [ 'name' ] = $ info [ 'name' ] ; $ res [ $ i ] [ 'type' ] = $ info [ 'type' ] ; $ res [ $ i ] [ 'len' ] = $ info [ 'length' ] ; $ res [ $ i ] [ 'flags' ] = ( is_string ( $ result ) ) ? $ this -> _ibaseFieldFlags ( $ id , $ i , $ result ) : '' ; } } else { $ res [ 'num_fields' ] = $ count ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ info = @ ibase_field_info ( $ id , $ i ) ; $ res [ $ i ] [ 'table' ] = ( is_string ( $ result ) ) ? $ result : $ info [ 'relation' ] ; $ res [ $ i ] [ 'name' ] = $ info [ 'name' ] ; $ res [ $ i ] [ 'type' ] = $ info [ 'type' ] ; $ res [ $ i ] [ 'len' ] = $ info [ 'length' ] ; $ res [ $ i ] [ 'flags' ] = ( is_string ( $ result ) ) ? $ this -> _ibaseFieldFlags ( $ id , $ i , $ result ) : '' ; if ( $ mode & MDB_TABLEINFO_ORDER ) { $ res [ 'order' ] [ $ res [ $ i ] [ 'name' ] ] = $ i ; } if ( $ mode & MDB_TABLEINFO_ORDERTABLE ) { $ res [ 'ordertable' ] [ $ res [ $ i ] [ 'table' ] ] [ $ res [ $ i ] [ 'name' ] ] = $ i ; } } } if ( is_string ( $ result ) && is_resource ( $ id ) ) { @ ibase_free_result ( $ id ) ; } return $ res ; }
returns meta data about the result set
 @param  mixed $resource FireBird/InterBase result identifier or table name
 @param mixed $mode depends on implementation
 @return array an nested array, or a MDB error
 @access public
returns meta data about the result set @param mixed $resource FireBird / InterBase result identifier or table name @param mixed $mode depends on implementation @return array an nested array or a MDB error @access public
/**
         * depending on $mode, metadata returns the following values:
         *
         * - mode is FALSE (default):
         * $result[]:
         *    [0]['table']  table name
         *    [0]['name']   field name
         *    [0]['type']   field type
         *    [0]['len']    field length
         *    [0]['flags']  field flags
         *
         * - mode is MDB_TABLEINFO_ORDER
         * $result[]:
         *    ['num_fields'] number of metadata records
         *    [0]['table']  table name
         *    [0]['name']   field name
         *    [0]['type']   field type
         *    [0]['len']    field length
         *    [0]['flags']  field flags
         *    ['order'][field name]  index of field named 'field name'
         *    The last one is used, if you have a field name, but no index.
         *    Test:  if (isset($result['meta']['myfield'])) { ...
         *
         * - mode is MDB_TABLEINFO_ORDERTABLE
         *     the same as above. but additionally
         *    ['ordertable'][table name][field name] index of field
         *       named 'field name'
         *
         *       this is, because if you have fields from different
         *       tables with the same field name * they override each
         *       other with MDB_TABLEINFO_ORDER
         *
         *       you can combine MDB_TABLEINFO_ORDER and
         *       MDB_TABLEINFO_ORDERTABLE with MDB_TABLEINFO_ORDER |
         *       MDB_TABLEINFO_ORDERTABLE * or with MDB_TABLEINFO_FULL
         **/ // if $result is a string, then we want information about a // table without a resultset // else we want information about a resultset // made this IF due to performance (one if is faster than $count if's) //$res[$i]['table'] = (is_string($result)) ? $result : ''; //$res[$i]['flags'] = (is_string($result)) ? $this->_ibaseFieldFlags($info['name'], $result) : ''; // full //$res[$i]['table'] = (is_string($result)) ? $result : ''; //$res[$i]['flags'] = (is_string($result)) ? $this->_ibaseFieldFlags($info['name'], $result) : ''; // free the result only if we were called on a table