Class that contains common/shared functionality for Statements.
This class implements many shared or common methods needed by resultset drivers.
Class that represents a shared code for handling emulated pre-compiled statements.
Classes may wish to extend this so as not to worry about the sleep/wakeup methods, etc.
In reality this class is not very useful yet, so there's not much incentive for drivers to extend this.
Many drivers do not take advantage of pre-compiling SQL statements; for these cases the precompilation is emulated. This emulation comes with slight penalty involved in parsing the queries, but provides other benefits such as a cleaner object model and ability to work with BLOB and CLOB values w/o needing special LOB-specific routines.
This class may (optionally) be extended by driver classes simply to make it easier to create driver classes. This is also useful in the early stages of Creole development as it means that API changes affect fewer files. As Creole matures/stabalizes having a common class may become less useful, as drivers may have their own ways of doing things (and we'll have a solid unit test framework to make sure drivers conform to the API described by the interfaces).
The get*() methods in this class will format values before returning them. Note that if they will return null
if the database returned NULL
which makes these functions easier to use than simply typecasting the values from the db. If the requested column does not exist than an exception (SQLException) will be thrown.
$rs = $conn->executeQuery("SELECT MAX(stamp) FROM event", ResultSet::FETCHMODE_NUM); $rs->next();
$max_stamp = $rs->getTimestamp(1, "d/m/Y H:i:s"); // $max_stamp will be date string or null if no MAX(stamp) was found
$max_stamp = $rs->getTimestamp("max(stamp)", "d/m/Y H:i:s"); // will THROW EXCEPTION, because the resultset was fetched using numeric indexing // SQLException: Invalid resultset column: max(stamp)