155. public function __construct(array $config = [])
156. {
157. $this->defaultConfig = Config::default('ZN\Database\DatabaseDefaultConfiguration')
158. ::get('Database', 'database');
159. $this->config = array_merge($this->defaultConfig, $config);
160. $this->db = $this->runDriver();
161. $this->prefix = $this->config['prefix'];
162. Properties::$prefix = $this->prefix;
163.
164. $this->db->connect($this->config);
165. }
166.
167. /**
168. * Magic Debug Info
169. */
170. public function __debugInfo()
171. {
172. return ['return' => $this->stringQuery ?: 'This is a general object, please call the sub method!'];
173. }
174.
1346. */
1347. public function query(string $query, array $secure = [])
1348. {
1349. $secure = $this->secure ?: $secure; $this->secure = [];
1350. $caching = $this->caching; $this->caching = [];
1351. $tableName = $this->tableName; $this->tableName = '';
1352. $jsonDecode = $this->jsonDecode; $this->jsonDecode = [];
1353. $paging = $this->paging;
1354.
1355. return (new self($this->config))->setQueryByDriver($query, $secure,
1356. [
1357. 'caching' => $caching,
1358. 'tableName' => $tableName,
1359. 'jsonDecode' => $jsonDecode,
1360. 'paging' => $paging
1361. ]);
1362. }
1363.
1364. /**
1365. * Exec Basic Query
226. $categories_sql = "SELECT cb.id, cb.name, cb.name_alias, cb.target, COUNT(cc.id) - 1 AS depth ";
227. $categories_sql .= 'FROM category_list cl ';
228. $categories_sql .= " LEFT JOIN category ca ON ca.id = cl.category_id ";
229. $categories_sql .= " LEFT JOIN category cb ON cb.lft BETWEEN ca.lft AND ca.rgt ";
230. $categories_sql .= " LEFT JOIN category cc ON cb.lft BETWEEN cc.lft AND cc.rgt ";
231. $categories_sql .= ( !empty( $where ) ) ? 'WHERE ' . implode( ' AND ', $where ) . ' ' : null;
232.
233. $categories_sql .= 'GROUP BY cb.lft ';
234. $categories_sql .= 'ORDER BY cl.position, cb.lft ';
235. $categories = DB::query( $categories_sql );
236.
237. //output(DB::stringQuery() ); exit;
238. //output($categories->result());exit;
239.
240. $output = null;
241. $last_depth = 0;
242. $categories_result = $categories->result();
243.
244. foreach ( $categories_result as $index => $category )
245. {
192.
193. echo $header;
194.
195. $randomPageVariable = $head['bodyPage'] ?? $masterPageSet['bodyPage'];
196.
197. if( ! empty($randomPageVariable) )
198. {
199. $randomDataVariable['view'] = $bodyContent;
200.
201. View::use($randomPageVariable, $randomDataVariable, false, $viewDirectory);
202. }
203. else
204. {
205. echo $bodyContent; // @codeCoverageIgnore
206. }
207.
208. $randomFooterVariable = EOL.'
'.EOL; 209. $randomFooterVariable .= '