at 2009-06-09
in Databases, Announcements
by friebe
(0 comments)
The rdbms.DriverManager class has been changed to only support drivers when the required extension is available. This changes fatal errors to exceptions in the following use-case:
<?php $conn= DriverManager::getConnection('mysql://localhost')->connect(); ?> Before (assuming ext/mysql is not loaded), this would print Fatal error: Call to undefined function mysql_connect(), now it raises an exception:
Exception rdbms.DriverNotSupportedException (No driver registered for mysql - is the library loaded?) at rdbms.DriverManager::getConnection((0x11)'mysql://localhost') [...] at ...
This also makes possible a more flexible model of mapping extensions and implementations to driver names, e.g. if "mssql" is loaded but "sybase_ct" isn't, we could still provide the "sybase" driver (but base it on the mssql implementation rdbms.mssql.MssqlConnection instead). Same goes for PDO vs. native extensions or even mysqli, mysqlnd and friends.
|
Subscribe
You can subscribe to the XP framework's news by using RSS syndication.
CategoriesNews General PHP5 Announcements RFCs Further reading Examples Editorial EASC Experiments Unittests Databases 5.8-SERIES
RelatedFind related articles by a search for «rdbms.DriverManager».
|