Is it possible to run an SQL (Zend_Db_Select) query against a Zend_Db_Table_Row object? What about joining two Zend_Db_Table_Row objects?
I know it sounds a bit retarded, but I'm processing hundreds and thousands of rows. I already have the row object that I'm manipulating, so I don't want to query the db again.
I hope that's clear. If not, please ask me to clarify.
Edit:
To clarify, 开发者_如何学JAVAthe objects are in memory. I've already retrieved them from the database.
The reason for this is:
There are thousands of records in a "log" table. I need to react to these depending on multiple user defined criterion. Time is important when processing these logs. There for a new process is forked to make this happen in a timely manner. A new process is forked for each log. Hence, the objects already exist in memory.
Consider defining the relationships and then calling findDependentRowset() on the Row object:
http://framework.zend.com/manual/en/zend.db.table.relationships.html
The Zend_Db_Table_Row
objects you have are rows, they cannot be queried as they are no longer in the database, they are in memory as part of the ZF. They are a set of data in memory handled by PHP - they no longer have anything to do with the database so they cannot be queried as you are suggesting.
You should use findDependentRowset()
in your models or Zend_Db_Table
class to define the relationships between tables, ZF will then write join statements for you to JOIN
tables together, the joined data will then be in your Zend_Db_Table_Row
objects after you query the datbase.
Or you can use join()
as detailed here to JOIN
two or more tables together. You need to do the joins on the select object you are querying. You need to use the power of the database engine to get the data you need. Doing this in PHP is much much slower then using the datbase.
精彩评论