Db/Profiler/Firebug.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Db
- Subpackage
- Profiler
- Version
- $Id: Firebug.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Db_Profiler_Firebug
Writes DB events as log messages to the Firebug Console via FirePHP.
- Parent(s)
- \Zend_Db_Profiler
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants

QUERY
= 2
Any general database query that does not fit into the other constants.
Inherited from: \Zend_Db_Profiler::QUERY- Inherited_from
- \Zend_Db_Profiler::QUERY

INSERT
= 4
Adding new data to the database, such as SQL's INSERT.
Inherited from: \Zend_Db_Profiler::INSERT- Inherited_from
- \Zend_Db_Profiler::INSERT

UPDATE
= 8
Updating existing information in the database, such as SQL's UPDATE.
Inherited from: \Zend_Db_Profiler::UPDATE- Inherited_from
- \Zend_Db_Profiler::UPDATE

DELETE
= 16
An operation related to deleting data in the database, such as SQL's DELETE.
Inherited from: \Zend_Db_Profiler::DELETE- Inherited_from
- \Zend_Db_Profiler::DELETE

SELECT
= 32
Retrieving information from the database, such as SQL's SELECT.
Inherited from: \Zend_Db_Profiler::SELECT- Inherited_from
- \Zend_Db_Profiler::SELECT

TRANSACTION
= 64
Transactional operation, such as start transaction, commit, or rollback.
Inherited from: \Zend_Db_Profiler::TRANSACTION- Inherited_from
- \Zend_Db_Profiler::TRANSACTION

STORED
= 'stored'
Inform that a query is stored (in case of filtering)
Inherited from: \Zend_Db_Profiler::STORED- Inherited_from
- \Zend_Db_Profiler::STORED

IGNORED
= 'ignored'
Inform that a query is ignored (in case of filtering)
Inherited from: \Zend_Db_Profiler::IGNORED- Inherited_from
- \Zend_Db_Profiler::IGNORED
Properties


boolean $_enabled = false
If set to False, calls to queryStart() will simply be ignored.
false
Details- Type
- boolean
- Inherited_from
- \Zend_Db_Profiler::$$_enabled


integer $_filterElapsedSecs = null
Stores the number of seconds to filter.
Inherited from: \Zend_Db_Profiler::$$_filterElapsedSecsNULL if filtering by time is disabled. If an integer is stored here, profiles whose elapsed time is less than this value in seconds will be unset from the self::$_queryProfiles array.
null
Details- Type
- integer
- Inherited_from
- \Zend_Db_Profiler::$$_filterElapsedSecs


integer $_filterTypes = null
Logical OR of any of the filter constants.
Inherited from: \Zend_Db_Profiler::$$_filterTypesNULL if filtering by query type is disable. If an integer is stored here, it is the logical OR of any of the query type constants. When the query ends, if it is not one of the types specified, it will be unset from the self::$_queryProfiles array.
null
Details- Type
- integer
- Inherited_from
- \Zend_Db_Profiler::$$_filterTypes


string $_label_template = '%label% (%totalCount% @ %totalDuration% sec)'
The label template for this profiler
'%label% (%totalCount% @ %totalDuration% sec)'
Details- Type
- string


\Zend_Wildfire_Plugin_FirePhp_TableMessage $_message = null
The message envelope holding the profiling summary
null
Details


array $_queryProfiles = array()
Array of Zend_Db_Profiler_Query objects.
Inherited from: \Zend_Db_Profiler::$$_queryProfilesarray()
Details- Type
- array
- Inherited_from
- \Zend_Db_Profiler::$$_queryProfiles
Methods


__construct(string $label = null) : void
Constructor
The profiler is disabled by default unless it is specifically enabled by passing in $enabled here or calling setEnabled().
Name | Type | Description |
---|---|---|
$label | string | OPTIONAL Label for the profiling info. |


clear() : \Zend_Db_Profiler
This is relentless and will even clear queries that were started and may not have been marked as ended.
Type | Description |
---|---|
\Zend_Db_Profiler | Provides a fluent interface |


getEnabled() : boolean
If True is returned, the profiler is enabled.
Type | Description |
---|---|
boolean |


getFilterElapsedSecs() : integer | null
Returns the minimum number of seconds for saving query profiles, or null if query profiles are saved regardless of elapsed time.
Inherited from: \Zend_Db_Profiler::getFilterElapsedSecs()Type | Description |
---|---|
integer | null |


getFilterQueryType() : integer | null
Returns the types of query profiles saved, or null if queries are saved regardless of their types.
Inherited from: \Zend_Db_Profiler::getFilterQueryType()Type | Description |
---|---|
integer | null |
- See
- \global\Zend_Db_Profiler::setFilterQueryType()


getLastQueryProfile() : \Zend_Db_Profiler_Query | false
Get the Zend_Db_Profiler_Query object for the last query that was run, regardless if it has ended or not.
Inherited from: \Zend_Db_Profiler::getLastQueryProfile()If the query has not ended, its end time will be null. If no queries have been profiled, false is returned.
Type | Description |
---|---|
\Zend_Db_Profiler_Query | false |


getQueryProfile(integer $queryId) : \Zend_Db_Profiler_Query
Pass it the same handle that was returned by queryStart() and it will return a Zend_Db_Profiler_Query object.
Name | Type | Description |
---|---|---|
$queryId | integer |
Type | Description |
---|---|
\Zend_Db_Profiler_Query |
Exception | Description |
---|---|
\Zend_Db_Profiler_Exception |


getQueryProfiles(integer $queryType = null, boolean $showUnfinished = false) : array | false
Get an array of query profiles (Zend_Db_Profiler_Query objects).
Inherited from: \Zend_Db_Profiler::getQueryProfiles()If $queryType is set to one of the Zend_Db_Profiler::* constants then only queries of that type will be returned. Normally, queries that have not yet ended will not be returned unless $showUnfinished is set to True. If no queries were found, False is returned. The returned array is indexed by the query profile handles.
Name | Type | Description |
---|---|---|
$queryType | integer | |
$showUnfinished | boolean |
Type | Description |
---|---|
array | false |


getTotalElapsedSecs(integer $queryType = null) : float
Get the total elapsed time (in seconds) of all of the profiled queries.
Inherited from: \Zend_Db_Profiler::getTotalElapsedSecs()Only queries that have ended will be counted. If $queryType is set to one or more of the Zend_Db_Profiler::* constants, the elapsed time will be calculated only for queries of the given type(s).
Name | Type | Description |
---|---|---|
$queryType | integer | OPTIONAL |
Type | Description |
---|---|
float |


getTotalNumQueries(integer $queryType = null) : integer
Get the total number of queries that have been profiled.
Inherited from: \Zend_Db_Profiler::getTotalNumQueries()Only queries that have ended will be counted. If $queryType is set to one of the Zend_Db_Profiler::* constants, only queries of that type will be counted.
Name | Type | Description |
---|---|---|
$queryType | integer | OPTIONAL |
Type | Description |
---|---|
integer |


queryClone(\Zend_Db_Profiler_Query $query) : integer
Name | Type | Description |
---|---|---|
$query | \Zend_Db_Profiler_Query |
Type | Description |
---|---|
integer | or null |


queryEnd(integer $queryId) : void
Intercept the query end and log the profiling data.
Pass it the handle that was returned by queryStart(). This will mark the query as ended and save the time.
Name | Type | Description |
---|---|---|
$queryId | integer |
Exception | Description |
---|---|
\Zend_Db_Profiler_Exception |


queryStart(string $queryText, integer $queryType = null) : integer | null
Creates a new query profile object (Zend_Db_Profiler_Query) and returns the "query profiler handle". Run the query, then call queryEnd() and pass it this handle to make the query as ended and record the time. If the profiler is not enabled, this takes no action and immediately returns null.
Name | Type | Description |
---|---|---|
$queryText | string | SQL statement |
$queryType | integer | OPTIONAL Type of query, one of the Zend_Db_Profiler::* constants |
Type | Description |
---|---|
integer | null |


setEnabled(boolean $enable) : \Zend_Db_Profiler
Enable or disable the profiler.
If $enable is false, the profiler is disabled and will not log any queries sent to it.
Name | Type | Description |
---|---|---|
$enable | boolean |
Type | Description |
---|---|
\Zend_Db_Profiler | Provides a fluent interface |


setFilterElapsedSecs(integer $minimumSeconds = null) : \Zend_Db_Profiler
Sets a minimum number of seconds for saving query profiles.
Inherited from: \Zend_Db_Profiler::setFilterElapsedSecs()If this is set, only those queries whose elapsed time is equal or greater than $minimumSeconds will be saved. To save all queries regardless of elapsed time, set $minimumSeconds to null.
Name | Type | Description |
---|---|---|
$minimumSeconds | integer | OPTIONAL |
Type | Description |
---|---|
\Zend_Db_Profiler | Provides a fluent interface |


setFilterQueryType(integer $queryTypes = null) : \Zend_Db_Profiler
Sets the types of query profiles to save.
Inherited from: \Zend_Db_Profiler::setFilterQueryType()Set $queryType to one of the Zend_Db_Profiler::* constants to only save profiles for that type of query. To save more than one type, logical OR them together. To save all queries regardless of type, set $queryType to null.
Name | Type | Description |
---|---|---|
$queryTypes | integer | OPTIONAL |
Type | Description |
---|---|
\Zend_Db_Profiler | Provides a fluent interface |