List Info

Thread: Oversight in Zend_Db?




Oversight in Zend_Db?
user name
2006-07-31 18:35:53
I cannot seem to locate a method that will return the number of rows returned by a select statement or ->query without actually fetching the data.
 
Its a common performance trick to see if a record exists to use a query like select 1 from table where predicate and then simply check the num_rows property. From the libpq c api this is exceedingly easy info to get your hands on; but for some reason I cant find it implemented. Using this method, you dont have to initialize any of the data fetching infrastructure all the way back through libpq->pdo->zend etc....
 
 
The manual suggestion to fetchAll and count seems somewhat wrong to me seeing as the it will initialize a few thousand lines of code that are totally useless to the result.
 
This also translates to the php function pg_num_rows (pg_affected_rows is implemented via PDOStatement::rowCount)....
 
Anyone have a solution?
 
Kevin
 
 
 
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )