-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDbStatement.php
More file actions
61 lines (52 loc) · 1.28 KB
/
Copy pathDbStatement.php
File metadata and controls
61 lines (52 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* DBStatement class - DBStatement.php file
*
* @author Tyurin D. <fobia3d@gmail.com>
* @copyright Copyright (c) 2013 AC Software
*/
namespace Fobia\DataBase;
use PDOStatement;
use ezcDbHandler;
/**
* DBStatement class
*
* @package Fobia.DataBase
*/
class DbStatement extends PDOStatement
{
const CLASS_NAME = __CLASS__;
/** @var \ezcDbHandler */
protected $connection;
/**
* @internal
*/
protected function __construct(ezcDbHandler $connection)
{
$this->connection = $connection;
}
public function execute(array $input_parameters = null)
{
$time = microtime(true);
if ($input_parameters === null) {
$query = parent::execute();
} else {
$query = parent::execute($input_parameters);
}
if (method_exists($this->connection, 'log')) {
$logger = $this->connection->log($this, $time);
if ($input_parameters) {
// $logger = $this->connection->getLogger();
$logger->debug('[SQL]:: ==> execute parameters: ', array_values($input_parameters));
}
}
return $query;
}
/**
* @internal
*/
public function __destruct()
{
$this->closeCursor();
}
}