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


PHP mssql_fetch_field函数代码示例

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


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

示例1: GetFields

 function GetFields()
 {
     $_fields = array();
     $_result = mssql_query($this->SelectCommand, $this->_Link);
     while ($_prop = mssql_fetch_field($_result)) {
         $_field = array("Name" => $_prop->name, "Type" => $_prop->type, "Not_Null" => 0);
         array_push($_fields, $_field);
     }
     return $_fields;
 }
开发者ID:skydel,项目名称:universal-online-exam,代码行数:10,代码来源:MSSQLDataSource.php

示例2: __construct

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

示例3: field_data

 /**
  * Field data
  *
  * Generates an array of objects containing field meta-data
  *
  * @access	public
  * @return	array
  */
 function field_data()
 {
     $retval = array();
     while ($field = mssql_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:jiz,项目名称:CodeIgniter,代码行数:22,代码来源:mssql_result.php

示例4: __get

 /**
  * Dynamic Get Function Override
  *
  * @param $name
  *   A string containing the name of the property to get.
  * @return
  *   Value of the property.
  */
 public function __get($propertyName)
 {
     //        global $firePHP;
     if ($propertyName == 'columns') {
         if (!isset($this->_columns)) {
             //---- Get Columns
             $this->_columns = new anvilCollection();
             $i = 0;
             //                $sql = 'SHOW COLUMNS FROM ';
             while ($i < mssql_num_fields($this->result)) {
                 $meta = mssql_fetch_field($this->result, $i);
                 if ($meta) {
                     //                       $firePHP->_log($meta);
                     $newColumn = new anvilData_mssql_Column($meta->name, $meta->type);
                     $this->_columns->add($newColumn);
                 }
                 $i++;
             }
         }
         return $this->_columns;
     } else {
         return parent::__get($propertyName);
     }
 }
开发者ID:nslevkoff,项目名称:phpAnvil2,代码行数:32,代码来源:anvilData_mssql_Recordset.class.php

示例5: list_fields

 public function list_fields()
 {
     $field_names = array();
     while ($field = mssql_fetch_field($this->result)) {
         $field_names[] = $field->name;
     }
     return $field_names;
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:8,代码来源:Mssql.php

示例6: getColumnsMeta

 /**
  * Returns metadata for all columns in a result set.
  * @return array
  */
 public function getColumnsMeta()
 {
     $count = mssql_num_fields($this->resultSet);
     $res = array();
     for ($i = 0; $i < $count; $i++) {
         $row = (array) mssql_fetch_field($this->resultSet, $i);
         $res[] = array('name' => $row['name'], 'fullname' => $row['column_source'] ? $row['column_source'] . '.' . $row['name'] : $row['name'], 'table' => $row['column_source'], 'nativetype' => $row['type']);
     }
     return $res;
 }
开发者ID:vlki,项目名称:dibi,代码行数:14,代码来源:mssql.php

示例7: fieldInfo

 /**
  * mysql_fetch_field() wrapper
  * Returns false if the field doesn't exist
  *
  * @param $table
  * @param $field
  */
 function fieldInfo($table, $field)
 {
     $table = $this->tableName($table);
     $res = $this->query("SELECT TOP 1 * FROM {$table}");
     $n = mssql_num_fields($res->result);
     for ($i = 0; $i < $n; $i++) {
         $meta = mssql_fetch_field($res->result, $i);
         if ($field == $meta->name) {
             return new MSSQLField($meta);
         }
     }
     return false;
 }
开发者ID:rocLv,项目名称:conference,代码行数:20,代码来源:DatabaseMssql.php

示例8: mssql_to_table

function mssql_to_table($sql)
{
    $fields_array = array();
    $num_fields = 0;
    $num_row = 0;
    // find position of "FROM" in query
    $fpos = strpos($sql, 'from');
    // get string starting from the first word after "FROM"
    $strfrom = substr($sql, $fpos + 5, 50);
    // Find position of the first space after the first word in the string
    $Opos = strpos($strfrom, ' ');
    //Get table name. If query pull data from more then one table only first table name will be read.
    $table = substr($strfrom, 0, $Opos);
    // Get result from query
    $result = mssql_query($sql) or die('Invalid query: ' . mssql_error());
    $num_row = mssql_numrows($result);
    print '<html>';
    print '<head><title>';
    print 'View&nbsp' . $table . '</title>';
    print '<link rel="stylesheet" href="style.css">';
    print "</head>";
    print '<body><br>';
    if ($num_row > 0) {
        //Get number of fields in query
        $num_fields = mssql_num_fields($result);
        # get column metadata
        $i = 0;
        //Set table width 15% for each column
        $width = 15 * $num_fields;
        print '<br><table width=' . $width . '% align="center"><tr>';
        print '<tr><th colspan=' . $num_fields . '>View&nbsp;' . $table . '</th></tr>';
        while ($i < $num_fields) {
            //Get fields (columns) names
            $meta = mssql_fetch_field($result);
            $fields_array[] = $meta->name;
            //Display column headers in upper case
            print '<th><b>' . strtoupper($fields_array[$i]) . '</b></th>';
            $i = $i + 1;
        }
        print '</tr>';
        //Get values for each row and column
        while ($row = mssql_fetch_row($result)) {
            print '<tr>';
            for ($i = 0; $i < $num_fields; $i++) {
                //Display values for each row and column
                print '<td>' . $row[$i] . '</td>';
            }
            print '</tr>';
        }
    }
    return;
}
开发者ID:jmiskiewicz,项目名称:home,代码行数:52,代码来源:html_show_array.php

示例9: fetch_field

 /**
  * Get column information
  * @param  int
  * @return object
  */
 protected function fetch_field($intOffset)
 {
     return @mssql_fetch_field($this->resResult, $intOffset);
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:9,代码来源:DB_Mssql.php

示例10: FetchField

 function FetchField($fieldOffset = -1)
 {
     if ($fieldOffset != -1) {
         $f = @mssql_fetch_field($this->_queryID, $fieldOffset);
     } else {
         if ($fieldOffset == -1) {
             /*	The $fieldOffset argument is not provided thus its -1 	*/
             $f = @mssql_fetch_field($this->_queryID);
         }
     }
     $false = false;
     if (empty($f)) {
         return $false;
     }
     return $f;
 }
开发者ID:kagetenshi,项目名称:xenoberage,代码行数:16,代码来源:adodb-mssql.inc.php

示例11: metadata

 function metadata($table)
 {
     $count = 0;
     $id = 0;
     $res = array();
     $this->connect();
     $id = mssql_query("select * from {$table}", $this->Link_ID);
     if (!$id) {
         $this->halt('Metadata query failed.');
     }
     $count = mssql_num_fields($id);
     for ($i = 0; $i < $count; $i++) {
         $info = mssql_fetch_field($id, $i);
         $res[$info->name] = $info;
         /*
         				$res[$i]['table'] = $table;
         				$res[$i]['name']  = $info->name;
         				$res[$i]['len']   = $info->max_length;
         				$res[$i]['flags'] = $info->numeric;
         				$res[$i]['type'] = $info->type;
         */
     }
     $this->free_result();
     return $res;
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:25,代码来源:class.db_mssql.inc.php

示例12: 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();
         for ($column = 0; @mssql_field_seek($result, $column); $column++) {
             $field = mssql_fetch_field($result);
             $this->columns[$result_value][strtolower($field->name)] = $column;
         }
     }
     $column_names = $this->columns[$result_value];
     return 1;
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:16,代码来源:metabase_mssql.php

示例13: getFieldsArray

 /**
  * @see DBManager::getFieldsArray()
  */
 public function getFieldsArray($result, $make_lower_case = false)
 {
     $field_array = array();
     if (!isset($result) || empty($result)) {
         return 0;
     }
     $i = 0;
     while ($i < mssql_num_fields($result)) {
         $meta = mssql_fetch_field($result, $i);
         if (!$meta) {
             return 0;
         }
         if ($make_lower_case == true) {
             $meta->name = strtolower($meta->name);
         }
         $field_array[] = $meta->name;
         $i++;
     }
     return $field_array;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:23,代码来源:MssqlManager.php

示例14: columnData

 public function columnData()
 {
     if (empty($this->query)) {
         return false;
     }
     $columns = array();
     for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) {
         $field = mssql_fetch_field($this->query, $i);
         $columns[$i] = new stdClass();
         $columns[$i]->name = $field->name;
         $columns[$i]->type = $field->type;
         $columns[$i]->maxLength = $field->max_length;
         $columns[$i]->primaryKey = false;
     }
     return $columns;
 }
开发者ID:bytemtek,项目名称:znframework,代码行数:16,代码来源:Mssql.php

示例15: fetch_fields

 function fetch_fields($query)
 {
     return mssql_fetch_field($query);
 }
开发者ID:ahmatjan,项目名称:EasyManage,代码行数:4,代码来源:mssql.class.php


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