creole Namespace Reference

Interface for callable statements. More...


Namespaces

namespace  common
 Class that contains some shared/default information for connections.
namespace  drivers
namespace  metadata
 Represents a Column.
namespace  util
 A class for handling binary LOBs.


Detailed Description

Interface for callable statements.

Class that represents a SQL statement.

A class for handling database-related errors.

Basic ResultSet Iterator.

This is the interface for classes the wrap db results.

Interface for a pre-compiled SQL statement.

Interface for classes that provide functionality to get SEQUENCE or AUTO-INCREMENT ids from the database.

Generic Creole types modeled on JDBC types.

This is the class that manages the database drivers.

Connection is an abstract base class for DB dialect implementations, and must be inherited by all such.

Author:
Hans Lellelid <hans@xmpl.org>
Version:
Revision
1.7

Developer notes: (1) Make sure that your Connection class can be serialized. See the ConnectionCommon __sleep() and __wakeup() implimentation.

Author:
Hans Lellelid <hans@xmpl.org>
Version:
Revision
1.29

There are a number of default drivers (at the time of writing this comment: MySQL, MSSQL, SQLite, PgSQL, Oracle) that are "shipped" with Creole. You may wish to either add a new driver or swap out one of the existing drivers for your own custom driver. To do this you simply need to register your driver using the registerDriver() method.

Note that you register your Connection class because the Connection class is responsible for calling the other driver classes (e.g. ResultSet, PreparedStatement, etc.).

Author:
Hans Lellelid <hans@xmpl.org>
Version:
Revision
1.14

Author:
David Giffin <david@giffin.org>

Hans Lellelid <hans@xmpl.org>

Version:
Revision
1.18

Author:
Hans Lellelid <hans@xmpl.org>
Version:
Revision
1.3

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 is abstract because there are driver-specific implementations in [clearly] how queries are executed, and how parameters are bound.

This class is not as abstract as the JDBC version. For exmple, if you are using a driver that uses name-based query param substitution, then you'd better bind your variables to names rather than index numbers. e.g. in Oracle $stmt = $conn->prepareStatement("INSERT INTO users (name, passwd) VALUES (:name, :pass)"); $stmt->setString(":name", $name); $stmt->executeUpdate();

Developer note: In many ways this interface is an extension of the Statement interface. However, due to limitations in PHP5's interface extension model (specifically that you cannot change signatures on methods defined in parent interface), we cannot extend the Statement interface.

Author:
Hans Lellelid <hans@xmpl.org>
Version:
Revision
1.21

The get*() methods in this interface will format values before returning them. Note that if they will return null if the database returned NULL. 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)

This class implements SPL IteratorAggregate, so you may iterate over the database results using foreach(): foreach($rs as $row) { print_r($row); // row is assoc array returned by getRow() }

Author:
Hans Lellelid <hans@xmpl.org>
Version:
Revision
1.28

This can be returned by your class's getIterator() method, but of course you can also implement your own (e.g. to get better performance, by using direct driver calls and avoiding other side-effects inherent in ResultSet scrolling functions -- e.g. beforeFirst() / afterLast(), etc.).

Important: ResultSet iteration does rewind the resultset if it is not at the start. Not all drivers support reverse scrolling, so this may result in an exception in some cases (Oracle).

Developer note: The implementation of this class is a little weird because it fetches the array _early_ in order to answer valid() w/o needing to know total num of fields. Remember the way iterators work: $it = $obj->getIterator(); for($it->rewind(); $it->valid(); $it->next()) { $key = $it->current(); $val = $it->key(); echo "$key = $val\n"; } unset($it);

Author:
Hans Lellelid <hans@xmpl.org>
Version:
Revision
1.3

Author:
Hans Lellelid <hans@xmpl.org>
Version:
Revision
1.10

This class is very generic and has no driver-specific implementations. In fact, it wouldn't be possible to have driver-specific classes, since PHP doesn't support multiple inheritance. I.e. you couldn't have MySQLPreparedStatement that extended both the abstract PreparedStatement class and the MySQLStatement class. In Java this isn't a concern since PreparedStatement is an interface, not a class.

Author:
Hans Lellelid <hans@xmpl.org>
Version:
Revision
1.17


Generated on Wed May 6 23:10:50 2009 for fareofficelib by  doxygen 1.5.8