i think the zend_db_profiler is the right solution
On 11/26/09, Саша Стаменковић <umpirsky@gmail.com> wrote:
> Yaroslav Vorozhko mensioned profiler, if you really want to count queries.
>
> If you want to count rows:
>
> $paginator = new Zend_Paginator(
> new Zend_Paginator_Adapter_DbTableSelect(
> new Zend_Db_Table_Select(...)
> )
> );
> $paginator->setDefaultItemCountPerPage(1);
> return $paginator->count();
>
> Regards,
> Saša Stamenković
>
>
> On Thu, Nov 26, 2009 at 1:50 PM, <Christoph@vonaffenfels.de> wrote:
>
>> Sorry, but you only have limited possibilities:
>>
>> - count the total amount of rows in a table
>> - count the amount of rows in rowset after an executed sql query
>> - count all executed queries which have been executed (profiler)
>>
>> If you want to retrieve the amount of all rows in all executed queries,
>> you
>> need to build your own profiler...
>>
>> What you have to do is to overwrite the Zend_Db_Adapter_Abstract class and
>> implement a counter for the following methods:
>>
>> - fetchAll
>> - fetchAssoc
>> - fetchCol
>> - fetchOne
>> - fetchPairs
>> - fetchRow
>>
>> If you need to count insert-, update- and delete statemens (the amount of
>> it) as well, you should also overwrite the following in
>> Zend_Db_Adapter_Abstract:
>>
>> - delete
>> - insert
>> - update
>>
>> Am 26.11.2009 13:39, schrieb Yaroslav Vorozhko:
>>
>> sina miandashti wrote:
>>>
>>>
>>>> hi
>>>>
>>>> i need a solution for counting total sql queries in a page ...
>>>>
>>>> plz help
>>>>
>>>> thanks
>>>>
>>>>
>>>>
>>>>
>>> Hi,
>>> Look at Zend_Db_Profiler :
>>>
>>> |$profiler = $db->getProfiler();
>>> ||$queryCount = $profiler->getTotalNumQueries();
>>>
>>> --
>>> Thanks Yaroslav Vorozhko
>>> Blog: http://pro100pro.com
>>> LinkedIn: http://www.linkedin.com/in/vorozhko
>>> |
>>>
>>>
>>>
>>>
>>
>> --
>> ------------------------------------------------------------
>>
>>
>> Christoph Rust
>> Senior Software Developer
>>
>> von Affenfels GmbH
>> Kronenstraße 40
>> D-70174 Stuttgart
>>
>> Telefon +49 (0) 711 305 890-36
>> Telefax +49 (0) 711 305 890-90
>> http://www.vonaffenfels.de | christoph.rust@vonaffenfels.de
>>
>> Sitz der Gesellschaft: Stuttgart
>> Handelsregister Stuttgart HRB 728101
>>
>> Geschäftsführer: Christian Jehle, Jürgen Knispel
>>
>>
>
--
________________
Sincerely
Sina Miandashti
MuSicBasE.ir & InvisionPower.ir Admin
没有评论:
发表评论