You are here

public function ApdqcFakeDatabaseStatement::__construct in Asynchronous Prefetch Database Query Cache 7

Constructs a DrupalDatabaseCache object.

Parameters

string $query_string: The query string.

string $extra_data: Extra data about the query; cache hit/miss, etc.

File

./apdqc.log.inc, line 24
Creates a fake db statement for devel query logging.

Class

ApdqcFakeDatabaseStatement
Fake database statement class for devel logging.

Code

public function __construct($query_string, $extra_data = '') {
  $dbh = new ApdqcFakeDbh();
  $this->dbh = $dbh;
  $timestamp = '';
  if (!empty($_SERVER['REQUEST_TIME_FLOAT'])) {
    $timestamp = ' at ' . round(microtime(TRUE) - $_SERVER['REQUEST_TIME_FLOAT'], 5) * 1000 . 'ms';
  }
  $query_string = '/* ' . $extra_data . $this
    ->findCallerfunction() . $timestamp . ' */ ' . $query_string;
  $this->queryString = $query_string;
}