@@ -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 | ); |
@@ -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': |
@@ -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); |
@@ -97,24 +97,24 @@ discard block |
||
| 97 | 97 | $res = false; |
| 98 | 98 | } |
| 99 | 99 | if (!$res) { |
| 100 | - if ($log && (int)$this->driver->option('log_errors', 1)) { |
|
| 100 | + if ($log && (int) $this->driver->option('log_errors', 1)) { |
|
| 101 | 101 | @file_put_contents( |
| 102 | 102 | $log, |
| 103 | - '--' . date('Y-m-d H:i:s') . ' ERROR: ' . $this->statement->error . "\r\n" . |
|
| 104 | - $this->sql . "\r\n" . |
|
| 103 | + '--'.date('Y-m-d H:i:s').' ERROR: '.$this->statement->error."\r\n". |
|
| 104 | + $this->sql."\r\n". |
|
| 105 | 105 | "\r\n", |
| 106 | 106 | FILE_APPEND |
| 107 | 107 | ); |
| 108 | 108 | } |
| 109 | - throw new DBException('Prepared execute error: ' . $this->statement->error); |
|
| 109 | + throw new DBException('Prepared execute error: '.$this->statement->error); |
|
| 110 | 110 | } |
| 111 | 111 | if ($log) { |
| 112 | 112 | $tm = microtime(true) - $tm; |
| 113 | - if ($tm >= (float)$this->driver->option('log_slow', 0)) { |
|
| 113 | + if ($tm >= (float) $this->driver->option('log_slow', 0)) { |
|
| 114 | 114 | @file_put_contents( |
| 115 | 115 | $log, |
| 116 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
| 117 | - $this->sql . "\r\n" . |
|
| 116 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
| 117 | + $this->sql."\r\n". |
|
| 118 | 118 | "\r\n", |
| 119 | 119 | FILE_APPEND |
| 120 | 120 | ); |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | if ($this->lnk === null) { |
| 39 | 39 | try { |
| 40 | 40 | $this->lnk = new \SQLite3($this->connection['name']); |
| 41 | - $this->lnk->exec('PRAGMA encoding = "'.$this->option('charset', 'utf-8') . '"'); |
|
| 41 | + $this->lnk->exec('PRAGMA encoding = "'.$this->option('charset', 'utf-8').'"'); |
|
| 42 | 42 | } catch (\Exception $e) { |
| 43 | 43 | if ($this->lnk !== null) { |
| 44 | 44 | throw new DBException('Connect error: '.$this->lnk->lastErrorMsg()); |