@@ -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; |
@@ -62,8 +62,8 @@ |
||
62 | 62 | } |
63 | 63 | public function next(): void |
64 | 64 | { |
65 | - $this->fetched ++; |
|
66 | - $this->last = $this->statement->fetchArray(\SQLITE3_ASSOC)?:null; |
|
65 | + $this->fetched++; |
|
66 | + $this->last = $this->statement->fetchArray(\SQLITE3_ASSOC) ?: null; |
|
67 | 67 | } |
68 | 68 | public function valid(): bool |
69 | 69 | { |
@@ -67,8 +67,8 @@ |
||
67 | 67 | } |
68 | 68 | public function next(): void |
69 | 69 | { |
70 | - $this->fetched ++; |
|
71 | - $this->last = \ibase_fetch_assoc($this->result, \IBASE_TEXT)?:null; |
|
70 | + $this->fetched++; |
|
71 | + $this->last = \ibase_fetch_assoc($this->result, \IBASE_TEXT) ?: null; |
|
72 | 72 | } |
73 | 73 | public function valid(): bool |
74 | 74 | { |
@@ -71,7 +71,7 @@ |
||
71 | 71 | $this->softDetect($sql); |
72 | 72 | $statement = \ibase_prepare($this->transaction !== null ? $this->transaction : $this->lnk, $sql); |
73 | 73 | if ($statement === false) { |
74 | - throw new DBException('Prepare error: ' . \ibase_errmsg()); |
|
74 | + throw new DBException('Prepare error: '.\ibase_errmsg()); |
|
75 | 75 | } |
76 | 76 | return new Statement( |
77 | 77 | $statement, |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $this->query("ALTER SESSION SET time_zone = '".addslashes($timezone)."'"); |
45 | 45 | } |
46 | 46 | if ($schema = $this->option('schema')) { |
47 | - $this->query("ALTER SESSION SET CURRENT_SCHEMA = " . $schema); |
|
47 | + $this->query("ALTER SESSION SET CURRENT_SCHEMA = ".$schema); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | ); |
82 | 82 | if ($log) { |
83 | 83 | $tm = microtime(true) - $tm; |
84 | - if ($tm >= (float)$this->option('log_slow', 0)) { |
|
84 | + if ($tm >= (float) $this->option('log_slow', 0)) { |
|
85 | 85 | @file_put_contents( |
86 | 86 | $log, |
87 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
88 | - $sql . "\r\n" . |
|
87 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
88 | + $sql."\r\n". |
|
89 | 89 | "\r\n", |
90 | 90 | FILE_APPEND |
91 | 91 | ); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | public function affected() : int |
26 | 26 | { |
27 | - return (int)\oci_num_rows($this->statement); |
|
27 | + return (int) \oci_num_rows($this->statement); |
|
28 | 28 | } |
29 | 29 | public function insertID(string $sequence = null): mixed |
30 | 30 | { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function count(): int |
39 | 39 | { |
40 | - return (int)\oci_num_rows($this->statement); |
|
40 | + return (int) \oci_num_rows($this->statement); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function key(): mixed |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | } |
66 | 66 | public function next(): void |
67 | 67 | { |
68 | - $this->fetched ++; |
|
69 | - $this->last = \oci_fetch_array($this->statement, \OCI_ASSOC + \OCI_RETURN_NULLS + \OCI_RETURN_LOBS)?:null; |
|
68 | + $this->fetched++; |
|
69 | + $this->last = \oci_fetch_array($this->statement, \OCI_ASSOC +\OCI_RETURN_NULLS +\OCI_RETURN_LOBS) ?: null; |
|
70 | 70 | if (is_array($this->last)) { |
71 | 71 | $this->cast(); |
72 | 72 | } |
@@ -78,23 +78,23 @@ discard block |
||
78 | 78 | protected function cast(): void |
79 | 79 | { |
80 | 80 | if (!count($this->types)) { |
81 | - foreach (array_keys($this->last??[]) as $k => $v) { |
|
81 | + foreach (array_keys($this->last ?? []) as $k => $v) { |
|
82 | 82 | $this->types[$v] = \oci_field_type($this->statement, $k + 1); |
83 | 83 | if ($this->types[$v] === 'NUMBER') { |
84 | 84 | $scale = \oci_field_scale($this->statement, $k + 1); |
85 | 85 | $precision = \oci_field_precision($this->statement, $k + 1); |
86 | 86 | // true float |
87 | - if ((int)$scale === -127 && (int)$precision !== 0) { |
|
87 | + if ((int) $scale === -127 && (int) $precision !== 0) { |
|
88 | 88 | $this->types[$v] = 'FLOAT'; |
89 | 89 | } |
90 | 90 | // TODO: decimal |
91 | - if ((int)$scale > 0) { |
|
91 | + if ((int) $scale > 0) { |
|
92 | 92 | $this->types[$v] = 'DECIMAL'; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | - foreach ($this->last??[] as $k => $v) { |
|
97 | + foreach ($this->last ?? [] as $k => $v) { |
|
98 | 98 | if (!isset($this->types[$k])) { |
99 | 99 | continue; |
100 | 100 | } |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | } |
110 | 110 | switch ($this->types[$k]) { |
111 | 111 | case 'NUMBER': |
112 | - $this->last[$k] = (int)$v; |
|
112 | + $this->last[$k] = (int) $v; |
|
113 | 113 | break; |
114 | 114 | case 'FLOAT': |
115 | - $this->last[$k] = (float)$v; |
|
115 | + $this->last[$k] = (float) $v; |
|
116 | 116 | break; |
117 | 117 | } |
118 | 118 | } |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | if (isset($this->connection['opts']['search_path'])) { |
46 | 46 | @\pg_query( |
47 | 47 | $this->lnk, |
48 | - "SET search_path TO " . pg_escape_string($this->connection['opts']['search_path']) |
|
48 | + "SET search_path TO ".pg_escape_string($this->connection['opts']['search_path']) |
|
49 | 49 | ); |
50 | 50 | } |
51 | 51 | if (!isset($this->connection['opts']['search_path']) && isset($this->connection['opts']['schema'])) { |
52 | - @\pg_query($this->lnk, "SET search_path TO " . pg_escape_string($this->connection['opts']['schema'])); |
|
52 | + @\pg_query($this->lnk, "SET search_path TO ".pg_escape_string($this->connection['opts']['schema'])); |
|
53 | 53 | } |
54 | 54 | if (isset($this->connection['opts']['timezone'])) { |
55 | 55 | @\pg_query($this->lnk, "SET TIME ZONE '".pg_escape_string($this->connection['opts']['timezone'])."'"); |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | $res = \pg_query($this->lnk, $sql); |
88 | 88 | if ($log) { |
89 | 89 | $tm = microtime(true) - $tm; |
90 | - if ($tm >= (float)$this->option('log_slow', 0)) { |
|
90 | + if ($tm >= (float) $this->option('log_slow', 0)) { |
|
91 | 91 | @file_put_contents( |
92 | 92 | $log, |
93 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
94 | - $sql . "\r\n" . |
|
93 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
94 | + $sql."\r\n". |
|
95 | 95 | "\r\n", |
96 | 96 | FILE_APPEND |
97 | 97 | ); |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | $temp = @\pg_query( |
38 | 38 | $this->driver, |
39 | 39 | $sequence ? |
40 | - 'SELECT currval('.@\pg_escape_string($this->driver, $sequence).')' : |
|
41 | - 'SELECT lastval()' |
|
40 | + 'SELECT currval('.@\pg_escape_string($this->driver, $sequence).')' : 'SELECT lastval()' |
|
42 | 41 | ); |
43 | 42 | if ($temp) { |
44 | 43 | $res = \pg_fetch_row($temp); |
@@ -76,8 +75,8 @@ discard block |
||
76 | 75 | } |
77 | 76 | public function next(): void |
78 | 77 | { |
79 | - $this->fetched ++; |
|
80 | - $this->last = \pg_fetch_array($this->statement, null, \PGSQL_ASSOC)?:null; |
|
78 | + $this->fetched++; |
|
79 | + $this->last = \pg_fetch_array($this->statement, null, \PGSQL_ASSOC) ?: null; |
|
81 | 80 | if (is_array($this->last)) { |
82 | 81 | $this->cast(); |
83 | 82 | } |
@@ -90,11 +89,11 @@ discard block |
||
90 | 89 | protected function cast(): void |
91 | 90 | { |
92 | 91 | if (!count($this->types)) { |
93 | - foreach (array_keys($this->last??[]) as $k => $v) { |
|
92 | + foreach (array_keys($this->last ?? []) as $k => $v) { |
|
94 | 93 | $this->types[$v] = \pg_field_type($this->statement, $k); |
95 | 94 | } |
96 | 95 | } |
97 | - foreach ($this->last??[] as $k => $v) { |
|
96 | + foreach ($this->last ?? [] as $k => $v) { |
|
98 | 97 | if (is_null($v) || !isset($this->types[$k])) { |
99 | 98 | continue; |
100 | 99 | } |
@@ -102,15 +101,15 @@ discard block |
||
102 | 101 | case 'int2': |
103 | 102 | case 'int4': |
104 | 103 | case 'int8': |
105 | - $this->last[$k] = (int)$v; |
|
104 | + $this->last[$k] = (int) $v; |
|
106 | 105 | break; |
107 | 106 | case 'bit': |
108 | 107 | case 'bool': |
109 | - $this->last[$k] = $v !== 'f' && (int)$v ? true : false; |
|
108 | + $this->last[$k] = $v !== 'f' && (int) $v ? true : false; |
|
110 | 109 | break; |
111 | 110 | case 'float4': |
112 | 111 | case 'float8': |
113 | - $this->last[$k] = (float)$v; |
|
112 | + $this->last[$k] = (float) $v; |
|
114 | 113 | break; |
115 | 114 | case 'money': |
116 | 115 | case 'numeric': |