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


PHP sqlite_field_name函数代码示例

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


在下文中一共展示了sqlite_field_name函数的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: 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

示例3: __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

示例4: 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++) {
         $F = new stdClass();
         $F->name = sqlite_field_name($this->result_id, $i);
         $F->type = 'varchar';
         $F->max_length = 0;
         $F->primary_key = 0;
         $F->default = '';
         $retval[] = $F;
     }
     return $retval;
 }
开发者ID:kostya1017,项目名称:our,代码行数:22,代码来源:sqlite_result.php

示例5: 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

示例6: 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

示例7: 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

示例8: get_table_data

 /**
  * Retourne les données d'une table de la base de données sous forme de requètes SQL de type DML
  * 
  * @param string $tablename  Nom de la table à considérer
  * 
  * @access public
  * @return string
  */
 function get_table_data($tablename)
 {
     global $db;
     $contents = '';
     $sql = 'SELECT * FROM ' . $tablename;
     if (!($result = $db->query($sql))) {
         trigger_error('Impossible d\'obtenir le contenu de la table ' . $tablename, ERROR);
     }
     $result->setFetchMode(SQL_FETCH_ASSOC);
     if ($row = $result->fetch()) {
         $contents = $this->eol;
         $contents .= '-- ' . $this->eol;
         $contents .= '-- Contenu de la table ' . $tablename . ' ' . $this->eol;
         $contents .= '-- ' . $this->eol;
         $fields = array();
         for ($j = 0, $n = sqlite_num_fields($result->result); $j < $n; $j++) {
             $fields[] = sqlite_field_name($result->result, $j);
         }
         $fields = implode(', ', $fields);
         do {
             $contents .= "INSERT INTO {$tablename} ({$fields}) VALUES";
             foreach ($row as $key => $value) {
                 if (is_null($value)) {
                     $row[$key] = 'NULL';
                 } else {
                     $row[$key] = '\'' . $db->escape($value) . '\'';
                 }
             }
             $contents .= '(' . implode(', ', $row) . ');' . $this->eol;
         } while ($row = $result->fetch());
     }
     return $contents;
 }
开发者ID:bibwho,项目名称:MATPbootstrap,代码行数:41,代码来源:sqlite.php

示例9: 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

示例10: _field_name

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

示例11: sql_fieldname

 function sql_fieldname($offset, $query_id = 0)
 {
     if (!$query_id) {
         $query_id = $this->query_result;
     }
     return $query_id ? @sqlite_field_name($query_id, $offset) : false;
 }
开发者ID:rotvulpix,项目名称:php-nuke,代码行数:7,代码来源:sqlite.php

示例12: 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

示例13: ADOFieldObject

 function &FetchField($fieldOffset = -1)
 {
     $fld = new ADOFieldObject();
     $fld->name = sqlite_field_name($this->_queryID, $fieldOffset);
     $fld->type = 'VARCHAR';
     $fld->max_length = -1;
     return $fld;
 }
开发者ID:teddywen,项目名称:cacti,代码行数:8,代码来源:adodb-sqlite.inc.php

示例14: field_name

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

示例15: sqlitem_field_name

function sqlitem_field_name($result, $index)
{
    return sqlite_field_name($result, $index);
}
开发者ID:jaketay,项目名称:raspberry_pi,代码行数:4,代码来源:sqlite2.inc.php


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