Prev | Current Page 140 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

com>
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
'username' => 'rob', |
'password' => 'password', |
'dbname' => 'places'); |
$db = Zend_Db::factory('PDO_MYSQL', $params); #2
(annotation) <#1 Database engine specific configuration parameters within an associative array.>
(annotation) <#2 The PDO_MYSQL constant specifies the database engine.>
As every adapter extends Zend_Db_Adapter_Abstract, only functions within the abstract class can be used
if you want database independence. The list of supported databases is quite extensive and includes DB2,
MySQL, Oracle, SQL Server and PostgreSQL. I would expect other databases to be supported over time too,
especially PDO-based ones.
The database adapters use the lazy loading technique to avoid connecting to the database on creation of the
object instance. This means that the even though the adapter object is created using Zend_Db::factory(),
connection to the database doesn??™t actually happen until you do something with that object that requires a
connection. Calling the getConnection() function will also create a connection if there isn??™t one already.
5.1.2 Querying the database
Running an SQL query directly against a database is very simple:
$date = $db->quote('1980-01-01')
$sql = 'SELECT * FROM users WHERE date_of_birth > ' .


Pages:
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
Turcja 1 mimre.benton.pl Biuro księgowe Lublin Fundusze Emerytalne petrozawodzkich.waw.pl