There might be cases in which you need to access the connection
object directly, as provided by the PHP database extension. Some
of these extensions may offer features that are not surfaced by
For example, all SQL statements run by
are prepared, then executed. However, some database features are incompatible with
DDL statements like
ALTER cannot be prepared in MySQL.
Also, SQL statements don't benefit from the MySQL Query
Cache, prior to MySQL 5.1.17.
Most PHP database extensions provide a method to execute
SQL statements without preparing them. For example, in
PDO, this method is
exec(). You can access
the connection object in the PHP extension directly using
Example 219. Running a Non-Prepared Statement in a PDO Adapter
$result = $db->getConnection()->exec('DROP TABLE bugs');
Similarly, you can access other methods or properties that are specific to PHP database extensions. Be aware, though, that by doing this you might constrain your application to the interface provided by the extension for a specific brand of RDBMS.
In future versions of
Zend_Db, there will be opportunities to
add method entry points for functionality that is common to
the supported PHP database extensions. This will not affect