@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | if ($this->lnk === null) { |
39 | 39 | $this->lnk = new \mysqli( |
40 | - (isset($this->connection['opts']['persist']) && $this->connection['opts']['persist'] ? 'p:' : '') . |
|
40 | + (isset($this->connection['opts']['persist']) && $this->connection['opts']['persist'] ? 'p:' : ''). |
|
41 | 41 | $this->connection['host'], |
42 | 42 | $this->connection['user'], |
43 | 43 | $this->connection['pass'], |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | $res = $this->lnk->query($sql); |
98 | 98 | if ($log) { |
99 | 99 | $tm = microtime(true) - $tm; |
100 | - if ($tm >= (float)$this->option('log_slow', 0)) { |
|
100 | + if ($tm >= (float) $this->option('log_slow', 0)) { |
|
101 | 101 | @file_put_contents( |
102 | 102 | $log, |
103 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
104 | - $sql . "\r\n" . |
|
103 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
104 | + $sql."\r\n". |
|
105 | 105 | "\r\n", |
106 | 106 | FILE_APPEND |
107 | 107 | ); |
@@ -47,8 +47,7 @@ |
||
47 | 47 | if (isset($this->definition->getRelations()[$method])) { |
48 | 48 | if (array_key_exists($method, $this->fetched)) { |
49 | 49 | return is_callable($this->fetched[$method]) ? |
50 | - $this->fetched[$method] = call_user_func_array($this->fetched[$method], $args) : |
|
51 | - $this->fetched[$method]; |
|
50 | + $this->fetched[$method] = call_user_func_array($this->fetched[$method], $args) : $this->fetched[$method]; |
|
52 | 51 | } |
53 | 52 | } |
54 | 53 | return null; |
@@ -57,8 +57,8 @@ |
||
57 | 57 | } |
58 | 58 | public function next(): void |
59 | 59 | { |
60 | - $this->fetched ++; |
|
61 | - $this->last = $this->statement->fetch(\PDO::FETCH_ASSOC)?:null; |
|
60 | + $this->fetched++; |
|
61 | + $this->last = $this->statement->fetch(\PDO::FETCH_ASSOC) ?: null; |
|
62 | 62 | } |
63 | 63 | public function valid(): bool |
64 | 64 | { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | if ($temp) { |
33 | 33 | $temp = $temp->fetch_fields(); |
34 | 34 | if ($temp) { |
35 | - $columns = array_map(function ($v) { |
|
35 | + $columns = array_map(function($v) { |
|
36 | 36 | return $v->name; |
37 | 37 | }, $temp); |
38 | 38 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | public function affected() : int |
55 | 55 | { |
56 | - return (int)$this->statement->affected_rows; |
|
56 | + return (int) $this->statement->affected_rows; |
|
57 | 57 | } |
58 | 58 | public function insertID(string $sequence = null): mixed |
59 | 59 | { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | public function current(): mixed |
77 | 77 | { |
78 | - return $this->nativeDriver ? $this->last : array_map(function ($v) { |
|
78 | + return $this->nativeDriver ? $this->last : array_map(function($v) { |
|
79 | 79 | return $v; |
80 | 80 | }, $this->row); |
81 | 81 | } |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | } |
95 | 95 | public function next(): void |
96 | 96 | { |
97 | - $this->fetched ++; |
|
98 | - $this->last = $this->nativeDriver ? ($this->result->fetch_assoc()?:null) : $this->statement->fetch(); |
|
97 | + $this->fetched++; |
|
98 | + $this->last = $this->nativeDriver ? ($this->result->fetch_assoc() ?: null) : $this->statement->fetch(); |
|
99 | 99 | } |
100 | 100 | public function valid(): bool |
101 | 101 | { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | foreach ($lng as $index) { |
78 | 78 | if (is_resource($data[$index]) && get_resource_type($data[$index]) === 'stream') { |
79 | 79 | while (!feof($data[$index])) { |
80 | - $this->statement->send_long_data($index, (string)fread($data[$index], $lds)); |
|
80 | + $this->statement->send_long_data($index, (string) fread($data[$index], $lds)); |
|
81 | 81 | } |
82 | 82 | } else { |
83 | 83 | $data[$index] = str_split($data[$index], $lds); |
@@ -92,24 +92,24 @@ discard block |
||
92 | 92 | $tm = microtime(true); |
93 | 93 | } |
94 | 94 | if (!$this->statement->execute()) { |
95 | - if ($log && (int)$this->driver->option('log_errors', 1)) { |
|
95 | + if ($log && (int) $this->driver->option('log_errors', 1)) { |
|
96 | 96 | @file_put_contents( |
97 | 97 | $log, |
98 | - '--' . date('Y-m-d H:i:s') . ' ERROR: ' . $this->statement->error . "\r\n" . |
|
99 | - $this->sql . "\r\n" . |
|
98 | + '--'.date('Y-m-d H:i:s').' ERROR: '.$this->statement->error."\r\n". |
|
99 | + $this->sql."\r\n". |
|
100 | 100 | "\r\n", |
101 | 101 | FILE_APPEND |
102 | 102 | ); |
103 | 103 | } |
104 | - throw new DBException('Prepared execute error: ' . $this->statement->error); |
|
104 | + throw new DBException('Prepared execute error: '.$this->statement->error); |
|
105 | 105 | } |
106 | 106 | if ($log) { |
107 | 107 | $tm = microtime(true) - $tm; |
108 | - if ($tm >= (float)$this->driver->option('log_slow', 0)) { |
|
108 | + if ($tm >= (float) $this->driver->option('log_slow', 0)) { |
|
109 | 109 | @file_put_contents( |
110 | 110 | $log, |
111 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
112 | - $this->sql . "\r\n" . |
|
111 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
112 | + $this->sql."\r\n". |
|
113 | 113 | "\r\n", |
114 | 114 | FILE_APPEND |
115 | 115 | ); |
@@ -57,8 +57,8 @@ |
||
57 | 57 | } |
58 | 58 | public function next(): void |
59 | 59 | { |
60 | - $this->fetched ++; |
|
61 | - $this->last = $this->result->fetch_assoc()?:null; |
|
60 | + $this->fetched++; |
|
61 | + $this->last = $this->result->fetch_assoc() ?: null; |
|
62 | 62 | } |
63 | 63 | public function valid(): bool |
64 | 64 | { |
@@ -40,23 +40,23 @@ |
||
40 | 40 | break; |
41 | 41 | case 'array': |
42 | 42 | $par = implode(',', $par); |
43 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
43 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
44 | 44 | break; |
45 | 45 | case 'object': |
46 | 46 | $par = serialize($par); |
47 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
47 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
48 | 48 | break; |
49 | 49 | case 'resource': |
50 | 50 | if (is_resource($par) && get_resource_type($par) === 'stream') { |
51 | 51 | $par = stream_get_contents($par); |
52 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
52 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
53 | 53 | } else { |
54 | 54 | $par = serialize($par); |
55 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
55 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
56 | 56 | } |
57 | 57 | break; |
58 | 58 | default: |
59 | - $par = "'" . $this->lnk->escape_string((string)$par) . "'"; |
|
59 | + $par = "'".$this->lnk->escape_string((string) $par)."'"; |
|
60 | 60 | break; |
61 | 61 | } |
62 | 62 | $sql .= $par; |
@@ -78,7 +78,7 @@ |
||
78 | 78 | } |
79 | 79 | public function next(): void |
80 | 80 | { |
81 | - $this->fetched ++; |
|
81 | + $this->fetched++; |
|
82 | 82 | $temp = \odbc_fetch_row($this->statement); |
83 | 83 | if (!$temp) { |
84 | 84 | $this->last = null; |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | if (strpos(strtolower($statement), 'prepare') === 0) { |
24 | 24 | $this->drv->raw($this->statement); |
25 | 25 | if (!isset($this->name)) { |
26 | - $this->name = trim((preg_split('(\s+)', trim($this->statement))?:[])[1]??'', '"'); |
|
26 | + $this->name = trim((preg_split('(\s+)', trim($this->statement)) ?: [])[1] ?? '', '"'); |
|
27 | 27 | } |
28 | 28 | } elseif ($this->name !== null) { |
29 | 29 | $temp = \pg_prepare($this->driver, $this->name, $this->statement); |
30 | 30 | if (!$temp) { |
31 | 31 | $log = $this->drv->option('log_file'); |
32 | - if ($log && (int)$this->drv->option('log_errors', 1)) { |
|
32 | + if ($log && (int) $this->drv->option('log_errors', 1)) { |
|
33 | 33 | @file_put_contents( |
34 | 34 | $log, |
35 | - '--' . date('Y-m-d H:i:s') . ' ERROR PREPARING: ' . \pg_last_error($this->driver) . "\r\n" . |
|
36 | - $this->statement . "\r\n" . |
|
35 | + '--'.date('Y-m-d H:i:s').' ERROR PREPARING: '.\pg_last_error($this->driver)."\r\n". |
|
36 | + $this->statement."\r\n". |
|
37 | 37 | "\r\n", |
38 | 38 | FILE_APPEND |
39 | 39 | ); |
@@ -59,19 +59,17 @@ discard block |
||
59 | 59 | } |
60 | 60 | if ($this->name !== null) { |
61 | 61 | $temp = (is_array($data) && count($data)) ? |
62 | - \pg_execute($this->driver, $this->name, $data) : |
|
63 | - \pg_execute($this->driver, $this->name, array()); |
|
62 | + \pg_execute($this->driver, $this->name, $data) : \pg_execute($this->driver, $this->name, array()); |
|
64 | 63 | } else { |
65 | 64 | $temp = (is_array($data) && count($data)) ? |
66 | - \pg_query_params($this->driver, $this->statement, $data) : |
|
67 | - \pg_query_params($this->driver, $this->statement, array()); |
|
65 | + \pg_query_params($this->driver, $this->statement, $data) : \pg_query_params($this->driver, $this->statement, array()); |
|
68 | 66 | } |
69 | 67 | if (!$temp) { |
70 | - if ($log && (int)$this->drv->option('log_errors', 1)) { |
|
68 | + if ($log && (int) $this->drv->option('log_errors', 1)) { |
|
71 | 69 | @file_put_contents( |
72 | 70 | $log, |
73 | - '--' . date('Y-m-d H:i:s') . ' ERROR: ' . \pg_last_error($this->driver) . "\r\n" . |
|
74 | - $this->statement . "\r\n" . |
|
71 | + '--'.date('Y-m-d H:i:s').' ERROR: '.\pg_last_error($this->driver)."\r\n". |
|
72 | + $this->statement."\r\n". |
|
75 | 73 | "\r\n", |
76 | 74 | FILE_APPEND |
77 | 75 | ); |
@@ -80,11 +78,11 @@ discard block |
||
80 | 78 | } |
81 | 79 | if ($log) { |
82 | 80 | $tm = microtime(true) - $tm; |
83 | - if ($tm >= (float)$this->drv->option('log_slow', 0)) { |
|
81 | + if ($tm >= (float) $this->drv->option('log_slow', 0)) { |
|
84 | 82 | @file_put_contents( |
85 | 83 | $log, |
86 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
87 | - $this->statement . "\r\n" . |
|
84 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
85 | + $this->statement."\r\n". |
|
88 | 86 | "\r\n", |
89 | 87 | FILE_APPEND |
90 | 88 | ); |