当前位置: 首页>>代码示例>>PHP>>正文


PHP sybase_fetch_field函数代码示例

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


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

示例1: __construct

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

示例2: field_data

 /**
  * Field data
  *
  * Generates an array of objects containing field meta-data
  *
  * @access	public
  * @return	array
  */
 function field_data()
 {
     $retval = array();
     while ($field = sybase_fetch_field($this->result_id)) {
         $F = new stdClass();
         $F->name = $field->name;
         $F->type = $field->type;
         $F->max_length = $field->max_length;
         $F->primary_key = 0;
         $F->default = '';
         $retval[] = $F;
     }
     return $retval;
 }
开发者ID:alexandrebagio,项目名称:CodeIgniter3-sybase-driver,代码行数:22,代码来源:sybase_result.php

示例3: 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  DB_result object from a query or a
  *                                 string containing the name of a table.
  *                                 While this also accepts a query result
  *                                 resource identifier, this behavior is
  *                                 deprecated.
  * @param int            $mode    a valid tableInfo mode
  *
  * @return array  an associative array with the information requested.
  *                 A DB_Error object on failure.
  *
  * @see DB_common::tableInfo()
  * @since Method available since Release 1.6.0
  */
 function tableInfo($result, $mode = null)
 {
     if (is_string($result)) {
         /*
          * Probably received a table name.
          * Create a result resource identifier.
          */
         if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) {
             return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED);
         }
         $id = @sybase_query("SELECT * FROM {$result} WHERE 1=0", $this->connection);
         $got_string = true;
     } elseif (isset($result->result)) {
         /*
          * Probably received a result object.
          * Extract the result resource identifier.
          */
         $id = $result->result;
         $got_string = false;
     } else {
         /*
          * Probably received a result resource identifier.
          * Copy it.
          * Deprecated.  Here for compatibility only.
          */
         $id = $result;
         $got_string = false;
     }
     if (!is_resource($id)) {
         return $this->sybaseRaiseError(DB_ERROR_NEED_MORE_DATA);
     }
     if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
         $case_func = 'strtolower';
     } else {
         $case_func = 'strval';
     }
     $count = @sybase_num_fields($id);
     $res = array();
     if ($mode) {
         $res['num_fields'] = $count;
     }
     for ($i = 0; $i < $count; $i++) {
         $f = @sybase_fetch_field($id, $i);
         // column_source is often blank
         $res[$i] = array('table' => $got_string ? $case_func($result) : $case_func($f->column_source), 'name' => $case_func($f->name), 'type' => $f->type, 'len' => $f->max_length, 'flags' => '');
         if ($res[$i]['table']) {
             $res[$i]['flags'] = $this->_sybase_field_flags($res[$i]['table'], $res[$i]['name']);
         }
         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 ($got_string) {
         @sybase_free_result($id);
     }
     return $res;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:80,代码来源:sybase.php

示例4: FetchField

 function FetchField($fieldOffset = -1)
 {
     if ($fieldOffset != -1) {
         $o = @sybase_fetch_field($this->_queryID, $fieldOffset);
     } else {
         if ($fieldOffset == -1) {
             /*	The $fieldOffset argument is not provided thus its -1 	*/
             $o = @sybase_fetch_field($this->_queryID);
         }
     }
     // older versions of PHP did not support type, only numeric
     if ($o && !isset($o->type)) {
         $o->type = $o->numeric ? 'float' : 'varchar';
     }
     return $o;
 }
开发者ID:ceryxSeidor,项目名称:ProyectoPruebaWSV2,代码行数:16,代码来源:adodb-sybase.inc.php

示例5: resultSet

 /**
  * Enter description here...
  *
  * @param unknown_type $results
  */
 function resultSet(&$results)
 {
     $this->results =& $results;
     $this->map = array();
     $num_fields = sybase_num_fields($results);
     $index = 0;
     $j = 0;
     while ($j < $num_fields) {
         $column = sybase_fetch_field($results, $j);
         if (!empty($column->table)) {
             $this->map[$index++] = array($column->table, $column->name);
         } else {
             $this->map[$index++] = array(0, $column->name);
         }
         $j++;
     }
 }
开发者ID:christianallred,项目名称:fluent_univ,代码行数:22,代码来源:dbo_sybase.php

示例6: _table_name

 protected function _table_name($field)
 {
     return sybase_fetch_field($this->_result, $field)->column_source;
 }
开发者ID:Deepab23,项目名称:clinic,代码行数:4,代码来源:sybase_statement.php

示例7: fetch_field

 /**
  * Get column information
  * @param integer
  * @return object
  */
 protected function fetch_field($intOffset)
 {
     return @sybase_fetch_field($this->resResult, $intOffset);
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:9,代码来源:DB_Sybase.php

示例8: query

 function query($query)
 {
     //if flag to convert query from MySql syntax to Sybase syntax is true
     //convert the query
     if ($this->convertMySqlTosybaseQuery == true) {
         $query = $this->ConvertMySqlTosybase($query);
     }
     // Initialise return
     $return_val = 0;
     // Flush cached values..
     $this->flush();
     // For reg expressions
     $query = trim($query);
     // Log how the function was called
     $this->func_call = "\$db->query(\"{$query}\")";
     // Keep track of the last query for debug..
     $this->last_query = $query;
     // Count how many queries there have been
     $this->num_queries++;
     // Use core file cache function
     if ($cache = $this->get_cache($query)) {
         return $cache;
     }
     // If there is no existing database connection then try to connect
     if (!isset($this->dbh) || !$this->dbh) {
         $this->connect($this->dbuser, $this->dbpassword, $this->dbhost);
         $this->select($this->dbname);
     }
     // Perform the query via std sybase_query function..
     $this->result = @sybase_query($query);
     // If there is an error then take note of it..
     if ($this->result == false) {
         $get_errorcodeSql = "SELECT @@ERROR as errorcode";
         $error_res = @sybase_query($get_errorcodeSql, $this->dbh);
         $errorCode = @sybase_result($error_res, 0, "errorcode");
         $get_errorMessageSql = "SELECT severity as errorSeverity, text as errorText FROM sys.messages  WHERE message_id = " . $errorCode;
         $errormessage_res = @sybase_query($get_errorMessageSql, $this->dbh);
         if ($errormessage_res) {
             $errorMessage_Row = @sybase_fetch_row($errormessage_res);
             $errorSeverity = $errorMessage_Row[0];
             $errorMessage = $errorMessage_Row[1];
         }
         $sqlError = "ErrorCode: " . $errorCode . " ### Error Severity: " . $errorSeverity . " ### Error Message: " . $errorMessage . " ### Query: " . $query;
         $is_insert = true;
         $this->register_error($sqlError);
         $this->show_errors ? trigger_error($sqlError, E_USER_WARNING) : null;
         return false;
     }
     // Query was an insert, delete, update, replace
     $is_insert = false;
     if (preg_match("/^(insert|delete|update|replace)\\s+/i", $query)) {
         $this->rows_affected = @sybase_rows_affected($this->dbh);
         // Take note of the insert_id
         if (preg_match("/^(insert|replace)\\s+/i", $query)) {
             $identityresultset = @sybase_query("select SCOPE_IDENTITY()");
             if ($identityresultset != false) {
                 $identityrow = @sybase_fetch_row($identityresultset);
                 $this->insert_id = $identityrow[0];
             }
         }
         // Return number of rows affected
         $return_val = $this->rows_affected;
     } else {
         // Take note of column info
         $i = 0;
         while ($i < @sybase_num_fields($this->result)) {
             $this->col_info[$i] = @sybase_fetch_field($this->result);
             $i++;
         }
         // Store Query Results
         $num_rows = 0;
         while ($row = @sybase_fetch_object($this->result)) {
             // Store relults as an objects within main array
             $this->last_result[$num_rows] = $row;
             $num_rows++;
         }
         @sybase_free_result($this->result);
         // Log number of rows the query returned
         $this->num_rows = $num_rows;
         // Return number of rows selected
         $return_val = $this->num_rows;
     }
     // disk caching of queries
     $this->store_cache($query, $is_insert);
     // If debug ALL queries
     $this->trace || $this->debug_all ? $this->debug() : null;
     return $return_val;
 }
开发者ID:BGCX067,项目名称:ezsqlhelper-svn-to-git,代码行数:88,代码来源:ez_sql_sybase.php

示例9: IsTimestamp

 function IsTimestamp($vField)
 {
     if (!$this->res) {
         return false;
     }
     $o = sybase_fetch_field($this->res, $vField);
     return $o['type'] == 'datetime' && strlen($this->f($vField)) > 10;
 }
开发者ID:ljvblfz,项目名称:mysoftwarebrasil,代码行数:8,代码来源:class.DCL_DB_sybase.inc.php

示例10: columns

 public function columns()
 {
     if (empty($this->query)) {
         return false;
     }
     $columns = array();
     $num_fields = $this->num_fields();
     for ($i = 0; $i < $num_fields; $i++) {
         $columns[] = sybase_fetch_field($this->query, $i);
     }
     return $columns;
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:12,代码来源:SybaseDriver.php

示例11: _getTextFields

 private function _getTextFields($result)
 {
     if ($this->_result == $result) {
         return $this->_text_fields;
     }
     $this->_result = $result;
     $this->_text_fields = array();
     for ($i = sybase_num_fields($result) - 1; $i >= 0; $i--) {
         $type = sybase_fetch_field($result, $i);
         if (!$type->numeric) {
             $this->_text_fields[$type->name] = $type->type;
         }
     }
     return $this->_text_fields;
 }
开发者ID:Ambalus,项目名称:DbSimple,代码行数:15,代码来源:Sybase.php


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