[fw-general] Lazy loading of Zend DB

2009-08-14 Thread Ryan Chan
Hello,


I followed the tutorial at:
http://framework.zend.com/docs/quickstart/create-a-model-and-database-table

However, I am using pdo_mysql.

It seems that if I put db setting,

 resources.db.adapter   = xxx


 in the application.ini config, even my controller action don't need
the database query, the zfw still need to create connection to the DB?

Is it possible to connect only if needed?


Thanks.


Re: [fw-general] Lazy loading of Zend DB

2009-08-14 Thread Uli Wolf

Afaik Zend_Db is doing exactly what you want:

http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.connecting.getconnection

Creating an instance of an Adapter class does not immediately connect 
to the RDBMS server. The Adapter saves the connection parameters, and 
makes the actual connection on demand, the first time you need to 
execute a query.


Hope this helps,
Uli


Ryan Chan wrote:

Hello,


I followed the tutorial at:
http://framework.zend.com/docs/quickstart/create-a-model-and-database-table

However, I am using pdo_mysql.

It seems that if I put db setting,


resources.db.adapter   = xxx



 in the application.ini config, even my controller action don't need
the database query, the zfw still need to create connection to the DB?

Is it possible to connect only if needed?


Thanks.