ResultInterface
interface ResultInterface implements IteratorAggregate (View source)
Extension independent database result interface
Methods
Returns a generator that traverses through the whole result set and returns each row as an associative array
Returns the next row of the result with associative keys
Returns the next row of the result with numeric keys
Returns a single value from the given result; false on error
Returns all rows of the result
Returns values from the selected column of each row
Returns values as single dimensional array where the key is the first column and the value is the second column, e.g. "SELECT id, name FROM users" produces: ['123' => 'John', '124' => 'Jane']
Returns the number of fields in the result
Returns the number of rows in the result
Adjusts the result pointer to an arbitrary row in the result
Returns meta info for fields in $result
Returns the names of the fields in the result
Details
Generator
getIterator()
Returns a generator that traverses through the whole result set and returns each row as an associative array
array
fetchAssoc()
Returns the next row of the result with associative keys
array
fetchRow()
Returns the next row of the result with numeric keys
string|false|null
fetchValue(int|string $field = 0)
Returns a single value from the given result; false on error
array
fetchAllAssoc()
Returns all rows of the result
array
fetchAllColumn(int|string $column = 0)
Returns values from the selected column of each row
array
fetchAllKeyPair()
Returns values as single dimensional array where the key is the first column and the value is the second column, e.g. "SELECT id, name FROM users" produces: ['123' => 'John', '124' => 'Jane']
int
numFields()
Returns the number of fields in the result
string|int
numRows()
Returns the number of rows in the result
bool
seek(int $offset)
Adjusts the result pointer to an arbitrary row in the result
array
getFieldsMeta()
Returns meta info for fields in $result
array
getFieldNames()
Returns the names of the fields in the result