@@ -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']; |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | - * Primary key column(s) |
|
| 101 | - * @param string $aDatabase database/schema name |
|
| 102 | - * @param string $aTable table name |
|
| 103 | - * @return array |
|
| 104 | - */ |
|
| 100 | + * Primary key column(s) |
|
| 101 | + * @param string $aDatabase database/schema name |
|
| 102 | + * @param string $aTable table name |
|
| 103 | + * @return array |
|
| 104 | + */ |
|
| 105 | 105 | public function getPrimaryKey($aDatabase, $aTable) { |
| 106 | 106 | $columns = array(); |
| 107 | 107 | $SQL = "SELECT ind.name AS INDEX_NAME, |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param string $aDatabase database/schema name |
| 151 | 151 | * @param string $aTable table name |
| 152 | 152 | * @return array |
| 153 | - */ |
|
| 153 | + */ |
|
| 154 | 154 | public function getIndexes($aDatabase, $aTable) { |
| 155 | 155 | |
| 156 | 156 | $indexes = array(); |
@@ -133,20 +133,20 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | if (!in_array($this->type, array('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, array('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']; |
@@ -221,10 +221,10 @@ discard block |
||
| 221 | 221 | * Work out whether date or datetime |
| 222 | 222 | */ |
| 223 | 223 | $query = sprintf("SELECT COUNT(*) AS COUNT FROM %s.%s WHERE %s IS NOT NULL AND CONVERT(VARCHAR(8), %s, 108) != '00:00:00'", |
| 224 | - $this->connection->quoteIdentifier($this->database), |
|
| 225 | - $this->connection->quoteIdentifier($this->table), |
|
| 226 | - $this->connection->quoteIdentifier($this->name), |
|
| 227 | - $this->connection->quoteIdentifier($this->name)); |
|
| 224 | + $this->connection->quoteIdentifier($this->database), |
|
| 225 | + $this->connection->quoteIdentifier($this->table), |
|
| 226 | + $this->connection->quoteIdentifier($this->name), |
|
| 227 | + $this->connection->quoteIdentifier($this->name)); |
|
| 228 | 228 | $rows = $this->connection->query($query)->fetchAssoc(false); |
| 229 | 229 | |
| 230 | 230 | if ($rows['COUNT'] > 0) { |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | case 'SMALLDATETIME': |
| 341 | 341 | case 'DATETIMEOFFSET': |
| 342 | 342 | if ($this->precision) { |
| 343 | - return 'TIMESTAMP'; |
|
| 343 | + return 'TIMESTAMP'; |
|
| 344 | 344 | } |
| 345 | 345 | else { |
| 346 | 346 | return 'DATE'; |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | if (in_array($MySQLType, array('ENUM', 'SET'))) { |
| 31 | 31 | $query = sprintf("SHOW COLUMNS FROM %s.%s LIKE %s", |
| 32 | - $this->connection->quoteIdentifier($this->database), |
|
| 33 | - $this->connection->quoteIdentifier($this->table), |
|
| 34 | - $this->connection->escape($this->name)); |
|
| 32 | + $this->connection->quoteIdentifier($this->database), |
|
| 33 | + $this->connection->quoteIdentifier($this->table), |
|
| 34 | + $this->connection->escape($this->name)); |
|
| 35 | 35 | |
| 36 | 36 | $statement = $this->connection->query($query); |
| 37 | 37 | $values = $statement->fetchAssoc(false)['Type']; |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | else if (in_array($MySQLType, array('CHAR', 'VARCHAR')) && $this->getLength() < 64 && $this->getDistinctValueCount() <= 16) { |
| 46 | 46 | $query = sprintf("SELECT DISTINCT %s FROM %s.%s WHERE %s IS NOT NULL ORDER BY %s ASC", |
| 47 | - $this->connection->quoteIdentifier($this->name), |
|
| 48 | - $this->connection->quoteIdentifier($this->database), |
|
| 49 | - $this->connection->quoteIdentifier($this->table), |
|
| 50 | - $this->connection->quoteIdentifier($this->name), |
|
| 51 | - $this->connection->quoteIdentifier($this->name)); |
|
| 47 | + $this->connection->quoteIdentifier($this->name), |
|
| 48 | + $this->connection->quoteIdentifier($this->database), |
|
| 49 | + $this->connection->quoteIdentifier($this->table), |
|
| 50 | + $this->connection->quoteIdentifier($this->name), |
|
| 51 | + $this->connection->quoteIdentifier($this->name)); |
|
| 52 | 52 | $values = array(); |
| 53 | 53 | foreach ($this->connection->query($query) as $value) { |
| 54 | 54 | $values[] = trim($value[$this->name]); |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | * @param string $aDatabase database/schema name |
| 108 | 108 | * @param string $aTable table name |
| 109 | 109 | * @return array |
| 110 | - */ |
|
| 110 | + */ |
|
| 111 | 111 | public function getIndexes($aDatabase, $aTable) { |
| 112 | 112 | |
| 113 | 113 | $indexes = array(); |
@@ -134,18 +134,18 @@ 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']; |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | catch (\Exception $e) { //LONG column has restrictions on querying, so just get total value count |
| 155 | 155 | if (strpos($e->getMessage(), 'ORA-00997: illegal use of LONG datatype') !== false) { |
| 156 | 156 | $query = sprintf("SELECT COUNT(*) AS COUNT FROM %s.%s WHERE %s IS NOT NULL", |
| 157 | - $this->connection->quoteIdentifier($this->database), |
|
| 158 | - $this->connection->quoteIdentifier($this->table), |
|
| 159 | - $this->connection->quoteIdentifier($this->name)); |
|
| 157 | + $this->connection->quoteIdentifier($this->database), |
|
| 158 | + $this->connection->quoteIdentifier($this->table), |
|
| 159 | + $this->connection->quoteIdentifier($this->name)); |
|
| 160 | 160 | $this->distinctValues = $this->connection->query($query)->fetchAssoc(false)['COUNT'] ?: 1; |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | * Work out whether date or datetime |
| 264 | 264 | */ |
| 265 | 265 | $query = sprintf("SELECT COUNT(*) AS COUNT FROM %s.%s WHERE %s IS NOT NULL AND TO_CHAR(%s, 'SSSSS') > 0", |
| 266 | - $this->connection->quoteIdentifier($this->database), |
|
| 267 | - $this->connection->quoteIdentifier($this->table), |
|
| 268 | - $this->connection->quoteIdentifier($this->name), |
|
| 269 | - $this->connection->quoteIdentifier($this->name)); |
|
| 266 | + $this->connection->quoteIdentifier($this->database), |
|
| 267 | + $this->connection->quoteIdentifier($this->table), |
|
| 268 | + $this->connection->quoteIdentifier($this->name), |
|
| 269 | + $this->connection->quoteIdentifier($this->name)); |
|
| 270 | 270 | $rows = $this->connection->query($query)->fetchAssoc(false); |
| 271 | 271 | |
| 272 | 272 | if ($rows['COUNT'] > 0) { |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * Primary key column(s) |
|
| 107 | - * @param string $aDatabase database/schema name |
|
| 108 | - * @param string $aTable table name |
|
| 109 | - * @return array |
|
| 110 | - */ |
|
| 106 | + * Primary key column(s) |
|
| 107 | + * @param string $aDatabase database/schema name |
|
| 108 | + * @param string $aTable table name |
|
| 109 | + * @return array |
|
| 110 | + */ |
|
| 111 | 111 | public function getPrimaryKey($aDatabase, $aTable) { |
| 112 | 112 | $columns = array(); |
| 113 | 113 | $SQL = "SELECT ORDINAL_POSITION, COLUMN_NAME |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * @param string $aDatabase database/schema name |
| 134 | 134 | * @param string $aTable table name |
| 135 | 135 | * @return array |
| 136 | - */ |
|
| 136 | + */ |
|
| 137 | 137 | public function getIndexes($aDatabase, $aTable) { |
| 138 | 138 | |
| 139 | 139 | $indexes = array(); |