Class DibiResult
dibi result set.
$result = dibi::query('SELECT * FROM [table]'); $row = $result->fetch(); $value = $result->fetchSingle(); $table = $result->fetchAll(); $pairs = $result->fetchPairs(); $assoc = $result->fetchAssoc('id'); $assoc = $result->fetchAssoc('active,#,id'); unset($result);
- DibiObject
-
DibiResult implements IDataSource, Traversable, IteratorAggregate, Countable
public
|
#
__construct(
IDibiResultDriver
$driver,
array
$config
)
Parameters$driver IDibiResultDriver$config array |
public
void
|
#
__destruct(
)
Automatically frees the resources allocated for this result set. Automatically frees the resources allocated for this result set. |
final public
mixed
|
#
getResource(
)
Returns the result set resource. Returns the result set resource. |
final public
void
|
#
free(
)
Frees the resources allocated for this result set. Frees the resources allocated for this result set. |
final public
boolean
|
#
seek(
int
$row
)
Moves cursor position without fetching row. Moves cursor position without fetching row. Parameters$row int the 0-based cursor pos to seek toReturnsboolean TRUE on success, FALSE if unable to seek to specified record
Throws |
final public
int
|
#
count(
)
Required by the Countable interface. |
final public
int
|
#
getRowCount(
)
Returns the number of rows in a result set. Returns the number of rows in a result set. |
final public
|
#
rowCount(
)
Returns the number of rows in a result set. Alias for getRowCount(). Returns the number of rows in a result set. Alias for getRowCount(). |
final public
DibiResultIterator
|
#
getIterator(
)
Required by the IteratorAggregate interface. |
public
DibiResult
|
#
setRowClass(
string
$class
)
Set fetched object class. This class should extend the DibiRow class. Set fetched object class. This class should extend the DibiRow class. Parameters$class stringReturnsDibiResult provides a fluent interface
|
public
string
|
#
getRowClass(
)
Returns fetched object class name. Returns fetched object class name. |
final public
DibiRow|FALSE
|
#
fetch(
)
Fetches the row at current position, process optional type conversion. Fetches the row at current position, process optional type conversion. and moves the internal cursor to the next position ReturnsDibiRow|FALSE array on success, FALSE if no next record
|
final public
mixed
|
#
fetchSingle(
)
Like fetch(), but returns only first field. Like fetch(), but returns only first field. Returnsmixed value on success, FALSE if no next record
|
final public
array
|
#
fetchAll(
int
$offset = NULL,
int
$limit = NULL
)
Fetches all records from table. Fetches all records from table. Parameters$offset int offset$limit int limitReturnsarray of DibiRow
|
final public
DibiRow
|
#
fetchAssoc(
string
$assoc
)
Fetches all records from table and returns associative tree. Fetches all records from table and returns associative tree. Examples:
Parameters$assoc string associative descriptorThrows
InvalidArgumentException
|
final public
array
|
#
fetchPairs(
string
$key = NULL,
string
$value = NULL
)
Fetches all records from table like $key ⇒ $value pairs. Fetches all records from table like $key ⇒ $value pairs. Parameters$key string associative key$value string valueThrows
InvalidArgumentException
|
final public
DibiResult
|
#
setType(
string
$col,
string
$type
)
Define column type. Define column type. Parameters$col string column$type string type (use constant Dibi::*)ReturnsDibiResult provides a fluent interface
|
final public
void
|
#
detectTypes(
)
Autodetect column types. Autodetect column types. |
final public
string
|
#
getType(
$col
)
Returns column type. Returns column type. |
protected
mixed
|
#
convert(
mixed
$value,
int
$type
)
Converts value to specified type and format. Converts value to specified type and format. Parameters$value mixed value$type int type |
public
DibiResultInfo
|
#
getInfo(
)
Returns a meta information about the current result set. Returns a meta information about the current result set. |
final public
|
#
getColumns(
)
|
public
|
#
getColumnNames(
$fullNames = false
)
|
final public
void
|
#
dump(
)
Displays complete result set as HTML table for debug purposes. Displays complete result set as HTML table for debug purposes. |