Db_Result Class
This class lets you use Db results from Db queries
Constructor
Db_Result
-
$stmt
-
$query
Parameters:
-
$stmt
PDOStatement | ArrayThe PDO statement object that this result uses Can also be an array of PDO statements, in which case this was the result of an aggregated query.
-
$query
Db_Query_InterfaceThe query that was run to produce this result
Item Index
Methods
__call
-
$name
-
$arguments
Forwards all other calls to the PDOStatement object
Parameters:
-
$name
StringThe function name
-
$arguments
ArrayThe arguments
__toMarkup
()
String
Dumps the result as an HTML table. Side effect, though: can't fetch anymore until the cursor is closed.
Returns:
__toString
()
String
Dumps the result as a table in text mode Side effect, though: can't fetch anymore until the cursor is closed.
Returns:
fetchAll
()
Array
Fetches an array of database rows matching the query. The query is executed and fetchAll() is called on the result.
Returns:
fetchDbRow
-
[$class_name=null]
-
[$fields_prefix='']
Fetches one Db_Row object (possibly extended). You can pass a prefix to strip from the field names. It will also filter the result.
Parameters:
-
[$class_name=null]
String optionalThe name of the class to instantiate and fill objects from. Must extend Db_Row. Defaults to $this->query->className
-
[$fields_prefix='']
String optionalThis is the prefix, if any, to strip out when fetching the rows.
Returns:
Returns false if no row, otherwise returns an object of type $class_name
fetchDbRows
-
[$class_name=null]
-
[$fields_prefix='']
-
[$by_field=null]
Fetches an array of Db_Row objects (possibly extended). You can pass a prefix to strip from the field names. It will also filter the result.
Parameters:
-
[$class_name=null]
String optionalThe name of the class to instantiate and fill objects from. Must extend Db_Row. Defaults to $this->query->className
-
[$fields_prefix='']
String optionalThis is the prefix, if any, to strip out when fetching the rows.
-
[$by_field=null]
String optionalA field name to index the array by. If the field's value is NULL in a given row, that row is just appended in the usual way to the array.
Returns:
Properties
$stmts
Array
An array of PDO statements if passed to the constructor
stmt
PDOStatement
The PDO statement object that this result uses