Flourish PHP Unframework

fStatement

class, v1.0.0b7

Representation of a prepared statement for use with the fDatabase class

Changes:
1.0.0b7Fixed handling of arrays of values for execute(), executeQuery() and executeUnbufferedQuery(), fixed escaping of values that become NULL 5/9/11
1.0.0b6Added getUntranslatedSQL() 1/9/11
1.0.0b5Fixed an edge case where the mysqli extension would leak memory when fetching a TEXT or BLOB column 8/28/10
1.0.0b4Updated class to use fCore::startErrorCapture() instead of error_reporting() 8/9/10
1.0.0b3Backwards Compatibility Break - removed ODBC support. Fixed UTF-8 support for the pdo_dblib extension. 7/31/10
1.0.0b2Added IBM DB2 support 4/13/10
1.0.0bThe initial implementation 3/2/10

Methods

->__construct() internal public

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 up a prepared statement

Signature

fStatement __construct( fDatabase $database, string $query, array $placeholders, $untranslated_sql, string $untranslated_query )

Parameters

fDatabase $database The database object this result set was created from
string $query The SQL statement to prepare
array $placeholders The data type placeholders
string $untranslated_query The original untranslated SQL, if applicable
$untranslated_sql

->__destruct() internal public

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

Signature

void __destruct( )

->__get() internal public

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

Signature

callback __get( string $method )

Parameters

string $method The method to create a callback for

Returns

The callback for the method requested

->execute() internal public

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

Executes the statement without returning a result

Signature

mixed execute( array $params, mixed &$extra, boolean $different )

Parameters

array $params The parameters for the statement
mixed &$extra A variable to place extra information needed by some database extensions
boolean $different If this statement is different than the last statement run on the fDatabase instance

Returns

The (usually boolean) result of the extension function/method call

->executeQuery() internal public

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

Executes the statement in buffered mode

Signature

void executeQuery( fResult $result, array $params, mixed &$extra, boolean $different )

Parameters

fResult $result The object to place the result into
array $params The parameters for the statement
mixed &$extra A variable to place extra information needed by some database extensions
boolean $different If this statement is different than the last statement run on the fDatabase instance

->executeUnbufferedQuery() internal public

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

Executes the statement in unbuffered mode (if possible)

Signature

void executeUnbufferedQuery( fUnbufferedResult $result, array $params, mixed &$extra, boolean $different )

Parameters

fUnbufferedResult $result The object to place the result into
array $params The parameters for the statement
mixed &$extra A variable to place extra information needed by some database extensions
boolean $different If this statement is different than the last statement run on the fDatabase instance

->getSQL() public

Returns the SQL for the prepared statement

Signature

string getSQL( )

Returns

The SQL statement

->getUntranslatedSQL() public

Returns the untranslated SQL for the prepared statement

Signature

string getUntranslatedSQL( )

Returns

The untranslated SQL statement