1 | <?php |
||
9 | class DatabaseDebug extends Database |
||
10 | { |
||
11 | /** |
||
12 | * @var integer $numQueries count all queries made |
||
13 | * @var array $queries save all queries for debugging |
||
14 | * @var array $params Save all parameters for debugging |
||
15 | */ |
||
16 | private static $numQueries = 0; |
||
17 | private static $queries = []; |
||
18 | private static $params = []; |
||
19 | |||
20 | |||
21 | |||
22 | /** |
||
23 | * Connect to the database. |
||
24 | * |
||
25 | * @return self |
||
26 | */ |
||
27 | public function connect() |
||
36 | |||
37 | |||
38 | |||
39 | /** |
||
40 | * Load query-history from session if available. |
||
41 | * |
||
42 | * @return int number of database queries made. |
||
43 | */ |
||
44 | public function loadHistory() |
||
54 | |||
55 | |||
56 | |||
57 | /** |
||
58 | * Save query-history in session, useful as a flashmemory when redirecting to another page. |
||
59 | * |
||
60 | * @param string $extra enables to save some extra debug information. |
||
61 | * |
||
62 | * @return void |
||
63 | */ |
||
64 | public function saveHistory($extra = null) |
||
79 | |||
80 | |||
81 | |||
82 | /** |
||
83 | * Get how many queries have been processed. |
||
84 | * |
||
85 | * @return int number of database queries made. |
||
86 | */ |
||
87 | public function getNumQueries() |
||
91 | |||
92 | |||
93 | |||
94 | /** |
||
95 | * Get all the queries that have been processed. |
||
96 | * |
||
97 | * @return array with queries. |
||
98 | */ |
||
99 | public function getQueries() |
||
103 | |||
104 | |||
105 | |||
106 | /** |
||
107 | * Get a HTML representation of all queries made, for debugging |
||
108 | * and analysing purpose. |
||
109 | * |
||
110 | * @return string with HTML. |
||
111 | */ |
||
112 | public function dump() |
||
125 | |||
126 | |||
127 | |||
128 | /** |
||
129 | * Execute a SQL-query and ignore the resultset. |
||
130 | * |
||
131 | * @param string $query the SQL statement |
||
132 | * @param array $params the params array |
||
133 | * |
||
134 | * @throws Exception when failing to prepare question. |
||
135 | * |
||
136 | * @return boolean returns TRUE on success or FALSE on failure. |
||
137 | */ |
||
138 | public function execute($query, $params = []) |
||
158 | } |
||
159 |
This check looks for access to properties that are not accessible from the current context.
If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.