@@ -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]); |