• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ibase_field_info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ibase_field_info函数的典型用法代码示例。如果您正苦于以下问题:PHP ibase_field_info函数的具体用法?PHP ibase_field_info怎么用?PHP ibase_field_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ibase_field_info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: FieldName

 function FieldName($Index)
 {
     $FieldInfo = ibase_field_info($this->Records, $Index);
     if ($FieldInfo['alias']) {
         return $FieldInfo['alias'];
     } else {
         return $FieldInfo['name'];
     }
 }
开发者ID:AmesianX,项目名称:pilot,代码行数:9,代码来源:interbase.php


示例2: __construct

 /**
  * Constructor
  *
  * @param   resource handle
  */
 public function __construct($result, TimeZone $tz = NULL)
 {
     $fields = array();
     if (is_resource($result)) {
         for ($i = 0, $num = ibase_num_fields($result); $i < $num; $i++) {
             $field = ibase_field_info($result, $i);
             $fields[$field['name']] = $field['type'];
         }
     }
     parent::__construct($result, $fields, $tz);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:16,代码来源:InterBaseResultSet.class.php


示例3: _performGetBlobFieldNames

 function _performGetBlobFieldNames($result)
 {
     $blobFields = array();
     for ($i = ibase_num_fields($result) - 1; $i >= 0; $i--) {
         $info = ibase_field_info($result, $i);
         if ($info['type'] === "BLOB") {
             $blobFields[] = $info['name'];
         }
     }
     return $blobFields;
 }
开发者ID:saqar,项目名称:tc_aowow,代码行数:11,代码来源:Ibase.php


示例4: field_data

 /**
  * Field data
  *
  * Generates an array of objects containing field meta-data
  *
  * @return    array
  */
 public function field_data()
 {
     $retval = array();
     for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) {
         $info = ibase_field_info($this->result_id, $i);
         $retval[$i] = new stdClass();
         $retval[$i]->name = $info['name'];
         $retval[$i]->type = $info['type'];
         $retval[$i]->max_length = $info['length'];
     }
     return $retval;
 }
开发者ID:at15,项目名称:codeignitordb,代码行数:19,代码来源:ibase_result.php


示例5: gcms_fetch_object

function gcms_fetch_object($nresult)
{
    $result = ibase_fetch_object($nresult);
    if ($result) {
        $coln = ibase_num_fields($nresult);
        for ($i = 0; $i < $coln; $i++) {
            $col_info = ibase_field_info($nresult, $i);
            eval("\$result->" . strtolower($col_info['alias']) . " = \$result->" . $col_info['alias'] . ";");
        }
    }
    return $result;
}
开发者ID:ibnoe,项目名称:simpatda-thinkfrogs,代码行数:12,代码来源:firebird.php


示例6: GetFields

 function GetFields()
 {
     $_fields = array();
     $_result = ibase_query($this->_Link, $this->SelectCommand);
     $coln = ibase_num_fields($_result);
     for ($i = 0; $i < $coln; $i++) {
         $_prop = ibase_field_info($_result, $i);
         $_field = array("Name" => $_prop["name"], "Type" => $_prop["type"], "Not_Null" => 0);
         array_push($_fields, $_field);
     }
     ibase_free_result($_result);
     return $_fields;
 }
开发者ID:skydel,项目名称:universal-online-exam,代码行数:13,代码来源:FirebirdDataSource.php


示例7: field_data

 /**
  * Field data
  *
  * Generates an array of objects containing field meta-data
  *
  * @access	public
  * @return	array
  */
 function field_data()
 {
     $retval = array();
     for ($i = 0; $i < $this->num_fields(); $i++) {
         $col_info = ibase_field_info($this->result_id, $i);
         $F = new stdClass();
         $F->name = $col_info['name'];
         $F->type = $col_info['type'];
         $F->max_length = $col_info['length'];
         $F->primary_key = 0;
         $F->default = '';
         $retval[] = $F;
     }
     return $retval;
 }
开发者ID:ibnoe,项目名称:simpatda-thinkfrogs,代码行数:23,代码来源:firebird_result.php


示例8: __construct

 /**
  * This function initializes the class.
  *
  * @access public
  * @override
  * @param DB_Connection_Driver $connection  the connection to be used
  * @param string $sql                       the SQL statement to be queried
  * @param integer $mode                     the execution mode to be used
  * @throws Throwable_SQL_Exception          indicates that the query failed
  */
 public function __construct(DB_Connection_Driver $connection, $sql, $mode = NULL)
 {
     $this->resource = $connection->get_resource();
     $command = @ibase_query($this->resource, $sql);
     if ($command === FALSE) {
         throw new Throwable_SQL_Exception('Message: Failed to query SQL statement. Reason: :reason', array(':reason' => @ibase_errmsg()));
     }
     $this->command = $command;
     $this->record = FALSE;
     $this->blobs = array();
     $count = (int) @ibase_num_fields($command);
     for ($i = 0; $i < $count; $i++) {
         $field = ibase_field_info($command, $i);
         if ($field['type'] == 'BLOB') {
             $this->blobs[] = $field['name'];
         }
     }
 }
开发者ID:ruslankus,项目名称:invoice-crm,代码行数:28,代码来源:Standard.php


示例9: field_data

 /**
  * Field data
  *
  * Generates an array of objects containing field meta-data
  *
  * @access  public
  * @return  array
  */
 function field_data()
 {
     $retval = array();
     $fieldCount = $this->num_fields();
     for ($c = 0; $c < $fieldCount; $c++) {
         $col_info = ibase_field_info($this->stmt_id, $c);
         $F = new stdClass();
         $F->name = $col_info['name'];
         $F->type = $col_info['type'];
         $F->max_length = $col_info['length'];
         $retval[] = $F;
     }
     return $retval;
 }
开发者ID:ibnoe,项目名称:simpatda-thinkfrogs,代码行数:22,代码来源:ibase_result.php


示例10: _execute

 /**
  * Executes a prepared statement.
  *
  * @param array $params OPTIONAL Values to bind to parameter placeholders.
  * @return bool
  * @throws ZendX_Db_Statement_Firebird_Exception
  */
 public function _execute(array $params = null)
 {
     if (!$this->_stmtPrepared) {
         return false;
     }
     // if no params were given as an argument to execute(),
     // then default to the _bindParam array
     if ($params === null) {
         $params = $this->_bindParam;
     }
     // send $params as input parameters to the statement
     if ($params) {
         array_unshift($params, $this->_stmtPrepared);
         $retval = @call_user_func_array('ibase_execute', $params);
     } else {
         // execute the statement
         $retval = @ibase_execute($this->_stmtPrepared);
     }
     $this->_stmtResult = $retval;
     if ($retval === false) {
         $last_error = ibase_errmsg();
         $this->_stmtRowCount = 0;
     }
     //Firebird php ibase extension, auto-commit is not after each call, but at
     //end of script. Disabled when transaction is active
     if (!$this->_adapter->getTransaction()) {
         ibase_commit_ret();
     }
     if ($retval === false) {
         /**
          * @see ZendX_Db_Statement_Firebird_Exception
          */
         require_once 'ZendX/Db/Statement/Firebird/Exception.php';
         throw new ZendX_Db_Statement_Firebird_Exception("Firebird statement execute error : " . $last_error);
     }
     // statements that have no result set do not return metadata
     if (is_resource($this->_stmtResult)) {
         // get the column names that will result
         $this->_keys = array();
         $coln = ibase_num_fields($this->_stmtResult);
         $this->_stmtColumnCount = $coln;
         for ($i = 0; $i < $coln; $i++) {
             $col_info = ibase_field_info($this->_stmtResult, $i);
             $this->_keys[] = $this->_adapter->foldCase($col_info['name']);
         }
         // set up a binding space for result variables
         $this->_values = array_fill(0, count($this->_keys), null);
         // set up references to the result binding space.
         // just passing $this->_values in the call_user_func_array()
         // below won't work, you need references.
         $refs = array();
         foreach ($this->_values as $i => &$f) {
             $refs[$i] =& $f;
         }
     }
     if ($trans = $this->_adapter->getTransaction()) {
         $this->_stmtRowCount = ibase_affected_rows($trans);
     } else {
         $this->_stmtRowCount = ibase_affected_rows($this->_adapter->getConnection());
     }
     return true;
 }
开发者ID:JosefinaArayaTapia,项目名称:Capicua-Restobar,代码行数:69,代码来源:Firebird_3.php


示例11: write_data

 function write_data($table_name)
 {
     global $db;
     $ary_type = $ary_name = array();
     // Grab all of the data from current table.
     $sql = "SELECT *\n\t\t\tFROM {$table_name}";
     $result = $db->sql_query($sql);
     $i_num_fields = ibase_num_fields($result);
     for ($i = 0; $i < $i_num_fields; $i++) {
         $info = ibase_field_info($result, $i);
         $ary_type[$i] = $info['type'];
         $ary_name[$i] = $info['name'];
     }
     while ($row = $db->sql_fetchrow($result)) {
         $schema_vals = $schema_fields = array();
         // Build the SQL statement to recreate the data.
         for ($i = 0; $i < $i_num_fields; $i++) {
             $str_val = $row[strtolower($ary_name[$i])];
             if (preg_match('#char|text|bool|varbinary|blob#i', $ary_type[$i])) {
                 $str_quote = '';
                 $str_empty = "''";
                 $str_val = sanitize_data_generic(str_replace("'", "''", $str_val));
             } else {
                 if (preg_match('#date|timestamp#i', $ary_type[$i])) {
                     if (empty($str_val)) {
                         $str_quote = '';
                     } else {
                         $str_quote = "'";
                     }
                 } else {
                     $str_quote = '';
                     $str_empty = 'NULL';
                 }
             }
             if (empty($str_val) && $str_val !== '0') {
                 $str_val = $str_empty;
             }
             $schema_vals[$i] = $str_quote . $str_val . $str_quote;
             $schema_fields[$i] = '"' . $ary_name[$i] . '"';
         }
         // Take the ordered fields and their associated data and build it
         // into a valid sql statement to recreate that field in the data.
         $sql_data = "INSERT INTO {$table_name} (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
         $this->flush($sql_data);
     }
     $db->sql_freeresult($result);
 }
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:47,代码来源:acp_database.php


示例12: getFields

    /**
    +----------------------------------------------------------
    * 取得数据表的字段信息
    +----------------------------------------------------------
    * @access public
    +----------------------------------------------------------
    * @throws ThinkExecption
    +----------------------------------------------------------
    */
    public function getFields($tableName)
    {
        $result = $this->query('SELECT RDB$FIELD_NAME AS FIELD, RDB$DEFAULT_VALUE AS DEFAULT1, RDB$NULL_FLAG AS NULL1 FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME=UPPER(\'' . $tableName . '\') ORDER By RDB$FIELD_POSITION');
        $info = array();
        if ($result) {
            foreach ($result as $key => $val) {
                $info[trim($val['FIELD'])] = array('name' => trim($val['FIELD']), 'type' => '', 'notnull' => (bool) ($val['NULL1'] == 1), 'default' => $val['DEFAULT1'], 'primary' => false, 'autoinc' => false);
            }
        }
        //剑雷 取表字段类型
        $sql = 'select first 1 * from ' . $tableName;
        $rs_temp = ibase_query($this->_linkID, $sql);
        $fieldCount = ibase_num_fields($rs_temp);
        for ($i = 0; $i < $fieldCount; $i++) {
            $col_info = ibase_field_info($rs_temp, $i);
            $info[trim($col_info['name'])]['type'] = $col_info['type'];
        }
        ibase_free_result($rs_temp);
        //剑雷 取表的主键
        $sql = 'select b.rdb$field_name as FIELD_NAME from rdb$relation_constraints a join rdb$index_segments b
on a.rdb$index_name=b.rdb$index_name
where a.rdb$constraint_type=\'PRIMARY KEY\' and a.rdb$relation_name=UPPER(\'' . $tableName . '\')';
        $rs_temp = ibase_query($this->_linkID, $sql);
        while ($row = ibase_fetch_object($rs_temp)) {
            $info[trim($row->FIELD_NAME)]['primary'] = True;
        }
        ibase_free_result($rs_temp);
        return $info;
    }
开发者ID:dalinhuang,项目名称:concourse,代码行数:38,代码来源:DbIbase.class.php


示例13: resultSet

 /**
  * Enter description here...
  *
  * @param unknown_type $results
  */
 function resultSet(&$results)
 {
     $this->results =& $results;
     $this->map = array();
     $num_fields = ibase_num_fields($results);
     $index = 0;
     $j = 0;
     while ($j < $num_fields) {
         $column = ibase_field_info($results, $j);
         if (!empty($column[2])) {
             $this->map[$index++] = array(ucfirst(strtolower($this->modeltmp[strtolower($column[2])])), strtolower($column[1]));
         } else {
             $this->map[$index++] = array(0, strtolower($column[1]));
         }
         $j++;
     }
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:22,代码来源:dbo_firebird.php


示例14: columns

 public function columns()
 {
     if (empty($this->query)) {
         return false;
     }
     $columns = array();
     $num_fields = $this->numFields();
     $field = '';
     for ($i = 0; $i < $num_fields; $i++) {
         $field = ibase_field_info($this->query, $i);
         $column[] = $field['name'];
     }
     return $columns;
 }
开发者ID:bytemtek,项目名称:znframework,代码行数:14,代码来源:Ibase.php


示例15: ADOFieldObject

 function &FetchField($fieldOffset = -1)
 {
     $fld = new ADOFieldObject();
     $ibf = ibase_field_info($this->_queryID, $fieldOffset);
     switch (ADODB_ASSOC_CASE) {
         case 2:
             // the default
             $fld->name = $ibf['alias'];
             if (empty($fld->name)) {
                 $fld->name = $ibf['name'];
             }
             break;
         case 0:
             $fld->name = strtoupper($ibf['alias']);
             if (empty($fld->name)) {
                 $fld->name = strtoupper($ibf['name']);
             }
             break;
         case 1:
             $fld->name = strtolower($ibf['alias']);
             if (empty($fld->name)) {
                 $fld->name = strtolower($ibf['name']);
             }
             break;
     }
     $fld->type = $ibf['type'];
     $fld->max_length = $ibf['length'];
     /*       This needs to be populated from the metadata */
     $fld->not_null = false;
     $fld->has_default = false;
     $fld->default_value = 'null';
     return $fld;
 }
开发者ID:kractos26,项目名称:orfeo,代码行数:33,代码来源:adodb-ibase.inc.php


示例16: GetColumnNames

 function GetColumnNames($result, &$column_names)
 {
     $result_value = intval($result);
     if (!isset($this->highest_fetched_row[$result_value])) {
         return $this->SetError("Get column names", "it was specified an inexisting result set");
     }
     if (!isset($this->columns[$result_value])) {
         $this->columns[$result_value] = array();
         $columns = ibase_num_fields($result);
         for ($column = 0; $column < $columns; $column++) {
             $column_info = ibase_field_info($result, $column);
             $this->columns[$result_value][strtolower($column_info["name"])] = $column;
         }
     }
     $column_names = $this->columns[$result_value];
     return 1;
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:17,代码来源:metabase_ibase.php


示例17: tableInfo

 /**
  * Returns information about a table or a result set
  *
  * NOTE: doesn't support 'flags'and 'table' if called from a db_result
  *
  * @param  mixed $resource Interbase result identifier or table name
  * @param  int $mode A valid tableInfo mode (DB_TABLEINFO_ORDERTABLE or
  *                   DB_TABLEINFO_ORDER)
  *
  * @return array An array with all the information
  */
 function tableInfo($result, $mode = null)
 {
     $count = 0;
     $id = 0;
     $res = array();
     /*
      * 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 DB_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 DB_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 DB_TABLEINFO_ORDER
      *
      *      you can combine DB_TABLEINFO_ORDER and
      *      DB_TABLEINFO_ORDERTABLE with DB_TABLEINFO_ORDER |
      *      DB_TABLEINFO_ORDERTABLE * or with DB_TABLEINFO_FULL
      */
     // if $result is a string, then we want information about a
     // table without a resultset
     if (is_string($result)) {
         $id = ibase_query($this->connection, "SELECT * FROM {$result}");
         if (empty($id)) {
             return $this->ibaseRaiseError();
         }
     } else {
         // else we want information about a resultset
         $id = $result;
         if (empty($id)) {
             return $this->ibaseRaiseError();
         }
     }
     $count = @ibase_num_fields($id);
     // made this IF due to performance (one if is faster than $count if's)
     if (empty($mode)) {
         for ($i = 0; $i < $count; $i++) {
             $info = @ibase_field_info($id, $i);
             $res[$i]['table'] = is_string($result) ? $result : '';
             $res[$i]['name'] = $info['name'];
             $res[$i]['type'] = $info['type'];
             $res[$i]['len'] = $info['length'];
             $res[$i]['flags'] = is_string($result) ? $this->_ibaseFieldFlags($info['name'], $result) : '';
         }
     } else {
         // full
         $res["num_fields"] = $count;
         for ($i = 0; $i < $count; $i++) {
             $info = @ibase_field_info($id, $i);
             $res[$i]['table'] = is_string($result) ? $result : '';
             $res[$i]['name'] = $info['name'];
             $res[$i]['type'] = $info['type'];
             $res[$i]['len'] = $info['length'];
             $res[$i]['flags'] = is_string($result) ? $this->_ibaseFieldFlags($info['name'], $result) : '';
             if ($mode & DB_TABLEINFO_ORDER) {
                 $res['order'][$res[$i]['name']] = $i;
             }
             if ($mode & DB_TABLEINFO_ORDERTABLE) {
                 $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
             }
         }
     }
     // free the result only if we were called on a table
     if (is_string($result)) {
         ibase_free_result($id);
     }
     return $res;
//.........这里部分代码省略.........
开发者ID:amjadtbssm,项目名称:website,代码行数:101,代码来源:ibase.php


示例18: main


//.........这里部分代码省略.........
                                                $schema_vals[$i] = $str_quote . $str_val . $str_quote;
                                                $schema_fields[$i] = $ary_name[$i];
                                            }
                                            // Take the ordered fields and their associated data and build it
                                            // into a valid sql statement to recreate that field in the data.
                                            $sql_data .= "INSERT INTO {$table_name} (" . implode(', ', $schema_fields) . ') VALUES(' . implode(', ', $schema_vals) . ");\n";
                                            if ($store == true) {
                                                $write($fp, $sql_data);
                                            }
                                            if ($download == true) {
                                                if (!empty($oper)) {
                                                    echo $oper($sql_data);
                                                } else {
                                                    echo $sql_data;
                                                }
                                            }
                                            $sql_data = '';
                                        }
                                        $db->sql_freeresult($result);
                                        if ($retrieved_data) {
                                            $sql_data = "\nGO\n";
                                            if ($ident_set) {
                                                $sql_data .= "\nSET IDENTITY_INSERT {$table_name} OFF\nGO\n";
                                            }
                                        }
                                        break;
                                    case 'firebird':
                                        $ary_type = $ary_name = array();
                                        // Grab all of the data from current table.
                                        $sql = "SELECT *\n\t\t\t\t\t\t\t\t\t\t\tFROM {$table_name}";
                                        $result = $db->sql_query($sql);
                                        $i_num_fields = ibase_num_fields($result);
                                        for ($i = 0; $i < $i_num_fields; $i++) {
                                            $info = ibase_field_info($result, $i);
                                            $ary_type[$i] = $info['type'];
                                            $ary_name[$i] = $info['name'];
                                        }
                                        while ($row = $db->sql_fetchrow($result)) {
                                            $schema_vals = $schema_fields = array();
                                            // Build the SQL statement to recreate the data.
                                            for ($i = 0; $i < $i_num_fields; $i++) {
                                                $str_val = $row[strtolower($ary_name[$i])];
                                                if (preg_match('#char|text|bool#i', $ary_type[$i])) {
                                                    $str_quote = "'";
                                                    $str_empty = '';
                                                    $str_val = addslashes($str_val);
                                                } else {
                                                    if (preg_match('#date|timestamp#i', $ary_type[$i])) {
                                                        if (empty($str_val)) {
                                                            $str_quote = '';
                                                        } else {
                                                            $str_quote = "'";
                                                        }
                                                    } else {
                                                        $str_quote = '';
                                                        $str_empty = 'NULL';
                                                    }
                                                }
                                                if (empty($str_val) && $str_val !== '0') {
                                                    $str_val = $str_empty;
                                                }
                                                $schema_vals[$i] = $str_quote . $str_val . $str_quote;
                                                $schema_fields[$i] = "'" . $ary_name[$i] . "'";
                                            }
                                            // Take the ordered fields and their associated data and build it
                                            // into a valid sql statement to recreate that field in the data.
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:acp_database.php


示例19: field_info

 function field_info($query, $count)
 {
     if ($this->debug) {
         echo "<pre style=\"color : green\">Getting column information {$this->dbpath} <p style=\"color:purple;\">  {$query} </p></pre>";
     }
     $nooffields = 0;
     //Validate the sql statement and make adjustments
     switch ($this->dbtype) {
         /* Firebird Functionality */
         case "firebird":
             //write some things here
             $col_info = ibase_field_info($query, $count);
             break;
             /* SQLite Functionality */
         /* SQLite Functionality */
         case "sqlite":
             putenv("TMP=" . $this->tmppath);
             $name = sqlite_field_name($query, $count);
             //echo $name;
             $col_info["alias"] = $name;
             $col_info["name"] = $name;
             break;
             /* Oracle Functionality */
         /* Oracle Functionality */
         case "oracle":
             $column_name = oci_field_name($query, $count);
             $column_type = oci_field_type($query, $count);
             $column_size = oci_field_size($query, $count);
             $column_prec = oci_field_precision($query, $count);
             $column_scale = oci_field_scale($query, $count);
             $col_info["name"] = $column_name;
             $col_info["alias"] = $column_name;
             $col_info["length"] = $column_size;
             $col_info["prec"] = $column_prec;
             $col_info["type"] = $column_type;
             $col_info["scale"] = $column_scale;
             break;
             /* PGSQL Functionality */
         /* PGSQL Functionality */
         case "pgsql":
             $col_info["name"] = pg_field_name($query, $count);
             $col_info["alias"] = NULL;
             // always set to NULL
             $col_info["relation"] = NULL;
             // always set to NULL
             $col_info["length"] = pg_field_size($query, $count);
             $col_info["type"] = pg_field_type($query, $count);
             break;
     }
     if ($this->debug) {
         echo "<pre style=\"color : blue\">Column Info fetched for Column {$count} \n </pre>";
     }
     return $col_info;
 }
开发者ID:mortalerror,项目名称:ultimatesims,代码行数:54,代码来源:cdeclass.php


示例20: tableInfo

 /**
  * Returns information about a table or a result set.
  *
  * NOTE: only supports 'table' and 'flags' if <var>$result</var>
  * is a table name.
  *
  * @param object|string  $result  MDB2_result object from a query or a
  *                                string containing the name of a table
  * @param int            $mode    a valid tableInfo mode
  * @return array  an associative array with the information requested
  *                or an error object if something is wrong
  * @access public
  * @internal
  * @see MDB2_Driver_Common::tableInfo()
  */
 function tableInfo($result, $mode = null)
 {
     $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
     if ($db->options['portability'] & MDB2_PORTABILITY_LOWERCASE) {
         $case_func = 'strtolower';
     } else {
         $case_func = 'strval';
     }
     if (is_string($result)) {
         /*
          * Probably received a table name.
          * Create a result resource identifier.
          */
         if (MDB2::isError($connect = $db->connect())) {
             return $connect;
         }
         $id = @ibase_query($db->connection, "SELECT * FROM {$result} WHERE 1=0");
         $got_string = true;
     } else {
         /*
          * Probably received a result object.
          * Extract the result resource identifier.
          */
         $id = $result->getResource();
         if (empty($id)) {
             return $db->raiseError();
         }
         $got_string = false;
     }
     if (!is_resource($id)) {
         return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA);
     }
     $count = @ibase_num_fields($id);
     // made this IF due to performance (one if is faster than $count if's)
     if (!$mode) {
         for ($i = 0; $i < $count; $i++) {
             $info = @ibase_field_info($id, $i);
             $res[$i]['table'] = $got_string ? $case_func($result) : '';
             $res[$i]['name'] = $case_func($info['name']);
             $res[$i]['type'] = $info['type'];
             $res[$i]['len'] = $info['length'];
             $res[$i]['flags'] = $got_string ? $this->_ibaseFieldFlags($info['name'], $result) : '';
         }
     } else {
         // full
         $res['num_fields'] = $count;
         for ($i = 0; $i < $count; $i++) {
             $info = @ibase_field_info($id, $i);
             $res[$i]['table'] = $got_string ? $case_func($result) : '';
             $res[$i]['name'] = $case_func($info['name']);
             $res[$i]['type'] = $info['type'];
             $res[$i]['len'] = $info['length'];
             $res[$i]['flags'] = $got_string ? $this->_ibaseFieldFlags($info['name'], $result) : '';
             if ($mode & MDB2_TABLEINFO_ORDER) {
                 $res['order'][$res[$i]['name']] = $i;
             }
             if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
                 $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
             }
         }
     }
     // free the result only if we were called on a table
     if ($got_string) {
         @ibase_free_result($id);
     }
     return $res;
 }
开发者ID:BackupTheBerlios,项目名称:smart-svn,代码行数:82,代码来源:ibase.php



注:本文中的ibase_field_info函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ibase_free_query函数代码示例发布时间:2022-05-15
下一篇:
PHP ibase_fetch_row函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap