@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | ]; |
75 | 75 | } |
76 | 76 | } |
77 | - $connection['type'] = isset($temp['scheme']) && strlen((string)$temp['scheme']) ? $temp['scheme'] : null; |
|
78 | - $connection['user'] = isset($temp['user']) && strlen((string)$temp['user']) ? $temp['user'] : null; |
|
79 | - $connection['pass'] = isset($temp['pass']) && strlen((string)$temp['pass']) ? $temp['pass'] : null; |
|
80 | - $connection['host'] = isset($temp['host']) && strlen((string)$temp['host']) ? $temp['host'] : null; |
|
81 | - $connection['name'] = isset($temp['path']) && strlen((string)$temp['path']) ? |
|
82 | - trim((string)$temp['path'], '/') : null; |
|
83 | - $connection['port'] = isset($temp['port']) && (int)$temp['port'] ? (int)$temp['port'] : null; |
|
84 | - if (isset($temp['query']) && strlen((string)$temp['query'])) { |
|
85 | - parse_str((string)$temp['query'], $connection['opts']); |
|
77 | + $connection['type'] = isset($temp['scheme']) && strlen((string) $temp['scheme']) ? $temp['scheme'] : null; |
|
78 | + $connection['user'] = isset($temp['user']) && strlen((string) $temp['user']) ? $temp['user'] : null; |
|
79 | + $connection['pass'] = isset($temp['pass']) && strlen((string) $temp['pass']) ? $temp['pass'] : null; |
|
80 | + $connection['host'] = isset($temp['host']) && strlen((string) $temp['host']) ? $temp['host'] : null; |
|
81 | + $connection['name'] = isset($temp['path']) && strlen((string) $temp['path']) ? |
|
82 | + trim((string) $temp['path'], '/') : null; |
|
83 | + $connection['port'] = isset($temp['port']) && (int) $temp['port'] ? (int) $temp['port'] : null; |
|
84 | + if (isset($temp['query']) && strlen((string) $temp['query'])) { |
|
85 | + parse_str((string) $temp['query'], $connection['opts']); |
|
86 | 86 | } |
87 | 87 | // create the driver |
88 | 88 | $connection['type'] = $aliases[$connection['type']] ?? $connection['type']; |
89 | - $tmp = '\\vakata\\database\\driver\\'.strtolower((string)$connection['type']).'\\Driver'; |
|
89 | + $tmp = '\\vakata\\database\\driver\\'.strtolower((string) $connection['type']).'\\Driver'; |
|
90 | 90 | if (!class_exists($tmp)) { |
91 | 91 | throw new DBException('Unknown DB backend'); |
92 | 92 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $map = []; |
131 | 131 | $sql = preg_replace_callback( |
132 | 132 | '(\:[a-z_][a-z0-9_]+)i', |
133 | - function ($matches) use (&$map, $par) { |
|
133 | + function($matches) use (&$map, $par) { |
|
134 | 134 | $key = substr($matches[0], 1); |
135 | 135 | $map[] = $key; |
136 | 136 | return isset($par) && isset($par[$key]) && is_array($par[$key]) ? '??' : '?'; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $new = ''; |
148 | 148 | $par = array_values($par); |
149 | 149 | if (substr_count($sql, '?') === 2 && !is_array($par[0])) { |
150 | - $par = [ $par ]; |
|
150 | + $par = [$par]; |
|
151 | 151 | } |
152 | 152 | $parts = explode('??', $sql); |
153 | 153 | $index = 0; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $index += count($tmp) - 1; |
158 | 158 | if (isset($par[$index])) { |
159 | 159 | if (!is_array($par[$index])) { |
160 | - $par[$index] = [ $par[$index] ]; |
|
160 | + $par[$index] = [$par[$index]]; |
|
161 | 161 | } |
162 | 162 | $params = $par[$index]; |
163 | 163 | array_splice($par, $index, 1, $params); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $new .= implode(',', array_fill(0, count($params), '?')); |
166 | 166 | } |
167 | 167 | } |
168 | - return [ $new, $par ]; |
|
168 | + return [$new, $par]; |
|
169 | 169 | } |
170 | 170 | /** |
171 | 171 | * Run a query (prepare & execute). |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $sql = $tmp['sql']; |
183 | 183 | $ord = []; |
184 | 184 | foreach ($tmp['map'] as $key) { |
185 | - $ord[] = $par[$key] ?? throw new DBException('Missing param ' . $key); |
|
185 | + $ord[] = $par[$key] ?? throw new DBException('Missing param '.$key); |
|
186 | 186 | } |
187 | 187 | $par = $ord; |
188 | 188 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | ): Collection { |
224 | 224 | $coll = Collection::from($this->query($sql, $par, $buff)); |
225 | 225 | if (($keys = $this->driver->option('mode')) && in_array($keys, ['strtoupper', 'strtolower'])) { |
226 | - $coll->map(function ($v) use ($keys) { |
|
226 | + $coll->map(function($v) use ($keys) { |
|
227 | 227 | $new = []; |
228 | 228 | foreach ($v as $k => $vv) { |
229 | 229 | $new[call_user_func($keys, $k)] = $vv; |
@@ -232,18 +232,18 @@ discard block |
||
232 | 232 | }); |
233 | 233 | } |
234 | 234 | if ($key !== null) { |
235 | - $coll->mapKey(function ($v) use ($key): int|string { |
|
235 | + $coll->mapKey(function($v) use ($key): int | string { |
|
236 | 236 | return $v[$key]; |
237 | 237 | }); |
238 | 238 | } |
239 | 239 | if ($skip) { |
240 | - $coll->map(function ($v) use ($key) { |
|
240 | + $coll->map(function($v) use ($key) { |
|
241 | 241 | unset($v[$key]); |
242 | 242 | return $v; |
243 | 243 | }); |
244 | 244 | } |
245 | 245 | if ($opti) { |
246 | - $coll->map(function ($v) { |
|
246 | + $coll->map(function($v) { |
|
247 | 247 | return count($v) === 1 ? current($v) : $v; |
248 | 248 | }); |
249 | 249 | } |
@@ -360,8 +360,7 @@ discard block |
||
360 | 360 | public function definition(string $table, bool $detectRelations = true) : Table |
361 | 361 | { |
362 | 362 | return isset($this->schema) ? |
363 | - $this->schema->getTable($table) : |
|
364 | - $this->driver->table($table, $detectRelations); |
|
363 | + $this->schema->getTable($table) : $this->driver->table($table, $detectRelations); |
|
365 | 364 | } |
366 | 365 | |
367 | 366 | public function hasSchema(): bool |
@@ -471,11 +470,11 @@ discard block |
||
471 | 470 | * @param class-string<T>|Table|string $table |
472 | 471 | * @return ($table is class-string ? MapperInterface<T> : MapperInterface<Entity>) |
473 | 472 | */ |
474 | - public function getMapper(Table|string $table): MapperInterface |
|
473 | + public function getMapper(Table | string $table): MapperInterface |
|
475 | 474 | { |
476 | 475 | if (is_string($table)) { |
477 | - if (isset($this->mappers['::' . $table])) { |
|
478 | - return $this->mappers['::' . $table]; |
|
476 | + if (isset($this->mappers['::'.$table])) { |
|
477 | + return $this->mappers['::'.$table]; |
|
479 | 478 | } |
480 | 479 | $table = $this->definition($table); |
481 | 480 | } |
@@ -484,14 +483,14 @@ discard block |
||
484 | 483 | } |
485 | 484 | return $this->mappers[$table->getFullName()] = new Mapper($this, $table); |
486 | 485 | } |
487 | - public function setMapper(Table|string $table, MapperInterface $mapper, ?string $class = null): static |
|
486 | + public function setMapper(Table | string $table, MapperInterface $mapper, ?string $class = null): static |
|
488 | 487 | { |
489 | 488 | if (is_string($table)) { |
490 | 489 | $table = $this->definition($table); |
491 | 490 | } |
492 | 491 | $this->mappers[$table->getFullName()] = $mapper; |
493 | 492 | if (isset($class)) { |
494 | - $this->mappers['::' . $class] = $mapper; |
|
493 | + $this->mappers['::'.$class] = $mapper; |
|
495 | 494 | } |
496 | 495 | return $this; |
497 | 496 | } |
@@ -502,11 +501,10 @@ discard block |
||
502 | 501 | ): TableQueryMapped { |
503 | 502 | return new TableQueryMapped($this, $this->definition($table), $findRelations, $mapper); |
504 | 503 | } |
505 | - public function __call(string $method, array $args): TableQuery|TableQueryMapped |
|
504 | + public function __call(string $method, array $args): TableQuery | TableQueryMapped |
|
506 | 505 | { |
507 | 506 | return ($args[0] ?? false) ? |
508 | - $this->tableMapped($method, $args[1] ?? false, $args[2] ?? null) : |
|
509 | - $this->table($method, $args[1] ?? false); |
|
507 | + $this->tableMapped($method, $args[1] ?? false, $args[2] ?? null) : $this->table($method, $args[1] ?? false); |
|
510 | 508 | } |
511 | 509 | public function findRelation(string $start, string $end): array |
512 | 510 | { |
@@ -542,12 +540,12 @@ discard block |
||
542 | 540 | $relations[$t] = $w; |
543 | 541 | } |
544 | 542 | if (!isset($schema[$name])) { |
545 | - $schema[$name] = [ 'edges' => [] ]; |
|
543 | + $schema[$name] = ['edges' => []]; |
|
546 | 544 | } |
547 | 545 | foreach ($relations as $t => $w) { |
548 | 546 | $schema[$name]['edges'][$t] = $w; |
549 | 547 | if (!isset($schema[$t])) { |
550 | - $schema[$t] = [ 'edges' => [] ]; |
|
548 | + $schema[$t] = ['edges' => []]; |
|
551 | 549 | } |
552 | 550 | $schema[$t]['edges'][$name] = $w; |
553 | 551 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | if (isset($this->map)) { |
27 | 27 | $par = []; |
28 | 28 | foreach ($this->map as $key) { |
29 | - $par[] = $data[$key] ?? throw new DBException('Missing param ' . $key); |
|
29 | + $par[] = $data[$key] ?? throw new DBException('Missing param '.$key); |
|
30 | 30 | } |
31 | 31 | $data = $par; |
32 | 32 | } |
@@ -34,28 +34,28 @@ discard block |
||
34 | 34 | foreach ($data as $i => $v) { |
35 | 35 | switch (gettype($v)) { |
36 | 36 | case 'boolean': |
37 | - $this->statement->bindValue($i+1, $v, \PDO::PARAM_BOOL); |
|
37 | + $this->statement->bindValue($i + 1, $v, \PDO::PARAM_BOOL); |
|
38 | 38 | break; |
39 | 39 | case 'integer': |
40 | - $this->statement->bindValue($i+1, $v, \PDO::PARAM_INT); |
|
40 | + $this->statement->bindValue($i + 1, $v, \PDO::PARAM_INT); |
|
41 | 41 | break; |
42 | 42 | case 'NULL': |
43 | - $this->statement->bindValue($i+1, $v, \PDO::PARAM_NULL); |
|
43 | + $this->statement->bindValue($i + 1, $v, \PDO::PARAM_NULL); |
|
44 | 44 | break; |
45 | 45 | case 'double': |
46 | - $this->statement->bindValue($i+1, $v); |
|
46 | + $this->statement->bindValue($i + 1, $v); |
|
47 | 47 | break; |
48 | 48 | default: |
49 | 49 | // keep in mind oracle needs a transaction when inserting LOBs, aside from the specific syntax: |
50 | 50 | // INSERT INTO table (column, lobcolumn) VALUES (?, ?, EMPTY_BLOB()) RETURNING lobcolumn INTO ? |
51 | 51 | if (is_resource($v) && get_resource_type($v) === 'stream') { |
52 | - $this->statement->bindParam($i+1, $v, \PDO::PARAM_LOB); |
|
52 | + $this->statement->bindParam($i + 1, $v, \PDO::PARAM_LOB); |
|
53 | 53 | break; |
54 | 54 | } |
55 | 55 | if (!is_string($data[$i])) { |
56 | 56 | $data[$i] = serialize($data[$i]); |
57 | 57 | } |
58 | - $this->statement->bindValue($i+1, $v); |
|
58 | + $this->statement->bindValue($i + 1, $v); |
|
59 | 59 | break; |
60 | 60 | } |
61 | 61 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | if (isset($this->map)) { |
29 | 29 | $par = []; |
30 | 30 | foreach ($this->map as $key) { |
31 | - $par[] = $data[$key] ?? throw new DBException('Missing param ' . $key); |
|
31 | + $par[] = $data[$key] ?? throw new DBException('Missing param '.$key); |
|
32 | 32 | } |
33 | 33 | $data = $par; |
34 | 34 | } |
@@ -49,23 +49,23 @@ discard block |
||
49 | 49 | break; |
50 | 50 | case 'array': |
51 | 51 | $par = implode(',', $par); |
52 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
52 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
53 | 53 | break; |
54 | 54 | case 'object': |
55 | 55 | $par = serialize($par); |
56 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
56 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
57 | 57 | break; |
58 | 58 | case 'resource': |
59 | 59 | if (is_resource($par) && get_resource_type($par) === 'stream') { |
60 | 60 | $par = stream_get_contents($par); |
61 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
61 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
62 | 62 | } else { |
63 | 63 | $par = serialize($par); |
64 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
64 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
65 | 65 | } |
66 | 66 | break; |
67 | 67 | default: |
68 | - $par = "'" . $this->lnk->escape_string((string)$par) . "'"; |
|
68 | + $par = "'".$this->lnk->escape_string((string) $par)."'"; |
|
69 | 69 | break; |
70 | 70 | } |
71 | 71 | $sql .= $par; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | if (isset($this->map)) { |
32 | 32 | $par = []; |
33 | 33 | foreach ($this->map as $key) { |
34 | - $par[] = $data[$key] ?? throw new DBException('Missing param ' . $key); |
|
34 | + $par[] = $data[$key] ?? throw new DBException('Missing param '.$key); |
|
35 | 35 | } |
36 | 36 | $data = $par; |
37 | 37 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | foreach ($lng as $index) { |
87 | 87 | if (is_resource($data[$index]) && get_resource_type($data[$index]) === 'stream') { |
88 | 88 | while (!feof($data[$index])) { |
89 | - $this->statement->send_long_data($index, (string)fread($data[$index], $lds)); |
|
89 | + $this->statement->send_long_data($index, (string) fread($data[$index], $lds)); |
|
90 | 90 | } |
91 | 91 | } else { |
92 | 92 | $data[$index] = str_split($data[$index], $lds); |
@@ -106,24 +106,24 @@ discard block |
||
106 | 106 | $res = false; |
107 | 107 | } |
108 | 108 | if (!$res) { |
109 | - if ($log && (int)$this->driver->option('log_errors', 1)) { |
|
109 | + if ($log && (int) $this->driver->option('log_errors', 1)) { |
|
110 | 110 | @file_put_contents( |
111 | 111 | $log, |
112 | - '--' . date('Y-m-d H:i:s') . ' ERROR: ' . $this->statement->error . "\r\n" . |
|
113 | - $this->sql . "\r\n" . |
|
112 | + '--'.date('Y-m-d H:i:s').' ERROR: '.$this->statement->error."\r\n". |
|
113 | + $this->sql."\r\n". |
|
114 | 114 | "\r\n", |
115 | 115 | FILE_APPEND |
116 | 116 | ); |
117 | 117 | } |
118 | - throw new DBException('Prepared execute error: ' . $this->statement->error); |
|
118 | + throw new DBException('Prepared execute error: '.$this->statement->error); |
|
119 | 119 | } |
120 | 120 | if ($log) { |
121 | 121 | $tm = microtime(true) - $tm; |
122 | - if ($tm >= (float)$this->driver->option('log_slow', 0)) { |
|
122 | + if ($tm >= (float) $this->driver->option('log_slow', 0)) { |
|
123 | 123 | @file_put_contents( |
124 | 124 | $log, |
125 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
126 | - $this->sql . "\r\n" . |
|
125 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
126 | + $this->sql."\r\n". |
|
127 | 127 | "\r\n", |
128 | 128 | FILE_APPEND |
129 | 129 | ); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | if (isset($this->map)) { |
37 | 37 | $par = []; |
38 | 38 | foreach ($this->map as $key) { |
39 | - $par[] = $data[$key] ?? throw new DBException('Missing param ' . $key); |
|
39 | + $par[] = $data[$key] ?? throw new DBException('Missing param '.$key); |
|
40 | 40 | } |
41 | 41 | $data = $par; |
42 | 42 | } |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | if (strpos(strtolower($statement), 'prepare') === 0) { |
26 | 26 | $this->drv->raw($this->statement); |
27 | 27 | if (!isset($this->name)) { |
28 | - $this->name = trim((preg_split('(\s+)', trim($this->statement))?:[])[1]??'', '"'); |
|
28 | + $this->name = trim((preg_split('(\s+)', trim($this->statement)) ?: [])[1] ?? '', '"'); |
|
29 | 29 | } |
30 | 30 | } elseif ($this->name !== null) { |
31 | 31 | $temp = \pg_prepare($this->driver, $this->name, $this->statement); |
32 | 32 | if (!$temp) { |
33 | 33 | $log = $this->drv->option('log_file'); |
34 | - if ($log && (int)$this->drv->option('log_errors', 1)) { |
|
34 | + if ($log && (int) $this->drv->option('log_errors', 1)) { |
|
35 | 35 | @file_put_contents( |
36 | 36 | $log, |
37 | - '--' . date('Y-m-d H:i:s') . ' ERROR PREPARING: ' . \pg_last_error($this->driver) . "\r\n" . |
|
38 | - $this->statement . "\r\n" . |
|
37 | + '--'.date('Y-m-d H:i:s').' ERROR PREPARING: '.\pg_last_error($this->driver)."\r\n". |
|
38 | + $this->statement."\r\n". |
|
39 | 39 | "\r\n", |
40 | 40 | FILE_APPEND |
41 | 41 | ); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | if (isset($this->map)) { |
58 | 58 | $par = []; |
59 | 59 | foreach ($this->map as $key) { |
60 | - $par[] = $data[$key] ?? throw new DBException('Missing param ' . $key); |
|
60 | + $par[] = $data[$key] ?? throw new DBException('Missing param '.$key); |
|
61 | 61 | } |
62 | 62 | $data = $par; |
63 | 63 | } |
@@ -68,22 +68,20 @@ discard block |
||
68 | 68 | try { |
69 | 69 | if ($this->name !== null) { |
70 | 70 | $temp = (count($data)) ? |
71 | - \pg_execute($this->driver, $this->name, $data) : |
|
72 | - \pg_execute($this->driver, $this->name, array()); |
|
71 | + \pg_execute($this->driver, $this->name, $data) : \pg_execute($this->driver, $this->name, array()); |
|
73 | 72 | } else { |
74 | 73 | $temp = (count($data)) ? |
75 | - \pg_query_params($this->driver, $this->statement, $data) : |
|
76 | - \pg_query_params($this->driver, $this->statement, array()); |
|
74 | + \pg_query_params($this->driver, $this->statement, $data) : \pg_query_params($this->driver, $this->statement, array()); |
|
77 | 75 | } |
78 | 76 | } catch (\Exception $e) { |
79 | 77 | $temp = false; |
80 | 78 | } |
81 | 79 | if (!$temp) { |
82 | - if ($log && (int)$this->drv->option('log_errors', 1)) { |
|
80 | + if ($log && (int) $this->drv->option('log_errors', 1)) { |
|
83 | 81 | @file_put_contents( |
84 | 82 | $log, |
85 | - '--' . date('Y-m-d H:i:s') . ' ERROR: ' . \pg_last_error($this->driver) . "\r\n" . |
|
86 | - $this->statement . "\r\n" . |
|
83 | + '--'.date('Y-m-d H:i:s').' ERROR: '.\pg_last_error($this->driver)."\r\n". |
|
84 | + $this->statement."\r\n". |
|
87 | 85 | "\r\n", |
88 | 86 | FILE_APPEND |
89 | 87 | ); |
@@ -92,11 +90,11 @@ discard block |
||
92 | 90 | } |
93 | 91 | if ($log) { |
94 | 92 | $tm = microtime(true) - $tm; |
95 | - if ($tm >= (float)$this->drv->option('log_slow', 0)) { |
|
93 | + if ($tm >= (float) $this->drv->option('log_slow', 0)) { |
|
96 | 94 | @file_put_contents( |
97 | 95 | $log, |
98 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
99 | - $this->statement . "\r\n" . |
|
96 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
97 | + $this->statement."\r\n". |
|
100 | 98 | "\r\n", |
101 | 99 | FILE_APPEND |
102 | 100 | ); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | if (isset($this->map)) { |
25 | 25 | $par = []; |
26 | 26 | foreach ($this->map as $key) { |
27 | - $par[] = $data[$key] ?? throw new DBException('Missing param ' . $key); |
|
27 | + $par[] = $data[$key] ?? throw new DBException('Missing param '.$key); |
|
28 | 28 | } |
29 | 29 | $data = $par; |
30 | 30 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | if (isset($this->map)) { |
27 | 27 | $par = []; |
28 | 28 | foreach ($this->map as $key) { |
29 | - $par[] = $data[$key] ?? throw new DBException('Missing param ' . $key); |
|
29 | + $par[] = $data[$key] ?? throw new DBException('Missing param '.$key); |
|
30 | 30 | } |
31 | 31 | $data = $par; |
32 | 32 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | if (isset($this->map)) { |
27 | 27 | $par = []; |
28 | 28 | foreach ($this->map as $key) { |
29 | - $par[] = $data[$key] ?? throw new DBException('Missing param ' . $key); |
|
29 | + $par[] = $data[$key] ?? throw new DBException('Missing param '.$key); |
|
30 | 30 | } |
31 | 31 | $data = $par; |
32 | 32 | } |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | if (!is_array($err)) { |
74 | 74 | $err = []; |
75 | 75 | } |
76 | - if ($log && (int)$this->driver->option('log_errors', 1)) { |
|
76 | + if ($log && (int) $this->driver->option('log_errors', 1)) { |
|
77 | 77 | @file_put_contents( |
78 | 78 | $log, |
79 | - '--' . date('Y-m-d H:i:s') . ' ERROR: ' . implode(',', $err) . "\r\n" . |
|
80 | - $this->sql . "\r\n" . |
|
79 | + '--'.date('Y-m-d H:i:s').' ERROR: '.implode(',', $err)."\r\n". |
|
80 | + $this->sql."\r\n". |
|
81 | 81 | "\r\n", |
82 | 82 | FILE_APPEND |
83 | 83 | ); |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | } |
87 | 87 | if ($log) { |
88 | 88 | $tm = microtime(true) - $tm; |
89 | - if ($tm >= (float)$this->driver->option('log_slow', 0)) { |
|
89 | + if ($tm >= (float) $this->driver->option('log_slow', 0)) { |
|
90 | 90 | @file_put_contents( |
91 | 91 | $log, |
92 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
93 | - $this->sql . "\r\n" . |
|
92 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
93 | + $this->sql."\r\n". |
|
94 | 94 | "\r\n", |
95 | 95 | FILE_APPEND |
96 | 96 | ); |