选择语言 :

Driver_Database_Driver_SQLite_Result
    └ Module_Database_Result

数据库SQLite返回对象

API - Driver_Database_Driver_SQLite_Result

继承自父类的方法和变量
author
呼吸二氧化碳 jonwang@myqee.com
category
Driver
package
Database
subpackage
SQLite
copyright
Copyright © 2008-2013 myqee.com
license
http://www.myqee.com/license.html

$this->__destruct( )

Result destruction cleans up all open result sets.

返回值
  • void

$this->total_count( )

统计当前查询返回数据

返回值
  • int

$this->seek( )


$this->fetch_assoc( )

返回当前行数据


$this->__construct( $result , $sql , $as_object , $config )

Sets the total number of rows and stores the result locally.

参数列表

参数 类型 描述 默认值
$result mixed Query result
$sql string SQL query
$as_object unknown
$config unknown
返回值
  • void

$this->__call( )


$this->result( )

返回当前返回对象


$this->current( )

获取当前行数据


$this->as_array( $key = null, $value = null)

Return all of the rows in the result as an array.

// Indexed array of all rows $rows = $result->as_array();

// Associative array of rows by "id" $rows = $result->as_array('id');

// Associative array of rows, "id" => "name" $rows = $result->as_array('id', 'name');

参数列表

参数 类型 描述 默认值
$key string Column for associative keys null
$value string Column for values null
返回值
  • array

$this->get( $name , $default = null)

Return the named column from the current row.

// Get the "id" value $id = $result->get('id');

参数列表

参数 类型 描述 默认值
$name string Column to get
$default mixed Default value if the column does not exist null
返回值
  • mixed

$this->count( )

Implements [Countable::count], returns the total number of rows.

echo count($result);

返回值
  • integer

$this->offsetExists( )

Implements [ArrayAccess::offsetExists], determines if row exists.

if (isset($result[10])) { // Row 10 exists }

返回值
  • boolean

$this->offsetGet( )

Implements [ArrayAccess::offsetGet], gets a given row.

$row = $result[10];

返回值
  • mixed

$this->offsetSet( )

Implements [ArrayAccess::offsetSet], throws an error.

You cannot modify a database result.
返回值
  • void

$this->offsetUnset( )

Implements [ArrayAccess::offsetUnset], throws an error.

You cannot modify a database result.
返回值
  • void

$this->key( )

Implements [Iterator::key], returns the current row number.

echo key($result);

返回值
  • integer

$this->next( )

Implements [Iterator::next], moves to the next row.

next($result);

返回值
  • $this

$this->prev( )

Implements [Iterator::prev], moves to the previous row.

prev($result);

返回值
  • $this

$this->rewind( )

Implements [Iterator::rewind], sets the current row to zero.

rewind($result);

返回值
  • $this

$this->valid( )

Implements [Iterator::valid], checks if the current row exists.

This method is only used internally.
返回值
  • boolean

$this->fetch_array( )


$this->_change_data_charset( & $data )

对数组或字符串进行编码转换

参数列表

参数 类型 描述 默认值
$data array/string $data

$this->is_bin( $key )

设置指定的key是二进制数据

此方法必须在as_array或current等前面执行 当启用自动编码转换后,获取的数据会自动转码,通过此设置后可以避免对应的字段被转码

$this->is_bin('key1');
$this->is_bin('key1' , 'key2');

参数列表

参数 类型 描述 默认值
$key string $key
返回值
  • $this