final class SQLiteResult implements Iterator, Countable (View source)

Methods

array
fetch(int $result_type = SQLITE_BOTH, bool $decode_binary = true)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Fetches the next row from a result set as an array

object
fetchObject(string $class_name, array $ctor_params, bool $decode_binary = true)

(PHP 5 < 5.4.0) Fetches the next row from a result set as an object

string
fetchSingle(bool $decode_binary = true)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.1) Fetches the first column of a result set as a string

object
fetchAll(int $result_type, bool $decode_binary = true)

(PHP 5 < 5.4.0) Fetches the next row from a result set as an object

mixed
column($index_or_name, $decode_binary = true)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Fetches a column from the current row of a result set

int
numFields()

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Returns the number of fields in a result set

string
fieldName(int $field_index)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Returns the name of a particular field

mixed
current(int $result_type = SQLITE_BOTH, bool $decode_binary = true)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Fetches the current row from a result set as an array

mixed
key()

Return the key of the current element

void
next()

Seek to the next row number

bool
valid()

Checks if current position is valid

void
rewind()

Rewind the Iterator to the first element

int
count()

Count elements of an object

bool
prev()

Seek to the previous row number of a result set

bool
hasPrev()

No description

int
numRows()

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Returns the number of rows in a buffered result set

seek($row)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Seek to a particular row number of a buffered result set

Details

array fetch(int $result_type = SQLITE_BOTH, bool $decode_binary = true)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Fetches the next row from a result set as an array

Parameters

int $result_type

[optional]

The optional result_type parameter accepts a constant and determines how the returned array will be indexed. Using SQLITE_ASSOC will return only associative indices (named fields) while SQLITE_NUM will return only numerical indices (ordinal field numbers). SQLITE_BOTH will return both associative and numerical indices. SQLITE_BOTH is the default for this function.

bool $decode_binary

[optional]

When the decode_binary parameter is set to TRUE (the default), PHP will decode the binary encoding it applied to the data if it was encoded using the https://php.net/manual/en/sqlite.configuration.php#ini.sqlite.assoc-case sqlite.assoc_case. You should normally leave this value at its default, unless you are interoperating with databases created by other sqlite capable applications.

Return Value

array

Returns an array of the next row from a result set; FALSE if the next position is beyond the final row.

The column names returned by SQLITE_ASSOC and SQLITE_BOTH will be case-folded according to the value of the https://php.net/manual/en/sqlite.configuration.php#ini.sqlite.assoc-case sqlite.assoc_case configuration option.

object fetchObject(string $class_name, array $ctor_params, bool $decode_binary = true)

(PHP 5 < 5.4.0) Fetches the next row from a result set as an object

Parameters

string $class_name [optional]
array $ctor_params [optional]
bool $decode_binary [optional]

Return Value

object

string fetchSingle(bool $decode_binary = true)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.1) Fetches the first column of a result set as a string

Parameters

bool $decode_binary [optional]

Return Value

string

Returns the first column value, as a string.

object fetchAll(int $result_type, bool $decode_binary = true)

(PHP 5 < 5.4.0) Fetches the next row from a result set as an object

Parameters

int $result_type

[optional]

The optional result_type parameter accepts a constant and determines how the returned array will be indexed. Using SQLITE_ASSOC will return only associative indices (named fields) while SQLITE_NUM will return only numerical indices (ordinal field numbers). {\SQLITE_BOTH} will return both associative and numerical indices. {\SQLITE_BOTH} is the default for this function.

bool $decode_binary

[optional]

When the decode_binary parameter is set to TRUE (the default), PHP will decode the binary encoding it applied to the data if it was encoded using the {\sqlite_escape_string()}. You should normally leave this value at its default, unless you are interoperating with databases created by other sqlite capable applications.

Return Value

object

mixed column($index_or_name, $decode_binary = true)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Fetches a column from the current row of a result set

Parameters

$index_or_name
$decode_binary

[optional]

When the decode_binary parameter is set to TRUE (the default), PHP will decode the binary encoding it applied to the data if it was encoded using the {\sqlite_escape_string()}. You should normally leave this value at its default, unless you are interoperating with databases created by other sqlite capable applications.

Return Value

mixed

Returns the column value

int numFields()

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Returns the number of fields in a result set

Return Value

int

Returns the number of fields, as an integer.

string fieldName(int $field_index)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Returns the name of a particular field

Parameters

int $field_index

The ordinal column number in the result set.

Return Value

string

Returns the name of a field in an SQLite result set, given the ordinal column number; FALSE on error.

The column names returned by SQLITE_ASSOC and SQLITE_BOTH will be case-folded according to the value of the https://php.net/manual/en/sqlite.configuration.php#ini.sqlite.assoc-case sqlite.assoc_caseconfiguration option.

mixed current(int $result_type = SQLITE_BOTH, bool $decode_binary = true)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Fetches the current row from a result set as an array

Parameters

int $result_type

[optional]

The optional result_type parameter accepts a constant and determines how the returned array will be indexed. Using {\SQLITE_ASSOC} will return only associative indices (named fields) while {\SQLITE_NUM} will return only numerical indices (ordinal field numbers). SQLITE_BOTH will return both associative and numerical indices. {\SQLITE_BOTH} is the default for this function.

bool $decode_binary

[optional]

When the decode_binary parameter is set to TRUE (the default), PHP will decode the binary encoding it applied to the data if it was encoded using the {\sqlite_escape_string()}. You should normally leave this value at its default, unless you are interoperating with databases created by other sqlite capable applications.

Return Value

mixed

Can return any type.

mixed key()

Since: 5.0.0

Return the key of the current element

Return Value

mixed

TKey on success, or null on failure.

void next()

Since: 5.0.0

Seek to the next row number

Return Value

void

Any returned value is ignored.

bool valid()

Since: 5.0.0

Checks if current position is valid

Return Value

bool

The return value will be casted to boolean and then evaluated. Returns true on success or false on failure.

void rewind()

Since: 5.0.0

Rewind the Iterator to the first element

Return Value

void

Any returned value is ignored.

int count()

Since: 5.1.0

Count elements of an object

Return Value

int

The custom count as an integer.

The return value is cast to an integer.

bool prev()

Since: 5.4.0

Seek to the previous row number of a result set

Return Value

bool

Returns TRUE on success, or FALSE if there are no more previous rows.

bool hasPrev()

Since: 5.4.0 Returns whether or not a previous row is available

No description

Return Value

bool

Returns TRUE if there are more previous rows available from the result handle, or FALSE otherwise.

int numRows()

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Returns the number of rows in a buffered result set

Return Value

int

Returns the number of rows, as an integer.

seek($row)

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0) Seek to a particular row number of a buffered result set

Parameters

$row

The ordinal row number to seek to. The row number is zero-based (0 is the first row).

Note:

This function cannot be used with unbuffered result handles.