@@ -133,20 +133,20 @@ discard block |
||
133 | 133 | */ |
134 | 134 | if (!in_array($this->type, ['TEXT', 'NTEXT', 'IMAGE'])) { |
135 | 135 | $query = sprintf('SELECT COUNT(*) AS COUNT FROM (SELECT %s FROM %s.%s GROUP BY %s) distinctvalues', |
136 | - $this->connection->quoteIdentifier($this->name), |
|
137 | - $this->connection->quoteIdentifier($this->database), |
|
138 | - $this->connection->quoteIdentifier($this->table), |
|
139 | - $this->connection->quoteIdentifier($this->name)); |
|
136 | + $this->connection->quoteIdentifier($this->name), |
|
137 | + $this->connection->quoteIdentifier($this->database), |
|
138 | + $this->connection->quoteIdentifier($this->table), |
|
139 | + $this->connection->quoteIdentifier($this->name)); |
|
140 | 140 | $this->distinctValues = $this->connection->query($query)->fetchAssoc(false)['COUNT']; |
141 | 141 | } |
142 | 142 | |
143 | 143 | if (!in_array($this->type, ['BIT', 'TEXT', 'NTEXT', 'IMAGE', 'UNIQUEIDENTIFIER'])) { |
144 | 144 | $query = sprintf('SELECT MIN(%s) AS ROWMIN, MAX(%s) AS ROWMAX FROM %s.%s WHERE %s IS NOT NULL', |
145 | - $this->connection->quoteIdentifier($this->name), |
|
146 | - $this->connection->quoteIdentifier($this->name), |
|
147 | - $this->connection->quoteIdentifier($this->database), |
|
148 | - $this->connection->quoteIdentifier($this->table), |
|
149 | - $this->connection->quoteIdentifier($this->name)); |
|
145 | + $this->connection->quoteIdentifier($this->name), |
|
146 | + $this->connection->quoteIdentifier($this->name), |
|
147 | + $this->connection->quoteIdentifier($this->database), |
|
148 | + $this->connection->quoteIdentifier($this->table), |
|
149 | + $this->connection->quoteIdentifier($this->name)); |
|
150 | 150 | $data = $this->connection->query($query)->fetchAssoc(false); |
151 | 151 | $this->maxValue = $data['ROWMAX']; |
152 | 152 | $this->minValue = $data['ROWMIN']; |
@@ -223,10 +223,10 @@ discard block |
||
223 | 223 | * Work out whether date or datetime |
224 | 224 | */ |
225 | 225 | $query = sprintf("SELECT COUNT(*) AS COUNT FROM %s.%s WHERE %s IS NOT NULL AND CONVERT(VARCHAR(8), %s, 108) != '00:00:00'", |
226 | - $this->connection->quoteIdentifier($this->database), |
|
227 | - $this->connection->quoteIdentifier($this->table), |
|
228 | - $this->connection->quoteIdentifier($this->name), |
|
229 | - $this->connection->quoteIdentifier($this->name)); |
|
226 | + $this->connection->quoteIdentifier($this->database), |
|
227 | + $this->connection->quoteIdentifier($this->table), |
|
228 | + $this->connection->quoteIdentifier($this->name), |
|
229 | + $this->connection->quoteIdentifier($this->name)); |
|
230 | 230 | $rows = $this->connection->query($query)->fetchAssoc(false); |
231 | 231 | |
232 | 232 | if ($rows['COUNT'] > 0) { |
@@ -137,18 +137,18 @@ |
||
137 | 137 | * Metadata from the data stored |
138 | 138 | */ |
139 | 139 | $query = sprintf('SELECT COUNT(*) AS COUNT FROM (SELECT %s FROM %s.%s GROUP BY %s) distinctvalues', |
140 | - $this->connection->quoteIdentifier($this->name), |
|
141 | - $this->connection->quoteIdentifier($this->database), |
|
142 | - $this->connection->quoteIdentifier($this->table), |
|
143 | - $this->connection->quoteIdentifier($this->name)); |
|
140 | + $this->connection->quoteIdentifier($this->name), |
|
141 | + $this->connection->quoteIdentifier($this->database), |
|
142 | + $this->connection->quoteIdentifier($this->table), |
|
143 | + $this->connection->quoteIdentifier($this->name)); |
|
144 | 144 | $this->distinctValues = $this->connection->query($query)->fetchAssoc(false)['COUNT']; |
145 | 145 | |
146 | 146 | $query = sprintf('SELECT MIN(%s) AS ROWMIN, MAX(%s) AS ROWMAX FROM %s.%s WHERE %s IS NOT NULL', |
147 | - $this->connection->quoteIdentifier($this->name), |
|
148 | - $this->connection->quoteIdentifier($this->name), |
|
149 | - $this->connection->quoteIdentifier($this->database), |
|
150 | - $this->connection->quoteIdentifier($this->table), |
|
151 | - $this->connection->quoteIdentifier($this->name)); |
|
147 | + $this->connection->quoteIdentifier($this->name), |
|
148 | + $this->connection->quoteIdentifier($this->name), |
|
149 | + $this->connection->quoteIdentifier($this->database), |
|
150 | + $this->connection->quoteIdentifier($this->table), |
|
151 | + $this->connection->quoteIdentifier($this->name)); |
|
152 | 152 | $data = $this->connection->query($query)->fetchAssoc(false); |
153 | 153 | $this->maxValue = $data['ROWMAX']; |
154 | 154 | $this->minValue = $data['ROWMIN']; |
@@ -134,27 +134,27 @@ discard block |
||
134 | 134 | */ |
135 | 135 | try { |
136 | 136 | $query = sprintf('SELECT COUNT(*) AS COUNT FROM (SELECT %s FROM %s.%s GROUP BY %s) distinctvalues', |
137 | - $this->connection->quoteIdentifier($this->name), |
|
138 | - $this->connection->quoteIdentifier($this->database), |
|
139 | - $this->connection->quoteIdentifier($this->table), |
|
140 | - $this->connection->quoteIdentifier($this->name)); |
|
137 | + $this->connection->quoteIdentifier($this->name), |
|
138 | + $this->connection->quoteIdentifier($this->database), |
|
139 | + $this->connection->quoteIdentifier($this->table), |
|
140 | + $this->connection->quoteIdentifier($this->name)); |
|
141 | 141 | $this->distinctValues = $this->connection->query($query)->fetchAssoc(false)['COUNT']; |
142 | 142 | |
143 | 143 | $query = sprintf('SELECT MIN(%s) AS ROWMIN, MAX(%s) AS ROWMAX FROM %s.%s WHERE %s IS NOT NULL', |
144 | - $this->connection->quoteIdentifier($this->name), |
|
145 | - $this->connection->quoteIdentifier($this->name), |
|
146 | - $this->connection->quoteIdentifier($this->database), |
|
147 | - $this->connection->quoteIdentifier($this->table), |
|
148 | - $this->connection->quoteIdentifier($this->name)); |
|
144 | + $this->connection->quoteIdentifier($this->name), |
|
145 | + $this->connection->quoteIdentifier($this->name), |
|
146 | + $this->connection->quoteIdentifier($this->database), |
|
147 | + $this->connection->quoteIdentifier($this->table), |
|
148 | + $this->connection->quoteIdentifier($this->name)); |
|
149 | 149 | $data = $this->connection->query($query)->fetchAssoc(false); |
150 | 150 | $this->maxValue = $data['ROWMAX']; |
151 | 151 | $this->minValue = $data['ROWMIN']; |
152 | 152 | } catch (\Exception $e) { //LONG column has restrictions on querying, so just get total value count |
153 | 153 | if (strpos($e->getMessage(), 'ORA-00997: illegal use of LONG datatype') !== false) { |
154 | 154 | $query = sprintf('SELECT COUNT(*) AS COUNT FROM %s.%s WHERE %s IS NOT NULL', |
155 | - $this->connection->quoteIdentifier($this->database), |
|
156 | - $this->connection->quoteIdentifier($this->table), |
|
157 | - $this->connection->quoteIdentifier($this->name)); |
|
155 | + $this->connection->quoteIdentifier($this->database), |
|
156 | + $this->connection->quoteIdentifier($this->table), |
|
157 | + $this->connection->quoteIdentifier($this->name)); |
|
158 | 158 | $this->distinctValues = $this->connection->query($query)->fetchAssoc(false)['COUNT'] ?: 1; |
159 | 159 | } |
160 | 160 | } |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | * Work out whether date or datetime |
252 | 252 | */ |
253 | 253 | $query = sprintf("SELECT COUNT(*) AS COUNT FROM %s.%s WHERE %s IS NOT NULL AND TO_CHAR(%s, 'SSSSS') > 0", |
254 | - $this->connection->quoteIdentifier($this->database), |
|
255 | - $this->connection->quoteIdentifier($this->table), |
|
256 | - $this->connection->quoteIdentifier($this->name), |
|
257 | - $this->connection->quoteIdentifier($this->name)); |
|
254 | + $this->connection->quoteIdentifier($this->database), |
|
255 | + $this->connection->quoteIdentifier($this->table), |
|
256 | + $this->connection->quoteIdentifier($this->name), |
|
257 | + $this->connection->quoteIdentifier($this->name)); |
|
258 | 258 | $rows = $this->connection->query($query)->fetchAssoc(false); |
259 | 259 | |
260 | 260 | if ($rows['COUNT'] > 0) { |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | if (in_array($MySQLType, ['ENUM', 'SET'])) { |
30 | 30 | $query = sprintf('SHOW COLUMNS FROM %s.%s LIKE %s', |
31 | - $this->connection->quoteIdentifier($this->database), |
|
32 | - $this->connection->quoteIdentifier($this->table), |
|
33 | - $this->connection->escape($this->name)); |
|
31 | + $this->connection->quoteIdentifier($this->database), |
|
32 | + $this->connection->quoteIdentifier($this->table), |
|
33 | + $this->connection->escape($this->name)); |
|
34 | 34 | |
35 | 35 | $statement = $this->connection->query($query); |
36 | 36 | $values = $statement->fetchAssoc(false)['Type']; |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | $def .= '(' . implode(', ', array_map(function ($c) {return "'" . addslashes($c) . "'"; }, $values)) . ')'; |
43 | 43 | } elseif (in_array($MySQLType, ['CHAR', 'VARCHAR']) && $this->getLength() < 64 && $this->getDistinctValueCount() <= 16) { |
44 | 44 | $query = sprintf('SELECT DISTINCT %s FROM %s.%s WHERE %s IS NOT NULL ORDER BY %s ASC', |
45 | - $this->connection->quoteIdentifier($this->name), |
|
46 | - $this->connection->quoteIdentifier($this->database), |
|
47 | - $this->connection->quoteIdentifier($this->table), |
|
48 | - $this->connection->quoteIdentifier($this->name), |
|
49 | - $this->connection->quoteIdentifier($this->name)); |
|
45 | + $this->connection->quoteIdentifier($this->name), |
|
46 | + $this->connection->quoteIdentifier($this->database), |
|
47 | + $this->connection->quoteIdentifier($this->table), |
|
48 | + $this->connection->quoteIdentifier($this->name), |
|
49 | + $this->connection->quoteIdentifier($this->name)); |
|
50 | 50 | $values = []; |
51 | 51 | foreach ($this->connection->query($query) as $value) { |
52 | 52 | $values[] = trim($value[$this->name]); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | asort($values); |
40 | 40 | |
41 | 41 | $def .= $MySQLType; |
42 | - $def .= '(' . implode(', ', array_map(function ($c) {return "'" . addslashes($c) . "'"; }, $values)) . ')'; |
|
42 | + $def .= '(' . implode(', ', array_map(function($c) {return "'" . addslashes($c) . "'"; }, $values)) . ')'; |
|
43 | 43 | } elseif (in_array($MySQLType, ['CHAR', 'VARCHAR']) && $this->getLength() < 64 && $this->getDistinctValueCount() <= 16) { |
44 | 44 | $query = sprintf('SELECT DISTINCT %s FROM %s.%s WHERE %s IS NOT NULL ORDER BY %s ASC', |
45 | 45 | $this->connection->quoteIdentifier($this->name), |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | if ($values) { |
58 | 58 | $def .= 'ENUM'; |
59 | - $def .= '(' . implode(', ', array_map(function ($c) {return "'" . addslashes($c) . "'"; }, $values)) . ')'; |
|
59 | + $def .= '(' . implode(', ', array_map(function($c) {return "'" . addslashes($c) . "'"; }, $values)) . ')'; |
|
60 | 60 | } else { |
61 | 61 | $def .= $MySQLType; |
62 | 62 | if ($this->getLength() > 0) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | } elseif (in_array($MySQLType, ['DATETIME', 'TIMESTAMP', 'TIME'])) { |
67 | 67 | $def .= $MySQLType; |
68 | - $def .= '(' . (int) $this->getScale() . ')'; |
|
68 | + $def .= '(' . (int)$this->getScale() . ')'; |
|
69 | 69 | } else { |
70 | 70 | $def .= $MySQLType; |
71 | 71 |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | switch ($aParamType) { |
70 | 70 | case self::PARAM_IS_INT: |
71 | 71 | if (is_int($aParam) || ctype_digit($aParam)) { |
72 | - return (int) $aParam; |
|
72 | + return (int)$aParam; |
|
73 | 73 | } else { |
74 | 74 | throw new \RuntimeException("Parameter {$aParam} is not an integer"); |
75 | 75 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | if ($length <= 191) { //skip index if too long for MySQL |
129 | 129 | $tableDef .= ',' . PHP_EOL . PHP_EOL; |
130 | 130 | $tableDef .= 'PRIMARY KEY ('; |
131 | - $tableDef .= implode(', ' . PHP_EOL, array_map(function ($c) {return '`' . strtolower($c) . '`'; }, $primaryKey)); |
|
131 | + $tableDef .= implode(', ' . PHP_EOL, array_map(function($c) {return '`' . strtolower($c) . '`'; }, $primaryKey)); |
|
132 | 132 | $tableDef .= ')'; |
133 | 133 | } |
134 | 134 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | $tableDef .= ',' . PHP_EOL; |
154 | 154 | $tableDef .= 'KEY `' . strtolower($indexName) . '` ('; |
155 | - $tableDef .= implode(', ', array_map(function ($c) {return '`' . strtolower($c) . '`'; }, $indexColumns)); |
|
155 | + $tableDef .= implode(', ', array_map(function($c) {return '`' . strtolower($c) . '`'; }, $indexColumns)); |
|
156 | 156 | $tableDef .= ')'; |
157 | 157 | } |
158 | 158 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if ($primaryKey) { |
195 | 195 | $tableDef .= ',' . PHP_EOL . PHP_EOL; |
196 | 196 | $tableDef .= 'PRIMARY KEY ('; |
197 | - $tableDef .= implode(', ' . PHP_EOL, array_map(function ($c) {return '"' . strtolower($c) . '"'; }, $primaryKey)); |
|
197 | + $tableDef .= implode(', ' . PHP_EOL, array_map(function($c) {return '"' . strtolower($c) . '"'; }, $primaryKey)); |
|
198 | 198 | $tableDef .= ')'; |
199 | 199 | } |
200 | 200 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | } |
208 | 208 | $tableDef .= ',' . PHP_EOL; |
209 | 209 | $tableDef .= 'KEY `' . strtolower($indexName) . '` ('; |
210 | - $tableDef .= implode(', ', array_map(function ($c) {return '"' . strtolower($c) . '"'; }, $indexColumns)); |
|
210 | + $tableDef .= implode(', ', array_map(function($c) {return '"' . strtolower($c) . '"'; }, $indexColumns)); |
|
211 | 211 | $tableDef .= ')'; |
212 | 212 | } |
213 | 213 | } |