1 | <?php |
||
23 | abstract class DBDriverAbstract implements DBDriverInterface{ |
||
24 | |||
25 | /** |
||
26 | * Holds the database resource object |
||
27 | * |
||
28 | * @var resource |
||
29 | */ |
||
30 | protected $db; |
||
31 | |||
32 | /** |
||
33 | * Holds the settings |
||
34 | * |
||
35 | * @var \chillerlan\Database\DBOptions |
||
36 | */ |
||
37 | protected $options; |
||
38 | |||
39 | /** |
||
40 | * Holds an array of Querystats objects |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $stats = []; |
||
45 | |||
46 | /** |
||
47 | * Indicates wether query stats are being recorded or not. |
||
48 | * false by default |
||
49 | * |
||
50 | * @var bool |
||
51 | */ |
||
52 | protected $stats_enabled = false; |
||
53 | |||
54 | /** |
||
55 | * Constructor. |
||
56 | * |
||
57 | * @param \chillerlan\Database\DBOptions $options |
||
58 | */ |
||
59 | public function __construct(DBOptions $options){ |
||
62 | |||
63 | /** |
||
64 | * Returns the plain connection object |
||
65 | * |
||
66 | * @return resource the database resource object |
||
67 | */ |
||
68 | public function getDBResource(){ |
||
71 | |||
72 | /** |
||
73 | * Returns the stats array |
||
74 | * |
||
75 | * @return array stats |
||
76 | */ |
||
77 | public function getStats(){ |
||
80 | |||
81 | /** |
||
82 | * Enables query stat recording |
||
83 | * |
||
84 | * @return $this |
||
85 | */ |
||
86 | public function enableStats(){ |
||
91 | |||
92 | /** |
||
93 | * Disables query stat recording |
||
94 | * |
||
95 | * @return $this |
||
96 | */ |
||
97 | public function disableStats(){ |
||
102 | |||
103 | /** |
||
104 | * Clears the stats array |
||
105 | * |
||
106 | * @return $this |
||
107 | */ |
||
108 | public function clearStats(){ |
||
113 | |||
114 | /** |
||
115 | * Adds a new Querystats object to self::$_stats |
||
116 | * |
||
117 | * @param array $stats |
||
118 | */ |
||
119 | public function addStats(array $stats){ |
||
132 | |||
133 | } |
||
134 |