
Representation of a result from a query against the fDatabase class
1.0.0b12 | Added a workaround for iconv having issues in MAMP 1.9.4+ 7/26/11 |
---|---|
1.0.0b12 | Fixed MSSQL to have a properly reset row array, added silenceNotices(), fixed pdo_dblib on Windows when using the Microsoft DBLib driver 5/9/11 |
1.0.0b11 | Backwards Compatibility Break - removed ODBC support 7/31/10 |
1.0.0b10 | Added IBM DB2 support 4/13/10 |
1.0.0b9 | Added support for prepared statements 3/2/10 |
1.0.0b8 | Fixed a bug with decoding MSSQL national column when using an ODBC connection 9/18/09 |
1.0.0b7 | Added the method unescape(), changed tossIfNoRows() to return the object for chaining 8/12/09 |
1.0.0b6 | Fixed a bug where fetchAllRows() would throw a fNoRowsException 6/30/09 |
1.0.0b5 | Added the method asObjects() to allow for returning objects instead of associative arrays 6/23/09 |
1.0.0b4 | Fixed a bug with not properly converting SQL Server text to UTF-8 6/18/09 |
1.0.0b3 | Added support for Oracle, various bug fixes 5/4/09 |
1.0.0b2 | Updated for new fCore API 2/16/09 |
1.0.0b | The initial implementation 9/25/07 |
Composes text using fText if loaded
string compose( string $message, mixed $component [, ... ] )
string | $message | The message to compose |
mixed | $component [, ... ] | A string or number to insert into the message |
The composed and possible translated message
Turns off notices about broken database extensions much as the MSSQL DBLib driver
void silenceNotices( )
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Configures the result set
fResult __construct( fDatabase $database, string $character_set=NULL )
fDatabase | $database | The database object this result set was created from |
string | $character_set | MSSQL only: the character set to transcode from since MSSQL doesn't do UTF-8 |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Frees up the result object to save memory
void __destruct( )
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
All requests that hit this method should be requests for callbacks
callback __get( string $method )
string | $method | The method to create a callback for |
The callback for the method requested
Sets the object to return rows as objects instead of associative arrays (the default)
fResult asObjects( )
The result object, to allow for method chaining
Returns the number of rows affected by the query
integer countAffectedRows( )
The number of rows affected by the query
Returns the number of rows returned by the query
integer countReturnedRows( )
The number of rows returned by the query
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Returns the current row in the result set (required by iterator interface)
array|stdClass current( )
The current row
Returns all of the rows from the result set
array fetchAllRows( )
The array of rows
Returns the row next row in the result set (where the pointer is currently assigned to)
array|stdClass fetchRow( )
The next row in the result
Wraps around fetchRow() and returns the first field from the row instead of the whole row
string|number|boolean fetchScalar( )
The first scalar value from fetchRow()
Returns the last auto incremented value for this database connection. This may or may not be from the current query.
integer getAutoIncrementedValue( )
The auto incremented value
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Returns the result
mixed getResult( )
The result of the query
Returns the SQL used in the query
string getSQL( )
The SQL used in the query
Returns the SQL as it was before translation
string getUntranslatedSQL( )
The SQL from before translation
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Returns the current row number (required by iterator interface)
integer key( )
The current row number
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Advances to the next row in the result (required by iterator interface)
void next( )
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Rewinds the query (required by iterator interface)
void rewind( )
Seeks to the specified zero-based row for the specified SQL query
void seek( integer $row )
integer | $row | The row number to seek to (zero-based) |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Sets the number of affected rows
void setAffectedRows( integer $affected_rows )
integer | $affected_rows | The number of affected rows |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Sets the auto incremented value
void setAutoIncrementedValue( integer $auto_incremented_value )
integer | $auto_incremented_value | The auto incremented value |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Sets the result from the query
void setResult( mixed $result )
mixed | $result | The result from the query |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Sets the number of rows returned
void setReturnedRows( integer $returned_rows )
integer | $returned_rows | The number of rows returned |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Sets the SQL used in the query
void setSQL( string $sql )
string | $sql | The SQL used in the query |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Sets the SQL from before translation
void setUntranslatedSQL( string $untranslated_sql )
string | $untranslated_sql | The SQL from before translation |
Throws an fNoResultException if the query did not return any rows
fResult tossIfNoRows( string $message=NULL )
string | $message | The message to use for the exception if there are no rows in this result set |
The result object, to allow for method chaining
Sets the result object to unescape all values as they are retrieved from the object
The data types should be from the list of types supported by fDatabase::unescape().
fResult unescape( array $column_data_type_map )
array | $column_data_type_map | An associative array with column names as the keys and the data types as the values |
The result object, to allow for method chaining
Returns if the query has any rows left
boolean valid( )
If the iterator is still valid