2010年6月23日星期三

RE: [fw-db] how to use zend db with joins

> -----Oorspronkelijk bericht-----
> Van: Timmo Henseler [mailto:timmo.henseler@gmail.com]
>
> Jeroen, thanks, yes this helps a lot. when i use raw queries for update
> can I then just assume that the database connection is still there (I
> read something about lazy connections) or do I have to approach the
> database with regular mysqli? Is it good practice to mix zend db code
> with raw php/mysqli for the same model/database?

Lazy connecting means that Zend_Db_Adapter will not connect until you do an
actual query. It stores the connection details until they are needed. This
has the advantage that you can setup your adapter before you even know if
you need it. Lazy connection will not drop connections or something like
that.

I think mixing ZF and 'raw' PHP functions is something to avoid, although it
is perfectly possible. Zend_Db_Adapter even provides a getConnection()
method that will get the native connection resource for you. (The underlying
MySQLi object probably.) The connection is initiated if it wasn't already.

Vincent de Lau
vincent@delau.nl

没有评论: