本文整理汇总了PHP中sqlite_fetch_all函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlite_fetch_all函数的具体用法?PHP sqlite_fetch_all怎么用?PHP sqlite_fetch_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlite_fetch_all函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write_data
/**
* {@inheritdoc}
*/
public function write_data($table_name)
{
if (!$this->is_initialized) {
throw new extractor_not_initialized_exception();
}
$col_types = sqlite_fetch_column_types($this->db->get_db_connect_id(), $table_name);
$sql = "SELECT *\n\t\t\tFROM {$table_name}";
$result = sqlite_unbuffered_query($this->db->get_db_connect_id(), $sql);
$rows = sqlite_fetch_all($result, SQLITE_ASSOC);
$sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES (';
foreach ($rows as $row) {
foreach ($row as $column_name => $column_data) {
if (is_null($column_data)) {
$row[$column_name] = 'NULL';
} else {
if ($column_data == '') {
$row[$column_name] = "''";
} else {
if (strpos($col_types[$column_name], 'text') !== false || strpos($col_types[$column_name], 'char') !== false || strpos($col_types[$column_name], 'blob') !== false) {
$row[$column_name] = sanitize_data_generic(str_replace("'", "''", $column_data));
}
}
}
}
$this->flush($sql_insert . implode(', ', $row) . ");\n");
}
}
示例2: _fetchAll
protected function _fetchAll($result)
{
$rows = sqlite_fetch_all($result, SQLITE_ASSOC);
// free result?
// rewind?
return $rows;
}
示例3: fetch
public function fetch($res)
{
$result = array();
$rows = sqlite_fetch_all($res, SQLITE_ASSOC);
foreach ($rows as $data) {
$result[] = (object) $data;
}
return $result;
}
示例4: dump
public function dump()
{
$res = sqlite_query($con, self::ALL_GET_SQL);
foreach (sqlite_fetch_all($res, SQLITE_ASSOC) as $row) {
$this->cache[$row['name']] = unserialize($row['name']);
$this->valueTime[$row['name']] = $row['time'];
}
var_dump($this->cache);
}
示例5: fetchAll
function fetchAll($type = SQLITE_BOTH)
{
if ($type == 1) {
$type = SQLITE_ASSOC;
} elseif ($type == 2) {
$type = SQLITE_NUM;
} elseif ($type == 3 || $type != SQLITE_BOTH) {
$type = SQLITE_BOTH;
}
//
return sqlite_fetch_all($this->query, $type);
}
示例6: getAll
public function getAll($sql)
{
if ($sql) {
$query = $this->query($sql);
if ($query) {
return sqlite_fetch_all($query);
} else {
return false;
}
} else {
return false;
}
}
示例7: fetchAll
function fetchAll($query)
{
if ($this->handler) {
$response = sqlite_query($this->handler, $query);
if ($response) {
return sqlite_fetch_all($response, SQLITE_ASSOC);
} else {
return false;
}
} else {
die('データベースハンドラが見つかりません。');
}
}
示例8: load_popular_db_data
function load_popular_db_data($type = SQLITE_NUM)
{
$db = get_db();
$result = sqlite_query($db, "select url, count(*) from access_info group by url", $type);
$temp_arr = sqlite_fetch_all($result);
$ret_arr = array();
foreach ($temp_arr as $sub_arr) {
list($url, $cnt) = $sub_arr;
$ret_arr[$url] = $cnt;
}
arsort($ret_arr);
return array("hot" => array_slice($ret_arr, 0, 10), "good" => array_slice($ret_arr, 10, 10), "all" => $ret_arr);
}
示例9: 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);
}
}
示例10: jz_db_query
function jz_db_query($link, $sql)
{
global $sql_type, $sql_pw, $sql_socket, $sql_db, $sql_usr;
if (false !== ($res = jz_db_cache('query', $sql))) {
return $res;
}
$results = @sqlite_query($link, $sql);
if (!$results) {
return false;
}
$res = sqlite_fetch_all($results, SQLITE_BOTH);
$ret =& new sqlTable();
$ret->data = $res;
$ret->rows = sizeof($res);
jz_db_cache('query', $sql, $res);
return $ret;
}
示例11: execSQL
public function execSQL($query)
{
$result = sqlite_query($this->db, $query);
return sqlite_fetch_all($result, SQLITE_ASSOC);
}
示例12: remove_project
function remove_project($id, $type = SQLITE_NUM)
{
$db = get_db2();
$result = sqlite_query($db, "delete from project_info where id='{$id}'", $type);
return sqlite_fetch_all($result);
}
示例13: fetchAll
/**
* Renvoie un tableau de toutes les lignes du jeu de résultat
*
* @param integer $mode Mode de récupération des données
*
* @access public
* @return array
*/
function fetchAll($mode = null)
{
if (is_null($mode)) {
$mode = $this->fetchMode;
}
return sqlite_fetch_all($this->result, $mode);
}
示例14: define
<?php
define("CODEDB", "../data/code_db");
if ($db = sqlite_open(CODEDB, 0666, $sqliteerror)) {
$result = sqlite_query($db, 'select language from code_info', SQLITE_ASSOC);
$ret_array = sqlite_fetch_all($result);
$lang_list = array();
foreach ($ret_array as $row_array) {
array_push($lang_list, $row_array["language"]);
}
foreach (array_unique($lang_list) as $lang) {
echo "<input name='lang_type' type=radio for='{$lang}''>{$lang}";
}
}
示例15: selectArray
public function selectArray($query)
{
$result = $this->query($query);
if ($this->type == "PDO") {
return $result->fetchAll();
} else {
if ($this->type == "SQLite3") {
$arr = array();
$i = 0;
while ($res = $result->fetchArray()) {
$arr[$i] = $res;
$i++;
}
return $arr;
} else {
if ($this->type == "SQLite") {
return sqlite_fetch_all($result);
}
}
}
}