@@ -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']; |
@@ -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 .= ',' . "\n" . "\n"; |
| 130 | 130 | $tableDef .= 'PRIMARY KEY ('; |
| 131 | - $tableDef .= implode(', ' . "\n", array_map(function ($c) {return '`' . strtolower($c) . '`'; }, $primaryKey)); |
|
| 131 | + $tableDef .= implode(', ' . "\n", 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 .= ',' . "\n"; |
| 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 .= ',' . "\n" . "\n"; |
| 196 | 196 | $tableDef .= 'PRIMARY KEY ('; |
| 197 | - $tableDef .= implode(', ' . "\n", array_map(function ($c) {return '"' . strtolower($c) . '"'; }, $primaryKey)); |
|
| 197 | + $tableDef .= implode(', ' . "\n", 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 .= ',' . "\n"; |
| 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 | } |
@@ -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 .= ',' . "\n" . "\n"; |
| 130 | 130 | $tableDef .= 'PRIMARY KEY ('; |
| 131 | - $tableDef .= implode(', ' . "\n", array_map(function ($c) {return '`' . strtolower($c) . '`'; }, $primaryKey)); |
|
| 131 | + $tableDef .= implode(', ' . "\n", 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 .= ',' . "\n"; |
| 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 .= ',' . "\n" . "\n"; |
| 196 | 196 | $tableDef .= 'PRIMARY KEY ('; |
| 197 | - $tableDef .= implode(', ' . "\n", array_map(function ($c) {return '"' . strtolower($c) . '"'; }, $primaryKey)); |
|
| 197 | + $tableDef .= implode(', ' . "\n", 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 .= ',' . "\n"; |
| 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 | } |