Overview

Namespaces

  • None
  • PHP

Classes

  • AbstractTest
  • AMysql
  • AMysql_Abstract
  • AMysql_Expr
  • AMysql_Iterator
  • AMysql_Profiler
  • AMysql_Select
  • AMysql_Statement
  • AMysql_TestCase
  • ExceptionTest
  • ExprTest
  • IteratorTest
  • SelectTest
  • StatementTest

Exceptions

  • AMysql_Exception
  • Overview
  • Namespace
  • Class
  • Tree

Class AMysql_Profiler

This class is so that you could access the query profile data within your view containing the information on the latest queries without having to pass the entire AMysql object onto the view.

The problem with simply calling $amysql->getQueriesData() is that you may be using a framework that doesn't allow you to set a hook for after resolving the controllers, but before rendering a view. With this class, you can just fetch it by $amysql->getProfiler(), assign it to view, and access the latest profiler data with $profiler['queriesData'] and $profiler['totalTime'].

Enable the profiler by setting the AMysql object's profileQueries proterty to true.

Visit https://github.com/amcsi/amysql

AMysql_Profiler implements ArrayAccess
License: License; http://www.opensource.org/licenses/mit-license.php
Author: Szerémi Attila
Located at AMysql/Profiler.php
Methods summary
public
# __construct( AMysql_Abstract $amysql )
public string
# getAsHtml( )

Gets the profile data as an HTML table with by a template shipped with this library. Can also be called with the help of ArrayAccess via $this['asHtml']

Gets the profile data as an HTML table with by a template shipped with this library. Can also be called with the help of ArrayAccess via $this['asHtml']

Returns

string
public array
# getAsArray( )

Gets the profile data as an array. Can also be called with the help of ArrayAccess via $this['asArray']

Gets the profile data as an array. Can also be called with the help of ArrayAccess via $this['asArray']

Returns

array
public
# offsetExists( mixed $key )

Implementation of

ArrayAccess::offsetExists()
public mixed
# addQuery( string $query, float $queryTime )

Adds a query and a profile for it to the list of queries. Used by AMysql_Statement. Do not call externally!

Adds a query and a profile for it to the list of queries. Used by AMysql_Statement. Do not call externally!

Parameters

$query
string
$query The SQL query.
$queryTime
float
$queryTime The time the query took.

Returns

mixed
$this
public array
# getQueries( )

Gets the list of SQL queries performed so far by AMysql_Statement objects connected by this object.

Gets the list of SQL queries performed so far by AMysql_Statement objects connected by this object.

Returns

array
public array[]
# getQueriesData( )

Returns an arrays of profiled query data. Each value is an array that consists of:
- query - The SQL query performed
- time - The amount of seconds the query took (float)

Returns an arrays of profiled query data. Each value is an array that consists of: - query - The SQL query performed - time - The amount of seconds the query took (float)

If profileQueries wss off at any query, its time value will be null.

Returns

array[]
public
# reset( )

Resets the data in the profiler. Not recommended. Use AMysql_Abstract::useNewProfiler() instead if possible.

Resets the data in the profiler. Not recommended. Use AMysql_Abstract::useNewProfiler() instead if possible.

public
# offsetGet( mixed $key )

Implementation of

ArrayAccess::offsetGet()
public
# offsetSet( mixed $key, mixed $value )

Implementation of

ArrayAccess::offsetSet()
public
# offsetUnset( mixed $key )

Implementation of

ArrayAccess::offsetUnset()
public
# __get( mixed $key )
Properties summary
protected mixed $amysql
#
protected float $totalTime 0.0
#

The total time all the queries have taken so far.

The total time all the queries have taken so far.

protected array $queries array()
#
protected array $queriesData array()
#
API documentation generated by ApiGen 2.8.0