@@ -13,8 +13,7 @@ |
||
13 | 13 | * |
14 | 14 | * @package MyDb |
15 | 15 | */ |
16 | -interface Db_Interface |
|
17 | -{ |
|
16 | +interface Db_Interface { |
|
18 | 17 | |
19 | 18 | /** |
20 | 19 | * Db_Interface constructor. |
@@ -17,8 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @access public |
19 | 19 | */ |
20 | -class Db extends Generic implements Db_Interface |
|
21 | -{ |
|
20 | +class Db extends Generic implements Db_Interface { |
|
22 | 21 | public $driver = 'mysql'; |
23 | 22 | public $Rows = []; |
24 | 23 | public $type = 'adodb'; |
@@ -32,8 +31,7 @@ discard block |
||
32 | 31 | * @param string $driver |
33 | 32 | * @return bool|\the |
34 | 33 | */ |
35 | - public function connect($database = '', $host = '', $user = '', $password = '', $driver = 'mysql') |
|
36 | - { |
|
34 | + public function connect($database = '', $host = '', $user = '', $password = '', $driver = 'mysql') { |
|
37 | 35 | /* Handle defaults */ |
38 | 36 | if ('' == $database) { |
39 | 37 | $database = $this->database; |
@@ -64,16 +62,14 @@ discard block |
||
64 | 62 | * Db::disconnect() |
65 | 63 | * @return void |
66 | 64 | */ |
67 | - public function disconnect() |
|
68 | - { |
|
65 | + public function disconnect() { |
|
69 | 66 | } |
70 | 67 | |
71 | 68 | /** |
72 | 69 | * @param $string |
73 | 70 | * @return string |
74 | 71 | */ |
75 | - public function real_escape($string = '') |
|
76 | - { |
|
72 | + public function real_escape($string = '') { |
|
77 | 73 | return escapeshellarg($string); |
78 | 74 | } |
79 | 75 | |
@@ -81,8 +77,7 @@ discard block |
||
81 | 77 | * discard the query result |
82 | 78 | * @return void |
83 | 79 | */ |
84 | - public function free() |
|
85 | - { |
|
80 | + public function free() { |
|
86 | 81 | // @mysql_free_result($this->queryId); |
87 | 82 | // $this->queryId = 0; |
88 | 83 | } |
@@ -98,8 +93,7 @@ discard block |
||
98 | 93 | * @param string $file optionally pass __FILE__ calling the query for logging |
99 | 94 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
100 | 95 | */ |
101 | - public function queryReturn($query, $line = '', $file = '') |
|
102 | - { |
|
96 | + public function queryReturn($query, $line = '', $file = '') { |
|
103 | 97 | $this->query($query, $line, $file); |
104 | 98 | if ($this->num_rows() == 0) { |
105 | 99 | return false; |
@@ -125,8 +119,7 @@ discard block |
||
125 | 119 | * @param string $file optionally pass __FILE__ calling the query for logging |
126 | 120 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
127 | 121 | */ |
128 | - public function qr($query, $line = '', $file = '') |
|
129 | - { |
|
122 | + public function qr($query, $line = '', $file = '') { |
|
130 | 123 | return $this->queryReturn($query, $line, $file); |
131 | 124 | } |
132 | 125 | |
@@ -140,8 +133,7 @@ discard block |
||
140 | 133 | * @param string $file |
141 | 134 | * @return mixed 0 if no query or query id handler, safe to ignore this return |
142 | 135 | */ |
143 | - public function query($queryString, $line = '', $file = '') |
|
144 | - { |
|
136 | + public function query($queryString, $line = '', $file = '') { |
|
145 | 137 | /* No empty queries, please, since PHP4 chokes on them. */ |
146 | 138 | /* The empty query string is passed on from the constructor, |
147 | 139 | * when calling the class without a query, e.g. in situations |
@@ -184,8 +176,7 @@ discard block |
||
184 | 176 | * @param mixed $resultType |
185 | 177 | * @return bool |
186 | 178 | */ |
187 | - public function next_record($resultType = MYSQL_ASSOC) |
|
188 | - { |
|
179 | + public function next_record($resultType = MYSQL_ASSOC) { |
|
189 | 180 | if (!$this->queryId) { |
190 | 181 | $this->halt('next_record called with no query pending.'); |
191 | 182 | return 0; |
@@ -206,8 +197,7 @@ discard block |
||
206 | 197 | * @param integer $pos |
207 | 198 | * @return int |
208 | 199 | */ |
209 | - public function seek($pos = 0) |
|
210 | - { |
|
200 | + public function seek($pos = 0) { |
|
211 | 201 | if (isset($this->Rows[$pos])) { |
212 | 202 | $this->Row = $pos; |
213 | 203 | } else { |
@@ -225,8 +215,7 @@ discard block |
||
225 | 215 | * Db::transactionBegin() |
226 | 216 | * @return bool |
227 | 217 | */ |
228 | - public function transactionBegin() |
|
229 | - { |
|
218 | + public function transactionBegin() { |
|
230 | 219 | return true; |
231 | 220 | } |
232 | 221 | |
@@ -234,8 +223,7 @@ discard block |
||
234 | 223 | * Db::transactionCommit() |
235 | 224 | * @return bool |
236 | 225 | */ |
237 | - public function transactionCommit() |
|
238 | - { |
|
226 | + public function transactionCommit() { |
|
239 | 227 | return true; |
240 | 228 | } |
241 | 229 | |
@@ -243,8 +231,7 @@ discard block |
||
243 | 231 | * Db::transactionAbort() |
244 | 232 | * @return bool |
245 | 233 | */ |
246 | - public function transactionAbort() |
|
247 | - { |
|
234 | + public function transactionAbort() { |
|
248 | 235 | return true; |
249 | 236 | } |
250 | 237 | |
@@ -255,8 +242,7 @@ discard block |
||
255 | 242 | * @param mixed $field |
256 | 243 | * @return mixed |
257 | 244 | */ |
258 | - public function getLastInsertId($table, $field) |
|
259 | - { |
|
245 | + public function getLastInsertId($table, $field) { |
|
260 | 246 | return $this->linkId->Insert_ID($table, $field); |
261 | 247 | } |
262 | 248 | |
@@ -268,8 +254,7 @@ discard block |
||
268 | 254 | * @param string $mode |
269 | 255 | * @return void |
270 | 256 | */ |
271 | - public function lock($table, $mode = 'write') |
|
272 | - { |
|
257 | + public function lock($table, $mode = 'write') { |
|
273 | 258 | /* $this->connect(); |
274 | 259 | |
275 | 260 | * $query = "lock tables "; |
@@ -306,8 +291,7 @@ discard block |
||
306 | 291 | * Db::unlock() |
307 | 292 | * @return void |
308 | 293 | */ |
309 | - public function unlock() |
|
310 | - { |
|
294 | + public function unlock() { |
|
311 | 295 | /* $this->connect(); |
312 | 296 | |
313 | 297 | * $res = @mysql_query("unlock tables"); |
@@ -327,8 +311,7 @@ discard block |
||
327 | 311 | * |
328 | 312 | * @return mixed |
329 | 313 | */ |
330 | - public function affectedRows() |
|
331 | - { |
|
314 | + public function affectedRows() { |
|
332 | 315 | return @$this->linkId->Affected_Rows(); |
333 | 316 | // return @$this->queryId->rowCount(); |
334 | 317 | } |
@@ -338,8 +321,7 @@ discard block |
||
338 | 321 | * |
339 | 322 | * @return mixed |
340 | 323 | */ |
341 | - public function num_rows() |
|
342 | - { |
|
324 | + public function num_rows() { |
|
343 | 325 | return $this->queryId->NumRows(); |
344 | 326 | } |
345 | 327 | |
@@ -348,8 +330,7 @@ discard block |
||
348 | 330 | * |
349 | 331 | * @return mixed |
350 | 332 | */ |
351 | - public function num_fields() |
|
352 | - { |
|
333 | + public function num_fields() { |
|
353 | 334 | return $this->queryId->NumCols(); |
354 | 335 | } |
355 | 336 | |
@@ -359,8 +340,7 @@ discard block |
||
359 | 340 | * @param string $file |
360 | 341 | * @return mixed|void |
361 | 342 | */ |
362 | - public function haltmsg($msg, $line = '', $file = '') |
|
363 | - { |
|
343 | + public function haltmsg($msg, $line = '', $file = '') { |
|
364 | 344 | $this->log("Database error: $msg", $line, $file, 'error'); |
365 | 345 | if ($this->linkId->ErrorNo() != '0' && $this->linkId->ErrorMsg() != '') { |
366 | 346 | $this->log('ADOdb SQL Error: '.$this->linkId->ErrorMsg(), $line, $file, 'error'); |
@@ -373,8 +353,7 @@ discard block |
||
373 | 353 | * |
374 | 354 | * @return array |
375 | 355 | */ |
376 | - public function tableNames() |
|
377 | - { |
|
356 | + public function tableNames() { |
|
378 | 357 | $return = []; |
379 | 358 | $this->query('SHOW TABLES'); |
380 | 359 | $i = 0; |
@@ -18,8 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @access public |
20 | 20 | */ |
21 | -class Db extends Generic implements Db_Interface |
|
22 | -{ |
|
21 | +class Db extends Generic implements Db_Interface { |
|
23 | 22 | /* public: connection parameters */ |
24 | 23 | public $driver = 'mysql'; |
25 | 24 | public $Rows = []; |
@@ -32,8 +31,7 @@ discard block |
||
32 | 31 | * @param string $database the name of the database to use |
33 | 32 | * @return void |
34 | 33 | */ |
35 | - public function selectDb($database) |
|
36 | - { |
|
34 | + public function selectDb($database) { |
|
37 | 35 | $dSN = "{$this->driver}:dbname={$database};host={$this->host}"; |
38 | 36 | if ($this->characterSet != '') { |
39 | 37 | $dSN .= ';charset='.$this->characterSet; |
@@ -49,8 +47,7 @@ discard block |
||
49 | 47 | * @param string $database the name of the database to use |
50 | 48 | * @return void |
51 | 49 | */ |
52 | - public function useDb($database) |
|
53 | - { |
|
50 | + public function useDb($database) { |
|
54 | 51 | $this->selectDb($database); |
55 | 52 | } |
56 | 53 | |
@@ -65,8 +62,7 @@ discard block |
||
65 | 62 | * @param string $driver |
66 | 63 | * @return bool|int|PDO |
67 | 64 | */ |
68 | - public function connect($database = '', $host = '', $user = '', $password = '', $driver = 'mysql') |
|
69 | - { |
|
65 | + public function connect($database = '', $host = '', $user = '', $password = '', $driver = 'mysql') { |
|
70 | 66 | /* Handle defaults */ |
71 | 67 | if ('' == $database) { |
72 | 68 | $database = $this->database; |
@@ -105,8 +101,7 @@ discard block |
||
105 | 101 | * Db::disconnect() |
106 | 102 | * @return void |
107 | 103 | */ |
108 | - public function disconnect() |
|
109 | - { |
|
104 | + public function disconnect() { |
|
110 | 105 | } |
111 | 106 | |
112 | 107 | /* public: discard the query result */ |
@@ -115,8 +110,7 @@ discard block |
||
115 | 110 | * Db::free() |
116 | 111 | * @return void |
117 | 112 | */ |
118 | - public function free() |
|
119 | - { |
|
113 | + public function free() { |
|
120 | 114 | // @mysql_free_result($this->queryId); |
121 | 115 | // $this->queryId = 0; |
122 | 116 | } |
@@ -131,8 +125,7 @@ discard block |
||
131 | 125 | * @param string $file |
132 | 126 | * @return mixed 0 if no query or query id handler, safe to ignore this return |
133 | 127 | */ |
134 | - public function query($queryString, $line = '', $file = '') |
|
135 | - { |
|
128 | + public function query($queryString, $line = '', $file = '') { |
|
136 | 129 | /* No empty queries, please, since PHP4 chokes on them. */ |
137 | 130 | /* The empty query string is passed on from the constructor, |
138 | 131 | * when calling the class without a query, e.g. in situations |
@@ -177,8 +170,7 @@ discard block |
||
177 | 170 | * @param mixed $resultType |
178 | 171 | * @return bool |
179 | 172 | */ |
180 | - public function next_record($resultType = MYSQLI_ASSOC) |
|
181 | - { |
|
173 | + public function next_record($resultType = MYSQLI_ASSOC) { |
|
182 | 174 | // PDO result types so far seem to be +1 |
183 | 175 | ++$resultType; |
184 | 176 | if (!$this->queryId) { |
@@ -203,8 +195,7 @@ discard block |
||
203 | 195 | * @param integer $pos |
204 | 196 | * @return int |
205 | 197 | */ |
206 | - public function seek($pos = 0) |
|
207 | - { |
|
198 | + public function seek($pos = 0) { |
|
208 | 199 | if (isset($this->Rows[$pos])) { |
209 | 200 | $this->Row = $pos; |
210 | 201 | } else { |
@@ -222,8 +213,7 @@ discard block |
||
222 | 213 | * Initiates a transaction |
223 | 214 | * @return bool |
224 | 215 | */ |
225 | - public function transactionBegin() |
|
226 | - { |
|
216 | + public function transactionBegin() { |
|
227 | 217 | return $this->linkId->beginTransaction(); |
228 | 218 | } |
229 | 219 | |
@@ -231,8 +221,7 @@ discard block |
||
231 | 221 | * Commits a transaction |
232 | 222 | * @return bool |
233 | 223 | */ |
234 | - public function transactionCommit() |
|
235 | - { |
|
224 | + public function transactionCommit() { |
|
236 | 225 | return $this->linkId->commit(); |
237 | 226 | } |
238 | 227 | |
@@ -240,8 +229,7 @@ discard block |
||
240 | 229 | * Rolls back a transaction |
241 | 230 | * @return bool |
242 | 231 | */ |
243 | - public function transactionAbort() |
|
244 | - { |
|
232 | + public function transactionAbort() { |
|
245 | 233 | return $this->linkId->rollBack(); |
246 | 234 | } |
247 | 235 | |
@@ -251,8 +239,7 @@ discard block |
||
251 | 239 | * @param mixed $field |
252 | 240 | * @return int |
253 | 241 | */ |
254 | - public function getLastInsertId($table, $field) |
|
255 | - { |
|
242 | + public function getLastInsertId($table, $field) { |
|
256 | 243 | if (!isset($table) || $table == '' || !isset($field) || $field == '') { |
257 | 244 | return -1; |
258 | 245 | } |
@@ -267,8 +254,7 @@ discard block |
||
267 | 254 | * @param string $mode |
268 | 255 | * @return void |
269 | 256 | */ |
270 | - public function lock($table, $mode = 'write') |
|
271 | - { |
|
257 | + public function lock($table, $mode = 'write') { |
|
272 | 258 | /* $this->connect(); |
273 | 259 | |
274 | 260 | * $query = "lock tables "; |
@@ -305,8 +291,7 @@ discard block |
||
305 | 291 | * Db::unlock() |
306 | 292 | * @return void |
307 | 293 | */ |
308 | - public function unlock() |
|
309 | - { |
|
294 | + public function unlock() { |
|
310 | 295 | /* $this->connect(); |
311 | 296 | |
312 | 297 | * $res = @mysql_query("unlock tables"); |
@@ -326,8 +311,7 @@ discard block |
||
326 | 311 | * |
327 | 312 | * @return mixed |
328 | 313 | */ |
329 | - public function affectedRows() |
|
330 | - { |
|
314 | + public function affectedRows() { |
|
331 | 315 | return @$this->queryId->rowCount(); |
332 | 316 | } |
333 | 317 | |
@@ -335,8 +319,7 @@ discard block |
||
335 | 319 | * Db::num_rows() |
336 | 320 | * @return int |
337 | 321 | */ |
338 | - public function num_rows() |
|
339 | - { |
|
322 | + public function num_rows() { |
|
340 | 323 | return count($this->Rows); |
341 | 324 | } |
342 | 325 | |
@@ -344,8 +327,7 @@ discard block |
||
344 | 327 | * Db::num_fields() |
345 | 328 | * @return int |
346 | 329 | */ |
347 | - public function num_fields() |
|
348 | - { |
|
330 | + public function num_fields() { |
|
349 | 331 | $keys = array_keys($this->Rows); |
350 | 332 | return count($this->Rows[$keys[0]]); |
351 | 333 | } |
@@ -356,8 +338,7 @@ discard block |
||
356 | 338 | * @param string $file |
357 | 339 | * @return mixed|void |
358 | 340 | */ |
359 | - public function haltmsg($msg, $line = '', $file = '') |
|
360 | - { |
|
341 | + public function haltmsg($msg, $line = '', $file = '') { |
|
361 | 342 | $this->log("Database error: $msg", $line, $file, 'error'); |
362 | 343 | if ($this->Errno != '0' || $this->Error != '()') { |
363 | 344 | $this->log('PDO MySQL Error: '.json_encode($this->linkId->errorInfo()), $line, $file, 'error'); |
@@ -370,8 +351,7 @@ discard block |
||
370 | 351 | * |
371 | 352 | * @return array |
372 | 353 | */ |
373 | - public function tableNames() |
|
374 | - { |
|
354 | + public function tableNames() { |
|
375 | 355 | $return = []; |
376 | 356 | $this->query('SHOW TABLES'); |
377 | 357 | foreach ($this->Rows as $i => $info) { |
@@ -18,8 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @access public |
20 | 20 | */ |
21 | -class Db extends MysqliDb implements Db_Interface |
|
22 | -{ |
|
21 | +class Db extends MysqliDb implements Db_Interface { |
|
23 | 22 | public $host = 'localhost'; |
24 | 23 | public $user = 'pdns'; |
25 | 24 | public $password = ''; |
@@ -34,8 +33,7 @@ discard block |
||
34 | 33 | * @param string $type |
35 | 34 | * @return string |
36 | 35 | */ |
37 | - public function quote($text = '', $type = 'text') |
|
38 | - { |
|
36 | + public function quote($text = '', $type = 'text') { |
|
39 | 37 | switch ($type) { |
40 | 38 | case 'text': |
41 | 39 | return "'".$this->escape($text)."'"; |
@@ -57,8 +55,7 @@ discard block |
||
57 | 55 | * @param string $file |
58 | 56 | * @return bool |
59 | 57 | */ |
60 | - public function queryOne($query, $line = '', $file = '') |
|
61 | - { |
|
58 | + public function queryOne($query, $line = '', $file = '') { |
|
62 | 59 | $this->query($query, $line, $file); |
63 | 60 | if ($this->num_rows() > 0) { |
64 | 61 | $this->next_record(); |
@@ -76,8 +73,7 @@ discard block |
||
76 | 73 | * @param string $file |
77 | 74 | * @return array|bool |
78 | 75 | */ |
79 | - public function queryRow($query, $line = '', $file = '') |
|
80 | - { |
|
76 | + public function queryRow($query, $line = '', $file = '') { |
|
81 | 77 | $this->query($query, $line, $file); |
82 | 78 | if ($this->num_rows() > 0) { |
83 | 79 | $this->next_record(); |
@@ -93,8 +89,7 @@ discard block |
||
93 | 89 | * @param mixed $field |
94 | 90 | * @return int |
95 | 91 | */ |
96 | - public function lastInsertId($table, $field) |
|
97 | - { |
|
92 | + public function lastInsertId($table, $field) { |
|
98 | 93 | return $this->getLastInsertId($table, $field); |
99 | 94 | } |
100 | 95 | } |
@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @package MyDb |
16 | 16 | */ |
17 | -class Loader |
|
18 | -{ |
|
17 | +class Loader { |
|
19 | 18 | /* public: connection parameters */ |
20 | 19 | public $Type = 'mysqli'; |
21 | 20 | public $host = 'localhost'; |
@@ -55,8 +54,7 @@ discard block |
||
55 | 54 | * @param string $host Optional The hostname where the server is, or default to localhost |
56 | 55 | * @param string $query Optional query to perform immediately |
57 | 56 | */ |
58 | - public function __construct($Type = '', $database = '', $user = '', $password = '', $host = 'localhost', $query = '') |
|
59 | - { |
|
57 | + public function __construct($Type = '', $database = '', $user = '', $password = '', $host = 'localhost', $query = '') { |
|
60 | 58 | $this->Type = $Type; |
61 | 59 | if (!defined('db')) { |
62 | 60 | switch ($this->Type) { |
@@ -97,24 +95,21 @@ discard block |
||
97 | 95 | * @param string $line |
98 | 96 | * @param string $file |
99 | 97 | */ |
100 | - public function log($message, $line = '', $file = '') |
|
101 | - { |
|
98 | + public function log($message, $line = '', $file = '') { |
|
102 | 99 | error_log($message); |
103 | 100 | } |
104 | 101 | |
105 | 102 | /** |
106 | 103 | * @return int |
107 | 104 | */ |
108 | - public function linkId() |
|
109 | - { |
|
105 | + public function linkId() { |
|
110 | 106 | return $this->linkId; |
111 | 107 | } |
112 | 108 | |
113 | 109 | /** |
114 | 110 | * @return int |
115 | 111 | */ |
116 | - public function queryId() |
|
117 | - { |
|
112 | + public function queryId() { |
|
118 | 113 | return $this->queryId; |
119 | 114 | } |
120 | 115 | |
@@ -122,8 +117,7 @@ discard block |
||
122 | 117 | * @param $str |
123 | 118 | * @return string |
124 | 119 | */ |
125 | - public function dbAddslashes($str) |
|
126 | - { |
|
120 | + public function dbAddslashes($str) { |
|
127 | 121 | if (!isset($str) || $str == '') { |
128 | 122 | return ''; |
129 | 123 | } |
@@ -141,8 +135,7 @@ discard block |
||
141 | 135 | * @param string $file optionally pass __FILE__ calling the query for logging |
142 | 136 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
143 | 137 | */ |
144 | - public function qr($query, $line = '', $file = '') |
|
145 | - { |
|
138 | + public function qr($query, $line = '', $file = '') { |
|
146 | 139 | return $this->queryReturn($query, $line, $file); |
147 | 140 | } |
148 | 141 | |
@@ -154,8 +147,7 @@ discard block |
||
154 | 147 | * @param string $file |
155 | 148 | * @return void |
156 | 149 | */ |
157 | - public function halt($msg, $line = '', $file = '') |
|
158 | - { |
|
150 | + public function halt($msg, $line = '', $file = '') { |
|
159 | 151 | $this->unlock(false); |
160 | 152 | |
161 | 153 | if ($this->haltOnError == 'no') { |
@@ -181,8 +173,7 @@ discard block |
||
181 | 173 | /** |
182 | 174 | * @param $msg |
183 | 175 | */ |
184 | - public function haltmsg($msg) |
|
185 | - { |
|
176 | + public function haltmsg($msg) { |
|
186 | 177 | $this->log("Database error: $msg", __LINE__, __FILE__); |
187 | 178 | if ($this->Errno != '0' || $this->Error != '()') { |
188 | 179 | $this->log('SQL Error: '.$this->Errno.' ('.$this->Error.')', __LINE__, __FILE__); |
@@ -192,8 +183,7 @@ discard block |
||
192 | 183 | /** |
193 | 184 | * @return array |
194 | 185 | */ |
195 | - public function indexNames() |
|
196 | - { |
|
186 | + public function indexNames() { |
|
197 | 187 | return []; |
198 | 188 | } |
199 | 189 | } |
@@ -17,8 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @access public |
19 | 19 | */ |
20 | -class Db extends Generic implements Db_Interface |
|
21 | -{ |
|
20 | +class Db extends Generic implements Db_Interface { |
|
22 | 21 | /* public: this is an api revision, not a CVS revision. */ |
23 | 22 | public $type = 'pgsql'; |
24 | 23 | public $port = ''; |
@@ -33,8 +32,7 @@ discard block |
||
33 | 32 | * @param false|string $quote optional indicate the value needs quoted |
34 | 33 | * @return string |
35 | 34 | */ |
36 | - public function ifadd($add, $me, $quote = false) |
|
37 | - { |
|
35 | + public function ifadd($add, $me, $quote = false) { |
|
38 | 36 | if ('' != $add) { |
39 | 37 | return ' '.$me.($quote === false ? '' : $quote).$add.($quote === false ? '' : $quote); |
40 | 38 | } |
@@ -45,8 +43,7 @@ discard block |
||
45 | 43 | * @param $string |
46 | 44 | * @return string |
47 | 45 | */ |
48 | - public function real_escape($string = '') |
|
49 | - { |
|
46 | + public function real_escape($string = '') { |
|
50 | 47 | return $this->escape($string); |
51 | 48 | } |
52 | 49 | |
@@ -56,8 +53,7 @@ discard block |
||
56 | 53 | * @param string $database the name of the database to use |
57 | 54 | * @return void |
58 | 55 | */ |
59 | - public function useDb($database) |
|
60 | - { |
|
56 | + public function useDb($database) { |
|
61 | 57 | $this->selectDb($database); |
62 | 58 | } |
63 | 59 | |
@@ -67,8 +63,7 @@ discard block |
||
67 | 63 | * @param string $database the name of the database to use |
68 | 64 | * @return void |
69 | 65 | */ |
70 | - public function selectDb($database) |
|
71 | - { |
|
66 | + public function selectDb($database) { |
|
72 | 67 | /*if ($database != $this->database) { |
73 | 68 | $this->database = $database; |
74 | 69 | $this->linkId = null; |
@@ -80,8 +75,7 @@ discard block |
||
80 | 75 | * Db::connect() |
81 | 76 | * @return void |
82 | 77 | */ |
83 | - public function connect() |
|
84 | - { |
|
78 | + public function connect() { |
|
85 | 79 | if (0 == $this->linkId) { |
86 | 80 | $connectString = trim($this->ifadd($this->host, 'host='). |
87 | 81 | $this->ifadd($this->port, 'port='). |
@@ -101,8 +95,7 @@ discard block |
||
101 | 95 | * Db::disconnect() |
102 | 96 | * @return bool |
103 | 97 | */ |
104 | - public function disconnect() |
|
105 | - { |
|
98 | + public function disconnect() { |
|
106 | 99 | return @pg_close($this->linkId); |
107 | 100 | } |
108 | 101 | |
@@ -117,8 +110,7 @@ discard block |
||
117 | 110 | * @param string $file optionally pass __FILE__ calling the query for logging |
118 | 111 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
119 | 112 | */ |
120 | - public function queryReturn($query, $line = '', $file = '') |
|
121 | - { |
|
113 | + public function queryReturn($query, $line = '', $file = '') { |
|
122 | 114 | $this->query($query, $line, $file); |
123 | 115 | if ($this->num_rows() == 0) { |
124 | 116 | return false; |
@@ -144,8 +136,7 @@ discard block |
||
144 | 136 | * @param string $file optionally pass __FILE__ calling the query for logging |
145 | 137 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
146 | 138 | */ |
147 | - public function qr($query, $line = '', $file = '') |
|
148 | - { |
|
139 | + public function qr($query, $line = '', $file = '') { |
|
149 | 140 | return $this->queryReturn($query, $line, $file); |
150 | 141 | } |
151 | 142 | |
@@ -159,8 +150,7 @@ discard block |
||
159 | 150 | * @param string $file |
160 | 151 | * @return mixed 0 if no query or query id handler, safe to ignore this return |
161 | 152 | */ |
162 | - public function query($queryString, $line = '', $file = '') |
|
163 | - { |
|
153 | + public function query($queryString, $line = '', $file = '') { |
|
164 | 154 | /* No empty queries, please, since PHP4 chokes on them. */ |
165 | 155 | /* The empty query string is passed on from the constructor, |
166 | 156 | * when calling the class without a query, e.g. in situations |
@@ -191,8 +181,7 @@ discard block |
||
191 | 181 | * |
192 | 182 | * @return void |
193 | 183 | */ |
194 | - public function free() |
|
195 | - { |
|
184 | + public function free() { |
|
196 | 185 | @pg_freeresult($this->queryId); |
197 | 186 | $this->queryId = 0; |
198 | 187 | } |
@@ -202,8 +191,7 @@ discard block |
||
202 | 191 | * @param mixed $resultType |
203 | 192 | * @return bool |
204 | 193 | */ |
205 | - public function next_record($resultType = PGSQL_BOTH) |
|
206 | - { |
|
194 | + public function next_record($resultType = PGSQL_BOTH) { |
|
207 | 195 | $this->Record = @pg_fetch_array($this->queryId, $this->Row++, $resultType); |
208 | 196 | |
209 | 197 | $this->Error = pg_errormessage($this->linkId); |
@@ -223,8 +211,7 @@ discard block |
||
223 | 211 | * @param mixed $pos |
224 | 212 | * @return void |
225 | 213 | */ |
226 | - public function seek($pos) |
|
227 | - { |
|
214 | + public function seek($pos) { |
|
228 | 215 | $this->Row = $pos; |
229 | 216 | } |
230 | 217 | |
@@ -233,8 +220,7 @@ discard block |
||
233 | 220 | * |
234 | 221 | * @return mixed |
235 | 222 | */ |
236 | - public function transactionBegin() |
|
237 | - { |
|
223 | + public function transactionBegin() { |
|
238 | 224 | return $this->query('begin'); |
239 | 225 | } |
240 | 226 | |
@@ -242,8 +228,7 @@ discard block |
||
242 | 228 | * Db::transactionCommit() |
243 | 229 | * @return bool|mixed |
244 | 230 | */ |
245 | - public function transactionCommit() |
|
246 | - { |
|
231 | + public function transactionCommit() { |
|
247 | 232 | if (!$this->Errno) { |
248 | 233 | return pg_exec($this->linkId, 'commit'); |
249 | 234 | } else { |
@@ -255,8 +240,7 @@ discard block |
||
255 | 240 | * Db::transactionAbort() |
256 | 241 | * @return mixed |
257 | 242 | */ |
258 | - public function transactionAbort() |
|
259 | - { |
|
243 | + public function transactionAbort() { |
|
260 | 244 | return pg_exec($this->linkId, 'rollback'); |
261 | 245 | } |
262 | 246 | |
@@ -266,8 +250,7 @@ discard block |
||
266 | 250 | * @param mixed $field |
267 | 251 | * @return int |
268 | 252 | */ |
269 | - public function getLastInsertId($table, $field) |
|
270 | - { |
|
253 | + public function getLastInsertId($table, $field) { |
|
271 | 254 | /* This will get the last insert ID created on the current connection. Should only be called |
272 | 255 | * after an insert query is run on a table that has an auto incrementing field. Of note, table |
273 | 256 | * and field are required because pgsql returns the last inserted OID, which is unique across |
@@ -304,8 +287,7 @@ discard block |
||
304 | 287 | * @param string $mode |
305 | 288 | * @return int|mixed |
306 | 289 | */ |
307 | - public function lock($table, $mode = 'write') |
|
308 | - { |
|
290 | + public function lock($table, $mode = 'write') { |
|
309 | 291 | $result = $this->transactionBegin(); |
310 | 292 | |
311 | 293 | if ($mode == 'write') { |
@@ -327,8 +309,7 @@ discard block |
||
327 | 309 | * Db::unlock() |
328 | 310 | * @return bool|mixed |
329 | 311 | */ |
330 | - public function unlock() |
|
331 | - { |
|
312 | + public function unlock() { |
|
332 | 313 | return $this->transactionCommit(); |
333 | 314 | } |
334 | 315 | |
@@ -336,8 +317,7 @@ discard block |
||
336 | 317 | * Db::affectedRows() |
337 | 318 | * @return void |
338 | 319 | */ |
339 | - public function affectedRows() |
|
340 | - { |
|
320 | + public function affectedRows() { |
|
341 | 321 | return pg_cmdtuples($this->queryId); |
342 | 322 | } |
343 | 323 | |
@@ -345,8 +325,7 @@ discard block |
||
345 | 325 | * Db::num_rows() |
346 | 326 | * @return int |
347 | 327 | */ |
348 | - public function num_rows() |
|
349 | - { |
|
328 | + public function num_rows() { |
|
350 | 329 | return pg_numrows($this->queryId); |
351 | 330 | } |
352 | 331 | |
@@ -354,8 +333,7 @@ discard block |
||
354 | 333 | * Db::num_fields() |
355 | 334 | * @return int |
356 | 335 | */ |
357 | - public function num_fields() |
|
358 | - { |
|
336 | + public function num_fields() { |
|
359 | 337 | return pg_numfields($this->queryId); |
360 | 338 | } |
361 | 339 | |
@@ -365,8 +343,7 @@ discard block |
||
365 | 343 | * @param string $file |
366 | 344 | * @return mixed|void |
367 | 345 | */ |
368 | - public function haltmsg($msg, $line = '', $file = '') |
|
369 | - { |
|
346 | + public function haltmsg($msg, $line = '', $file = '') { |
|
370 | 347 | $this->log("Database error: $msg", $line, $file, 'error'); |
371 | 348 | if ($this->Errno != '0' || $this->Error != '()') { |
372 | 349 | $this->log('PostgreSQL Error: '.pg_last_error($this->linkId), $line, $file, 'error'); |
@@ -379,8 +356,7 @@ discard block |
||
379 | 356 | * |
380 | 357 | * @return array |
381 | 358 | */ |
382 | - public function tableNames() |
|
383 | - { |
|
359 | + public function tableNames() { |
|
384 | 360 | $return = []; |
385 | 361 | $this->query("select relname from pg_class where relkind = 'r' and not relname like 'pg_%'"); |
386 | 362 | $i = 0; |
@@ -398,8 +374,7 @@ discard block |
||
398 | 374 | * |
399 | 375 | * @return array |
400 | 376 | */ |
401 | - public function indexNames() |
|
402 | - { |
|
377 | + public function indexNames() { |
|
403 | 378 | $return = []; |
404 | 379 | $this->query("SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relkind ='i' ORDER BY relname"); |
405 | 380 | $i = 0; |
@@ -17,8 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @access public |
19 | 19 | */ |
20 | -class Db extends Generic implements Db_Interface |
|
21 | -{ |
|
20 | +class Db extends Generic implements Db_Interface { |
|
22 | 21 | /** |
23 | 22 | * @var string |
24 | 23 | */ |
@@ -30,8 +29,7 @@ discard block |
||
30 | 29 | * @param string $database the name of the database to use |
31 | 30 | * @return void |
32 | 31 | */ |
33 | - public function useDb($database) |
|
34 | - { |
|
32 | + public function useDb($database) { |
|
35 | 33 | $this->selectDb($database); |
36 | 34 | } |
37 | 35 | |
@@ -41,8 +39,7 @@ discard block |
||
41 | 39 | * @param string $database the name of the database to use |
42 | 40 | * @return void |
43 | 41 | */ |
44 | - public function selectDb($database) |
|
45 | - { |
|
42 | + public function selectDb($database) { |
|
46 | 43 | $this->connect(); |
47 | 44 | mysqli_select_db($this->linkId, $database); |
48 | 45 | } |
@@ -57,8 +54,7 @@ discard block |
||
57 | 54 | * @param string $password |
58 | 55 | * @return int|\mysqli |
59 | 56 | */ |
60 | - public function connect($database = '', $host = '', $user = '', $password = '', $port = '') |
|
61 | - { |
|
57 | + public function connect($database = '', $host = '', $user = '', $password = '', $port = '') { |
|
62 | 58 | /* Handle defaults */ |
63 | 59 | if ($database == '') { |
64 | 60 | $database = $this->database; |
@@ -105,8 +101,7 @@ discard block |
||
105 | 101 | * Db::disconnect() |
106 | 102 | * @return bool |
107 | 103 | */ |
108 | - public function disconnect() |
|
109 | - { |
|
104 | + public function disconnect() { |
|
110 | 105 | $return = method_exists($this->linkId, 'close') ? $this->linkId->close() : false; |
111 | 106 | $this->linkId = 0; |
112 | 107 | return $return; |
@@ -116,8 +111,7 @@ discard block |
||
116 | 111 | * @param $string |
117 | 112 | * @return string |
118 | 113 | */ |
119 | - public function real_escape($string = '') |
|
120 | - { |
|
114 | + public function real_escape($string = '') { |
|
121 | 115 | if ((!is_resource($this->linkId) || $this->linkId == 0) && !$this->connect()) { |
122 | 116 | return $this->escape($string); |
123 | 117 | } |
@@ -128,8 +122,7 @@ discard block |
||
128 | 122 | * discard the query result |
129 | 123 | * @return void |
130 | 124 | */ |
131 | - public function free() |
|
132 | - { |
|
125 | + public function free() { |
|
133 | 126 | if (is_resource($this->queryId)) { |
134 | 127 | @mysqli_free_result($this->queryId); |
135 | 128 | } |
@@ -147,8 +140,7 @@ discard block |
||
147 | 140 | * @param string $file optionally pass __FILE__ calling the query for logging |
148 | 141 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
149 | 142 | */ |
150 | - public function queryReturn($query, $line = '', $file = '') |
|
151 | - { |
|
143 | + public function queryReturn($query, $line = '', $file = '') { |
|
152 | 144 | $this->query($query, $line, $file); |
153 | 145 | if ($this->num_rows() == 0) { |
154 | 146 | return false; |
@@ -174,8 +166,7 @@ discard block |
||
174 | 166 | * @param string $file optionally pass __FILE__ calling the query for logging |
175 | 167 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
176 | 168 | */ |
177 | - public function qr($query, $line = '', $file = '') |
|
178 | - { |
|
169 | + public function qr($query, $line = '', $file = '') { |
|
179 | 170 | return $this->queryReturn($query, $line, $file); |
180 | 171 | } |
181 | 172 | |
@@ -187,8 +178,7 @@ discard block |
||
187 | 178 | * @param string $line |
188 | 179 | * @param string $file |
189 | 180 | */ |
190 | - public function prepare($query, $line = '', $file = '') |
|
191 | - { |
|
181 | + public function prepare($query, $line = '', $file = '') { |
|
192 | 182 | if (!$this->connect()) { |
193 | 183 | return 0; |
194 | 184 | } |
@@ -210,8 +200,7 @@ discard block |
||
210 | 200 | * @param string $file |
211 | 201 | * @return mixed 0 if no query or query id handler, safe to ignore this return |
212 | 202 | */ |
213 | - public function query($queryString, $line = '', $file = '') |
|
214 | - { |
|
203 | + public function query($queryString, $line = '', $file = '') { |
|
215 | 204 | /* No empty queries, please, since PHP4 chokes on them. */ |
216 | 205 | /* The empty query string is passed on from the constructor, |
217 | 206 | * when calling the class without a query, e.g. in situations |
@@ -267,8 +256,7 @@ discard block |
||
267 | 256 | /** |
268 | 257 | * @return array|null|object |
269 | 258 | */ |
270 | - public function fetchObject() |
|
271 | - { |
|
259 | + public function fetchObject() { |
|
272 | 260 | $this->Record = @mysqli_fetch_object($this->queryId); |
273 | 261 | return $this->Record; |
274 | 262 | } |
@@ -281,8 +269,7 @@ discard block |
||
281 | 269 | * @param mixed $resultType |
282 | 270 | * @return bool |
283 | 271 | */ |
284 | - public function next_record($resultType = MYSQLI_BOTH) |
|
285 | - { |
|
272 | + public function next_record($resultType = MYSQLI_BOTH) { |
|
286 | 273 | if ($this->queryId === false) { |
287 | 274 | $this->haltmsg('next_record called with no query pending.'); |
288 | 275 | return 0; |
@@ -306,8 +293,7 @@ discard block |
||
306 | 293 | * @param integer $pos the row numbe starting at 0 to switch to |
307 | 294 | * @return bool whetherit was successfu or not. |
308 | 295 | */ |
309 | - public function seek($pos = 0) |
|
310 | - { |
|
296 | + public function seek($pos = 0) { |
|
311 | 297 | $status = @mysqli_data_seek($this->queryId, $pos); |
312 | 298 | if ($status) { |
313 | 299 | $this->Row = $pos; |
@@ -327,8 +313,7 @@ discard block |
||
327 | 313 | * |
328 | 314 | * @return bool |
329 | 315 | */ |
330 | - public function transactionBegin() |
|
331 | - { |
|
316 | + public function transactionBegin() { |
|
332 | 317 | if (version_compare(PHP_VERSION, '5.5.0') < 0) { |
333 | 318 | return true; |
334 | 319 | } |
@@ -343,8 +328,7 @@ discard block |
||
343 | 328 | * |
344 | 329 | * @return bool |
345 | 330 | */ |
346 | - public function transactionCommit() |
|
347 | - { |
|
331 | + public function transactionCommit() { |
|
348 | 332 | if (version_compare(PHP_VERSION, '5.5.0') < 0 || $this->linkId === 0) { |
349 | 333 | return true; |
350 | 334 | } |
@@ -356,8 +340,7 @@ discard block |
||
356 | 340 | * |
357 | 341 | * @return bool |
358 | 342 | */ |
359 | - public function transactionAbort() |
|
360 | - { |
|
343 | + public function transactionAbort() { |
|
361 | 344 | if (version_compare(PHP_VERSION, '5.5.0') < 0 || $this->linkId === 0) { |
362 | 345 | return true; |
363 | 346 | } |
@@ -373,8 +356,7 @@ discard block |
||
373 | 356 | * @param string $field |
374 | 357 | * @return int|string |
375 | 358 | */ |
376 | - public function getLastInsertId($table, $field) |
|
377 | - { |
|
359 | + public function getLastInsertId($table, $field) { |
|
378 | 360 | if (!isset($table) || $table == '' || !isset($field) || $field == '') { |
379 | 361 | return -1; |
380 | 362 | } |
@@ -390,8 +372,7 @@ discard block |
||
390 | 372 | * @param string $mode |
391 | 373 | * @return bool|int|\mysqli_result |
392 | 374 | */ |
393 | - public function lock($table, $mode = 'write') |
|
394 | - { |
|
375 | + public function lock($table, $mode = 'write') { |
|
395 | 376 | $this->connect(); |
396 | 377 | $query = 'lock tables '; |
397 | 378 | if (is_array($table)) { |
@@ -419,8 +400,7 @@ discard block |
||
419 | 400 | * @param bool $haltOnError optional, defaults to TRUE, whether or not to halt on error |
420 | 401 | * @return bool|int|\mysqli_result |
421 | 402 | */ |
422 | - public function unlock($haltOnError = true) |
|
423 | - { |
|
403 | + public function unlock($haltOnError = true) { |
|
424 | 404 | $this->connect(); |
425 | 405 | |
426 | 406 | $res = @mysqli_query($this->linkId, 'unlock tables'); |
@@ -437,8 +417,7 @@ discard block |
||
437 | 417 | * Db::affectedRows() |
438 | 418 | * @return int |
439 | 419 | */ |
440 | - public function affectedRows() |
|
441 | - { |
|
420 | + public function affectedRows() { |
|
442 | 421 | return @mysqli_affected_rows($this->linkId); |
443 | 422 | } |
444 | 423 | |
@@ -446,8 +425,7 @@ discard block |
||
446 | 425 | * Db::num_rows() |
447 | 426 | * @return int |
448 | 427 | */ |
449 | - public function num_rows() |
|
450 | - { |
|
428 | + public function num_rows() { |
|
451 | 429 | return @mysqli_num_rows($this->queryId); |
452 | 430 | } |
453 | 431 | |
@@ -455,8 +433,7 @@ discard block |
||
455 | 433 | * Db::num_fields() |
456 | 434 | * @return int |
457 | 435 | */ |
458 | - public function num_fields() |
|
459 | - { |
|
436 | + public function num_fields() { |
|
460 | 437 | return @mysqli_num_fields($this->queryId); |
461 | 438 | } |
462 | 439 | |
@@ -465,8 +442,7 @@ discard block |
||
465 | 442 | * |
466 | 443 | * @return array |
467 | 444 | */ |
468 | - public function tableNames() |
|
469 | - { |
|
445 | + public function tableNames() { |
|
470 | 446 | $return = []; |
471 | 447 | $this->query('SHOW TABLES'); |
472 | 448 | $i = 0; |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * Class Generic |
14 | 14 | */ |
15 | -abstract class Generic |
|
16 | -{ |
|
15 | +abstract class Generic { |
|
17 | 16 | /* public: connection parameters */ |
18 | 17 | public $host = 'localhost'; |
19 | 18 | public $database = ''; |
@@ -71,8 +70,7 @@ discard block |
||
71 | 70 | * @param string $query Optional query to perform immediately |
72 | 71 | * @param string $port optional port for the connection |
73 | 72 | */ |
74 | - public function __construct($database = '', $user = '', $password = '', $host = 'localhost', $query = '', $port = '') |
|
75 | - { |
|
73 | + public function __construct($database = '', $user = '', $password = '', $host = 'localhost', $query = '', $port = '') { |
|
76 | 74 | $this->database = $database; |
77 | 75 | $this->user = $user; |
78 | 76 | $this->password = $password; |
@@ -90,24 +88,21 @@ discard block |
||
90 | 88 | * @param string $file |
91 | 89 | * @return void |
92 | 90 | */ |
93 | - public function log($message, $line = '', $file = '', $level = 'info') |
|
94 | - { |
|
91 | + public function log($message, $line = '', $file = '', $level = 'info') { |
|
95 | 92 | error_log($message); |
96 | 93 | } |
97 | 94 | |
98 | 95 | /** |
99 | 96 | * @return int|object |
100 | 97 | */ |
101 | - public function linkId() |
|
102 | - { |
|
98 | + public function linkId() { |
|
103 | 99 | return $this->linkId; |
104 | 100 | } |
105 | 101 | |
106 | 102 | /** |
107 | 103 | * @return int|object |
108 | 104 | */ |
109 | - public function queryId() |
|
110 | - { |
|
105 | + public function queryId() { |
|
111 | 106 | return $this->queryId; |
112 | 107 | } |
113 | 108 | |
@@ -115,8 +110,7 @@ discard block |
||
115 | 110 | * @param $string |
116 | 111 | * @return string |
117 | 112 | */ |
118 | - public function real_escape($string = '') |
|
119 | - { |
|
113 | + public function real_escape($string = '') { |
|
120 | 114 | if ((!is_resource($this->linkId) || $this->linkId == 0) && !$this->connect()) { |
121 | 115 | return $this->escape($string); |
122 | 116 | } |
@@ -127,8 +121,7 @@ discard block |
||
127 | 121 | * @param $string |
128 | 122 | * @return string |
129 | 123 | */ |
130 | - public function escape($string = '') |
|
131 | - { |
|
124 | + public function escape($string = '') { |
|
132 | 125 | //if (function_exists('mysql_escape_string')) |
133 | 126 | //return mysql_escape_string($string); |
134 | 127 | return str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $string); |
@@ -138,8 +131,7 @@ discard block |
||
138 | 131 | * @param mixed $str |
139 | 132 | * @return string |
140 | 133 | */ |
141 | - public function dbAddslashes($str = '') |
|
142 | - { |
|
134 | + public function dbAddslashes($str = '') { |
|
143 | 135 | if (!isset($str) || $str == '') { |
144 | 136 | return ''; |
145 | 137 | } |
@@ -151,8 +143,7 @@ discard block |
||
151 | 143 | * @param mixed $epoch |
152 | 144 | * @return bool|string |
153 | 145 | */ |
154 | - public function toTimestamp($epoch) |
|
155 | - { |
|
146 | + public function toTimestamp($epoch) { |
|
156 | 147 | return date('Y-m-d H:i:s', $epoch); |
157 | 148 | } |
158 | 149 | |
@@ -161,8 +152,7 @@ discard block |
||
161 | 152 | * @param mixed $timestamp |
162 | 153 | * @return bool|int|mixed |
163 | 154 | */ |
164 | - public function fromTimestamp($timestamp) |
|
165 | - { |
|
155 | + public function fromTimestamp($timestamp) { |
|
166 | 156 | if (preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/', $timestamp, $parts)) { |
167 | 157 | $time = mktime($parts[4], $parts[5], $parts[6], $parts[2], $parts[3], $parts[1]); |
168 | 158 | } elseif (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $timestamp, $parts)) { |
@@ -188,8 +178,7 @@ discard block |
||
188 | 178 | * @param string $file |
189 | 179 | * @return mixed |
190 | 180 | */ |
191 | - public function limitQuery($queryString, $numRows = '', $offset = 0, $line = '', $file = '') |
|
192 | - { |
|
181 | + public function limitQuery($queryString, $numRows = '', $offset = 0, $line = '', $file = '') { |
|
193 | 182 | if (!$numRows) { |
194 | 183 | $numRows = $this->maxMatches; |
195 | 184 | } |
@@ -216,8 +205,7 @@ discard block |
||
216 | 205 | * @param string $file optionally pass __FILE__ calling the query for logging |
217 | 206 | * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only |
218 | 207 | */ |
219 | - public function qr($query, $line = '', $file = '') |
|
220 | - { |
|
208 | + public function qr($query, $line = '', $file = '') { |
|
221 | 209 | return $this->queryReturn($query, $line, $file); |
222 | 210 | } |
223 | 211 | |
@@ -228,8 +216,7 @@ discard block |
||
228 | 216 | * @param string $stripSlashes |
229 | 217 | * @return string |
230 | 218 | */ |
231 | - public function f($name, $stripSlashes = '') |
|
232 | - { |
|
219 | + public function f($name, $stripSlashes = '') { |
|
233 | 220 | if ($stripSlashes || ($this->autoStripslashes && !$stripSlashes)) { |
234 | 221 | return stripslashes($this->Record[$name]); |
235 | 222 | } else { |
@@ -245,8 +232,7 @@ discard block |
||
245 | 232 | * @param string $file |
246 | 233 | * @return void |
247 | 234 | */ |
248 | - public function halt($msg, $line = '', $file = '') |
|
249 | - { |
|
235 | + public function halt($msg, $line = '', $file = '') { |
|
250 | 236 | $this->unlock(false); |
251 | 237 | /* Just in case there is a table currently locked */ |
252 | 238 | |
@@ -273,8 +259,7 @@ discard block |
||
273 | 259 | * @param string $file |
274 | 260 | * @return mixed|void |
275 | 261 | */ |
276 | - public function logBackTrace($msg, $line = '', $file = '') |
|
277 | - { |
|
262 | + public function logBackTrace($msg, $line = '', $file = '') { |
|
278 | 263 | $backtrace = (function_exists('debug_backtrace') ? debug_backtrace() : []); |
279 | 264 | $this->log( |
280 | 265 | ('' !== getenv('REQUEST_URI') ? ' '.getenv('REQUEST_URI') : ''). |
@@ -305,8 +290,7 @@ discard block |
||
305 | 290 | } |
306 | 291 | } |
307 | 292 | |
308 | - public function emailError($queryString, $error, $line, $file) |
|
309 | - { |
|
293 | + public function emailError($queryString, $error, $line, $file) { |
|
310 | 294 | $subject = php_uname('n').' MySQLi Error'; |
311 | 295 | if (class_exists('\\TFSmarty')) { |
312 | 296 | $smarty = new \TFSmarty(); |
@@ -335,8 +319,7 @@ discard block |
||
335 | 319 | * @param string $file |
336 | 320 | * @return mixed|void |
337 | 321 | */ |
338 | - public function haltmsg($msg, $line = '', $file = '') |
|
339 | - { |
|
322 | + public function haltmsg($msg, $line = '', $file = '') { |
|
340 | 323 | $email = "DB Error {$msg} {$file}:{$line}"; |
341 | 324 | if (class_exists('\\MyAdmin\Mail')) { |
342 | 325 | \MyAdmin\Mail::failsafeMail($email, $email, ['[email protected]', '[email protected]']); |
@@ -353,8 +336,7 @@ discard block |
||
353 | 336 | /** |
354 | 337 | * @return array |
355 | 338 | */ |
356 | - public function indexNames() |
|
357 | - { |
|
339 | + public function indexNames() { |
|
358 | 340 | return []; |
359 | 341 | } |
360 | 342 | |
@@ -366,8 +348,7 @@ discard block |
||
366 | 348 | * @param string|int $line Line Number |
367 | 349 | * @param string $file File Name |
368 | 350 | */ |
369 | - public function addLog($statement, $time, $line = '', $file = '') |
|
370 | - { |
|
351 | + public function addLog($statement, $time, $line = '', $file = '') { |
|
371 | 352 | $query = [ |
372 | 353 | 'statement' => $statement, |
373 | 354 | 'time' => $time * 1000 |
@@ -389,8 +370,7 @@ discard block |
||
389 | 370 | * Return logged queries. |
390 | 371 | * @return array Logged queries |
391 | 372 | */ |
392 | - public function getLog() |
|
393 | - { |
|
373 | + public function getLog() { |
|
394 | 374 | return $this->log; |
395 | 375 | } |
396 | 376 | } |