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


PHP sqlite_num_fields函数代码示例

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


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

示例1: dl

<?php

if (!extension_loaded("sqlite")) {
    dl("sqlite.so");
    if (!extension_loaded("sqlite")) {
        exit("Please enable SQLite support\n");
    }
}
debug_zval_dump(sqlite_libversion());
debug_zval_dump(sqlite_libencoding());
$s = sqlite_open("weztest.sqlite", 0666, $err);
debug_zval_dump($err);
debug_zval_dump($s);
$r = sqlite_query("create table foo (a INTEGER PRIMARY KEY, b INTEGER )", $s);
debug_zval_dump(sqlite_last_error($s));
debug_zval_dump(sqlite_error_string(sqlite_last_error($s)));
$r = sqlite_query("select *, php('md5', sql) as o from sqlite_master", $s);
debug_zval_dump($r);
debug_zval_dump(sqlite_num_rows($r));
debug_zval_dump(sqlite_num_fields($r));
for ($j = 0; $j < sqlite_num_fields($r); $j++) {
    echo "Field {$j} is " . sqlite_field_name($r, $j) . "\n";
}
while ($row = sqlite_fetch_array($r, SQLITE_ASSOC)) {
    print_r($row);
}
sqlite_close($s);
开发者ID:garybulin,项目名称:php7,代码行数:27,代码来源:sqlite.php

示例2: getNFields

 public function getNFields()
 {
     if ($this->_nfields === null) {
         $this->_nfields = sqlite_num_fields($this->r);
     }
     return $this->_nfields;
 }
开发者ID:marcdraco,项目名称:Webrathea,代码行数:7,代码来源:SqliteResultSet.class.php

示例3: columnCount

 public function columnCount()
 {
     if ($this->_result) {
         return sqlite_num_fields($this->_result);
     }
     return 0;
 }
开发者ID:Deepab23,项目名称:clinic,代码行数:7,代码来源:sqlite2_statement.php

示例4: columnCount

 /**
  * Public method:
  *	Checks if query was valid and returns how may fields returns
  *       	this->columnCount( void ):Void
  */
 function columnCount()
 {
     $result = 0;
     if (!is_null($this->__result)) {
         $result = sqlite_num_fields($this->__result);
     }
     return $result;
 }
开发者ID:D4rk4,项目名称:Kusaba-z,代码行数:13,代码来源:PDOStatement_sqlite.class.php

示例5: getFields

 /**
  * Internal method to get a list of field names returned
  *
  * @return Integer
  */
 public function getFields()
 {
     $fields = sqlite_num_fields($this->result);
     $result = array();
     for ($i = 0; $i < $fields; $i++) {
         $result[$i] = sqlite_field_name($this->result, $i);
     }
     return $result;
 }
开发者ID:Nycto,项目名称:Round-Eights,代码行数:14,代码来源:Result.php

示例6: __construct

 /**
  * Constructor
  *
  * @param   resource handle
  */
 public function __construct($result)
 {
     $fields = array();
     if (is_resource($result)) {
         for ($i = 0, $num = sqlite_num_fields($result); $i < $num; $i++) {
             $fields[sqlite_field_name($result, $i)] = FALSE;
             // Types are unknown
         }
     }
     parent::__construct($result, $fields);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:16,代码来源:SQLiteResultSet.class.php

示例7: sqliteAdapter

 /**
  * Constructor method for the adapter.  This constructor implements the setting of the
  * 3 required properties for the object.
  * 
  * @param resource $d The datasource resource
  */
 function sqliteAdapter($d)
 {
     parent::RecordSetAdapter($d);
     // grab all of the rows
     $fieldcount = sqlite_num_fields($d);
     // loop over all of the fields
     for ($i = 0; $i < $fieldcount; $i++) {
         // decode each field name ready for encoding when it goes through serialization
         // and save each field name into the array
         $this->columns[] = sqlite_field_name($d, $i);
     }
     if (sqlite_num_rows($d) > 0) {
         $this->rows = sqlite_fetch_all($d, SQLITE_NUM);
     }
 }
开发者ID:nimigeanu,项目名称:hollow,代码行数:21,代码来源:sqliteAdapter.php

示例8: sqliteAdapter

 /**
  * Constructor method for the adapter.  This constructor implements the setting of the
  * 3 required properties for the object.
  * 
  * @param resource $d The datasource resource
  */
 function sqliteAdapter($d)
 {
     parent::RecordSetAdapter($d);
     // grab all of the rows
     $fieldcount = sqlite_num_fields($d);
     $ob = "";
     $fc = pack('N', $fieldcount);
     if (sqlite_num_rows($d) > 0) {
         sqlite_seek($d, 0);
         while ($line = sqlite_fetch_array($d, SQLITE_NUM)) {
             //Write array flag + length
             $ob .= "\n" . $fc;
             $to = count($line);
             for ($i = 0; $i < $to; $i++) {
                 //Type everything as a string since this is sqlite
                 $value = $line[$i];
                 $os = $this->_directCharsetHandler->transliterate($value);
                 //string flag, string length, and string
                 $len = strlen($os);
                 if ($len < 65536) {
                     $ob .= "" . pack('n', $len) . $os;
                 } else {
                     $ob .= "\f" . pack('N', $len) . $os;
                 }
             }
         }
     }
     // grab the number of fields
     // loop over all of the fields
     for ($i = 0; $i < $fieldcount; $i++) {
         // decode each field name ready for encoding when it goes through serialization
         // and save each field name into the array
         $this->columnNames[$i] = $this->_directCharsetHandler->transliterate(sqlite_field_name($d, $i));
     }
     $this->numRows = sqlite_num_rows($d);
     $this->serializedData = $ob;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:43,代码来源:sqliteAdapter.php

示例9: getFieldInfo

 function getFieldInfo($stack = 0)
 {
     $fields = array();
     $i = 0;
     if (($table = Session::get('select', 'table')) != '') {
         // query from a table, so we can find keys related information using pragma
         $this->result['_tinfo'] = @sqlite_query('PRAGMA table_info(' . $this->quote($table) . ')', $this->conn);
         while ($row = $this->fetchRow('_tinfo')) {
             $f = new StdClass();
             $f->name = $row['name'];
             $f->table = $table;
             $f->not_null = $row['notnull'];
             $f->blob = $row['type'] == 'BLOB' ? 1 : 0;
             $f->pkey = $row['pk'];
             $f->ukey = 0;
             $f->mkey = 0;
             $f->zerofill = 0;
             $f->unsigned = 0;
             $f->autoinc = 0;
             $f->numeric = $row['type'] == 'INTEGER' ? 1 : 0;
             $f->type = $row['type'] == 'INTEGER' ? 'numeric' : ($row['type'] == 'BLOB' ? 'binary' : 'text');
             $fields[] = $f;
             $i++;
         }
     } else {
         while ($i < sqlite_num_fields($this->result[$stack])) {
             $f = new StdClass();
             $f->name = sqlite_field_name($this->result[$stack], $i);
             $f->table = '';
             $f->not_null = 0;
             $f->blob = 0;
             $f->pkey = 0;
             $f->ukey = 0;
             $f->mkey = 0;
             $f->zerofill = 0;
             $f->unsigned = 0;
             $f->autoinc = 0;
             $f->numeric = 0;
             $f->type = 'string';
             $fields[] = $f;
             $i++;
         }
     }
     return $fields;
 }
开发者ID:guohuadeng,项目名称:stampApp,代码行数:45,代码来源:sqlite.php

示例10: sql_num_fields

 function sql_num_fields($sqltype, $result)
 {
     if ($sqltype == 'mysql') {
         if (class_exists('mysqli_result')) {
             return $result->field_count;
         } elseif (function_exists('mysql_num_fields')) {
             return mysql_num_fields($result);
         }
     } elseif ($sqltype == 'mssql') {
         if (function_exists('sqlsrv_num_fields')) {
             return sqlsrv_num_fields($result);
         } elseif (function_exists('mssql_num_fields')) {
             return mssql_num_fields($result);
         }
     } elseif ($sqltype == 'pgsql') {
         return pg_num_fields($result);
     } elseif ($sqltype == 'oracle') {
         return oci_num_fields($result);
     } elseif ($sqltype == 'sqlite3') {
         return $result->numColumns();
     } elseif ($sqltype == 'sqlite') {
         return sqlite_num_fields($result);
     } elseif ($sqltype == 'odbc') {
         return odbc_num_fields($result);
     } elseif ($sqltype == 'pdo') {
         return $result->columnCount();
     }
 }
开发者ID:retanoj,项目名称:webshellSample,代码行数:28,代码来源:7394316867fbf40088309b5150e77721.php

示例11: columnCount

 public function columnCount()
 {
     return $this->_result ? sqlite_num_fields($this->_result) : 0;
 }
开发者ID:albertobraschi,项目名称:toad,代码行数:4,代码来源:DoSqlite.php

示例12: getColumnsMeta

 /**
  * Returns metadata for all columns in a result set.
  *
  * @return array
  */
 public function getColumnsMeta()
 {
     $count = sqlite_num_fields($this->resultSet);
     $meta = array();
     for ($i = 0; $i < $count; $i++) {
         // items 'name' and 'table' are required
         $meta[] = array('name' => sqlite_field_name($this->resultSet, $i), 'table' => NULL);
     }
     return $meta;
 }
开发者ID:laiello,项目名称:webuntucms,代码行数:15,代码来源:sqlite.php

示例13: getResultColumns

 /**
  * Returns metadata for all columns in a result set.
  * @return array
  */
 public function getResultColumns()
 {
     $count = sqlite_num_fields($this->resultSet);
     $columns = array();
     for ($i = 0; $i < $count; $i++) {
         $name = str_replace(array('[', ']'), '', sqlite_field_name($this->resultSet, $i));
         $pair = explode('.', $name);
         $columns[] = array('name' => isset($pair[1]) ? $pair[1] : $pair[0], 'table' => isset($pair[1]) ? $pair[0] : NULL, 'fullname' => $name, 'nativetype' => NULL);
     }
     return $columns;
 }
开发者ID:Scrik,项目名称:Need-For-Speed-World-Statistics-Website,代码行数:15,代码来源:sqlite.php

示例14: _initrs

 function _initrs()
 {
     $this->_numOfRows = @sqlite_num_rows($this->_queryID);
     $this->_numOfFields = @sqlite_num_fields($this->_queryID);
 }
开发者ID:teddywen,项目名称:cacti,代码行数:5,代码来源:adodb-sqlite.inc.php

示例15: num_fields

 function num_fields($resId = null)
 {
     if ($resId == null) {
         $resId = $this->resId;
     }
     if (DEBUG) {
         $out = sqlite_num_fields($resId);
     } else {
         $out = @sqlite_num_fields($resId);
     }
     return $out;
 }
开发者ID:ve3sjk,项目名称:45Farms-YieldBuddy-Merged,代码行数:12,代码来源:sqlite_2.class.php


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