Db/Profiler.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Db
- Subpackage
- Profiler
- Version
- $Id$
\Zend_Db_Profiler
- Children
- \Zend_Db_Profiler_Firebug
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties

boolean $_enabled = falsefalseDetails- Type
- boolean

integer $_filterElapsedSecs = nullnullDetails- Type
- integer

integer $_filterTypes = nullnullDetails- Type
- integer
Methods

__construct(boolean $enabled = false) : voidClass constructor. The profiler is disabled by default unless it is specifically enabled by passing in $enabled here or calling setEnabled().
| Name | Type | Description |
|---|---|---|
| $enabled | boolean |

clear() : \Zend_Db_ProfilerClears the history of any past query profiles. 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() : booleanGet the current state of enable. If True is returned, the profiler is enabled.
| Type | Description |
|---|---|
| boolean |

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

getFilterQueryType() : integer | nullReturns the types of query profiles saved, or null if queries are saved regardless of their types.

getLastQueryProfile() : \Zend_Db_Profiler_Query | falseGet the Zend_Db_Profiler_Query object for the last query that was run, regardless if it has ended or not. 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_QueryGet a profile for a 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 | falseGet an array of query profiles (Zend_Db_Profiler_Query objects). 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) : floatGet the total elapsed time (in seconds) of all of the profiled queries.
| Name | Type | Description |
|---|---|---|
| $queryType | integer | OPTIONAL |
| Type | Description |
|---|---|
| float |

getTotalNumQueries(integer $queryType = null) : integerGet the total number of queries that have been profiled. 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) : integerClone a profiler query
| Name | Type | Description |
|---|---|---|
| $query | \Zend_Db_Profiler_Query |
| Type | Description |
|---|---|
| integer | or null |

queryEnd(integer $queryId) : stringEnds a query. Pass it the handle that was returned by queryStart().
| Name | Type | Description |
|---|---|---|
| $queryId | integer |
| Type | Description |
|---|---|
| string | Inform that a query is stored or ignored. |
| Exception | Description |
|---|---|
| \Zend_Db_Profiler_Exception |

queryStart(string $queryText, integer $queryType = null) : integer | nullStarts a query. 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_ProfilerEnable 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_ProfilerSets a minimum number of seconds for saving query profiles. 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_ProfilerSets the types of query profiles to save. 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 |