@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | $table = $this->quoteStringLiteral($table); |
180 | 180 | |
181 | 181 | return "SELECT TABLE_NAME AS `Table`, NON_UNIQUE AS Non_Unique, INDEX_NAME AS Key_name, ". |
182 | - "SEQ_IN_INDEX AS Seq_in_index, COLUMN_NAME AS Column_Name, COLLATION AS Collation, ". |
|
183 | - "CARDINALITY AS Cardinality, SUB_PART AS Sub_Part, PACKED AS Packed, " . |
|
184 | - "NULLABLE AS `Null`, INDEX_TYPE AS Index_Type, COMMENT AS Comment " . |
|
185 | - "FROM information_schema.STATISTICS WHERE TABLE_NAME = " . $table . " AND TABLE_SCHEMA = " . $currentDatabase; |
|
182 | + "SEQ_IN_INDEX AS Seq_in_index, COLUMN_NAME AS Column_Name, COLLATION AS Collation, ". |
|
183 | + "CARDINALITY AS Cardinality, SUB_PART AS Sub_Part, PACKED AS Packed, " . |
|
184 | + "NULLABLE AS `Null`, INDEX_TYPE AS Index_Type, COMMENT AS Comment " . |
|
185 | + "FROM information_schema.STATISTICS WHERE TABLE_NAME = " . $table . " AND TABLE_SCHEMA = " . $currentDatabase; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | return 'SHOW INDEX FROM ' . $table; |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | } |
211 | 211 | |
212 | 212 | $sql = "SELECT DISTINCT k.`CONSTRAINT_NAME`, k.`COLUMN_NAME`, k.`REFERENCED_TABLE_NAME`, ". |
213 | - "k.`REFERENCED_COLUMN_NAME` /*!50116 , c.update_rule, c.delete_rule */ ". |
|
214 | - "FROM information_schema.key_column_usage k /*!50116 ". |
|
215 | - "INNER JOIN information_schema.referential_constraints c ON ". |
|
216 | - " c.constraint_name = k.constraint_name AND ". |
|
217 | - " c.table_name = $table */ WHERE k.table_name = $table"; |
|
213 | + "k.`REFERENCED_COLUMN_NAME` /*!50116 , c.update_rule, c.delete_rule */ ". |
|
214 | + "FROM information_schema.key_column_usage k /*!50116 ". |
|
215 | + "INNER JOIN information_schema.referential_constraints c ON ". |
|
216 | + " c.constraint_name = k.constraint_name AND ". |
|
217 | + " c.table_name = $table */ WHERE k.table_name = $table"; |
|
218 | 218 | |
219 | 219 | $databaseNameSql = null === $database ? 'DATABASE()' : $database; |
220 | 220 | |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | } |
401 | 401 | |
402 | 402 | return "SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, ". |
403 | - "COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN_COMMENT AS Comment, " . |
|
404 | - "CHARACTER_SET_NAME AS CharacterSet, COLLATION_NAME AS Collation ". |
|
405 | - "FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = " . $database . " AND TABLE_NAME = " . $table; |
|
403 | + "COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN_COMMENT AS Comment, " . |
|
404 | + "CHARACTER_SET_NAME AS CharacterSet, COLLATION_NAME AS Collation ". |
|
405 | + "FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = " . $database . " AND TABLE_NAME = " . $table; |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | return 'LOCATE(' . $substr . ', ' . $str . ')'; |
120 | 120 | } |
121 | 121 | |
122 | - return 'LOCATE(' . $substr . ', ' . $str . ', '.$startPos.')'; |
|
122 | + return 'LOCATE(' . $substr . ', ' . $str . ', ' . $startPos . ')'; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | $currentDatabase = $this->quoteStringLiteral($currentDatabase); |
179 | 179 | $table = $this->quoteStringLiteral($table); |
180 | 180 | |
181 | - return "SELECT TABLE_NAME AS `Table`, NON_UNIQUE AS Non_Unique, INDEX_NAME AS Key_name, ". |
|
182 | - "SEQ_IN_INDEX AS Seq_in_index, COLUMN_NAME AS Column_Name, COLLATION AS Collation, ". |
|
181 | + return "SELECT TABLE_NAME AS `Table`, NON_UNIQUE AS Non_Unique, INDEX_NAME AS Key_name, " . |
|
182 | + "SEQ_IN_INDEX AS Seq_in_index, COLUMN_NAME AS Column_Name, COLLATION AS Collation, " . |
|
183 | 183 | "CARDINALITY AS Cardinality, SUB_PART AS Sub_Part, PACKED AS Packed, " . |
184 | 184 | "NULLABLE AS `Null`, INDEX_TYPE AS Index_Type, COMMENT AS Comment " . |
185 | 185 | "FROM information_schema.STATISTICS WHERE TABLE_NAME = " . $table . " AND TABLE_SCHEMA = " . $currentDatabase; |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | $database = $this->quoteStringLiteral($database); |
210 | 210 | } |
211 | 211 | |
212 | - $sql = "SELECT DISTINCT k.`CONSTRAINT_NAME`, k.`COLUMN_NAME`, k.`REFERENCED_TABLE_NAME`, ". |
|
213 | - "k.`REFERENCED_COLUMN_NAME` /*!50116 , c.update_rule, c.delete_rule */ ". |
|
214 | - "FROM information_schema.key_column_usage k /*!50116 ". |
|
215 | - "INNER JOIN information_schema.referential_constraints c ON ". |
|
216 | - " c.constraint_name = k.constraint_name AND ". |
|
212 | + $sql = "SELECT DISTINCT k.`CONSTRAINT_NAME`, k.`COLUMN_NAME`, k.`REFERENCED_TABLE_NAME`, " . |
|
213 | + "k.`REFERENCED_COLUMN_NAME` /*!50116 , c.update_rule, c.delete_rule */ " . |
|
214 | + "FROM information_schema.key_column_usage k /*!50116 " . |
|
215 | + "INNER JOIN information_schema.referential_constraints c ON " . |
|
216 | + " c.constraint_name = k.constraint_name AND " . |
|
217 | 217 | " c.table_name = $table */ WHERE k.table_name = $table"; |
218 | 218 | |
219 | 219 | $databaseNameSql = null === $database ? 'DATABASE()' : $database; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function getDropViewSQL($name) |
239 | 239 | { |
240 | - return 'DROP VIEW '. $name; |
|
240 | + return 'DROP VIEW ' . $name; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -399,9 +399,9 @@ discard block |
||
399 | 399 | $database = 'DATABASE()'; |
400 | 400 | } |
401 | 401 | |
402 | - return "SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, ". |
|
402 | + return "SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, " . |
|
403 | 403 | "COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN_COMMENT AS Comment, " . |
404 | - "CHARACTER_SET_NAME AS CharacterSet, COLLATION_NAME AS Collation ". |
|
404 | + "CHARACTER_SET_NAME AS CharacterSet, COLLATION_NAME AS Collation " . |
|
405 | 405 | "FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = " . $database . " AND TABLE_NAME = " . $table; |
406 | 406 | } |
407 | 407 | |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | |
450 | 450 | $query = 'CREATE '; |
451 | 451 | |
452 | - if (!empty($options['temporary'])) { |
|
452 | + if ( ! empty($options['temporary'])) { |
|
453 | 453 | $query .= 'TEMPORARY '; |
454 | 454 | } |
455 | 455 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | continue; |
584 | 584 | } |
585 | 585 | |
586 | - $queryParts[] = 'DROP ' . $column->getQuotedName($this); |
|
586 | + $queryParts[] = 'DROP ' . $column->getQuotedName($this); |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | foreach ($diff->changedColumns as $columnDiff) { |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | } |
605 | 605 | |
606 | 606 | $columnArray['comment'] = $this->getColumnComment($column); |
607 | - $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' |
|
607 | + $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' |
|
608 | 608 | . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); |
609 | 609 | } |
610 | 610 | |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | $oldColumnName = new Identifier($oldColumnName); |
617 | 617 | $columnArray = $column->toArray(); |
618 | 618 | $columnArray['comment'] = $this->getColumnComment($column); |
619 | - $queryParts[] = 'CHANGE ' . $oldColumnName->getQuotedName($this) . ' ' |
|
619 | + $queryParts[] = 'CHANGE ' . $oldColumnName->getQuotedName($this) . ' ' |
|
620 | 620 | . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); |
621 | 621 | } |
622 | 622 | |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | { |
716 | 716 | $sql = []; |
717 | 717 | |
718 | - if (! $index->isPrimary() || ! $diff->fromTable instanceof Table) { |
|
718 | + if ( ! $index->isPrimary() || ! $diff->fromTable instanceof Table) { |
|
719 | 719 | return $sql; |
720 | 720 | } |
721 | 721 | |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | |
724 | 724 | // Dropping primary keys requires to unset autoincrement attribute on the particular column first. |
725 | 725 | foreach ($index->getColumns() as $columnName) { |
726 | - if (! $diff->fromTable->hasColumn($columnName)) { |
|
726 | + if ( ! $diff->fromTable->hasColumn($columnName)) { |
|
727 | 727 | continue; |
728 | 728 | } |
729 | 729 | |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | $tableName = $diff->getName($this)->getQuotedName($this); |
791 | 791 | |
792 | 792 | foreach ($this->getRemainingForeignKeyConstraintsRequiringRenamedIndexes($diff) as $foreignKey) { |
793 | - if (! in_array($foreignKey, $diff->changedForeignKeys, true)) { |
|
793 | + if ( ! in_array($foreignKey, $diff->changedForeignKeys, true)) { |
|
794 | 794 | $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName); |
795 | 795 | } |
796 | 796 | } |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | : $diff->getName($this)->getQuotedName($this); |
859 | 859 | |
860 | 860 | foreach ($this->getRemainingForeignKeyConstraintsRequiringRenamedIndexes($diff) as $foreignKey) { |
861 | - if (! in_array($foreignKey, $diff->changedForeignKeys, true)) { |
|
861 | + if ( ! in_array($foreignKey, $diff->changedForeignKeys, true)) { |
|
862 | 862 | $sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName); |
863 | 863 | } |
864 | 864 | } |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | /** |
966 | 966 | * {@inheritDoc} |
967 | 967 | */ |
968 | - public function getDropIndexSQL($index, $table=null) |
|
968 | + public function getDropIndexSQL($index, $table = null) |
|
969 | 969 | { |
970 | 970 | if ($index instanceof Index) { |
971 | 971 | $indexName = $index->getQuotedName($this); |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | |
978 | 978 | if ($table instanceof Table) { |
979 | 979 | $table = $table->getQuotedName($this); |
980 | - } elseif (!is_string($table)) { |
|
980 | + } elseif ( ! is_string($table)) { |
|
981 | 981 | throw new \InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); |
982 | 982 | } |
983 | 983 | |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | { |
1098 | 1098 | if ($table instanceof Table) { |
1099 | 1099 | $table = $table->getQuotedName($this); |
1100 | - } elseif (!is_string($table)) { |
|
1100 | + } elseif ( ! is_string($table)) { |
|
1101 | 1101 | throw new \InvalidArgumentException('getDropTemporaryTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); |
1102 | 1102 | } |
1103 | 1103 |
@@ -62,6 +62,6 @@ |
||
62 | 62 | $sql = parent::getListTableColumnsSQL($table, $database); |
63 | 63 | $parts = explode('AS complete_type,', $sql, 2); |
64 | 64 | |
65 | - return $parts[0].'AS complete_type, (SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,'.$parts[1]; |
|
65 | + return $parts[0] . 'AS complete_type, (SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,' . $parts[1]; |
|
66 | 66 | } |
67 | 67 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | if ($startPos !== false) { |
135 | 135 | $str = $this->getSubstringExpression($str, $startPos); |
136 | 136 | |
137 | - return 'CASE WHEN (POSITION('.$substr.' IN '.$str.') = 0) THEN 0 ELSE (POSITION('.$substr.' IN '.$str.') + '.($startPos-1).') END'; |
|
137 | + return 'CASE WHEN (POSITION(' . $substr . ' IN ' . $str . ') = 0) THEN 0 ELSE (POSITION(' . $substr . ' IN ' . $str . ') + ' . ($startPos - 1) . ') END'; |
|
138 | 138 | } |
139 | 139 | |
140 | - return 'POSITION('.$substr.' IN '.$str.')'; |
|
140 | + return 'POSITION(' . $substr . ' IN ' . $str . ')'; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $unit = DateIntervalUnit::MONTH; |
151 | 151 | } |
152 | 152 | |
153 | - return "(" . $date ." " . $operator . " (" . $interval . " || ' " . $unit . "')::interval)"; |
|
153 | + return "(" . $date . " " . $operator . " (" . $interval . " || ' " . $unit . "')::interval)"; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | ( |
311 | 311 | SELECT c.oid |
312 | 312 | FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n |
313 | - WHERE " .$this->getTableWhereClause($table) ." AND n.oid = c.relnamespace |
|
313 | + WHERE " .$this->getTableWhereClause($table) . " AND n.oid = c.relnamespace |
|
314 | 314 | ) |
315 | 315 | AND r.contype = 'f'"; |
316 | 316 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | */ |
329 | 329 | public function getDropViewSQL($name) |
330 | 330 | { |
331 | - return 'DROP VIEW '. $name; |
|
331 | + return 'DROP VIEW ' . $name; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | WHERE oid IN ( |
368 | 368 | SELECT indexrelid |
369 | 369 | FROM pg_index si, pg_class sc, pg_namespace sn |
370 | - WHERE " . $this->getTableWhereClause($table, 'sc', 'sn')." AND sc.oid=si.indrelid AND sc.relnamespace = sn.oid |
|
370 | + WHERE " . $this->getTableWhereClause($table, 'sc', 'sn') . " AND sc.oid=si.indrelid AND sc.relnamespace = sn.oid |
|
371 | 371 | ) AND pg_index.indexrelid = oid"; |
372 | 372 | } |
373 | 373 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | private function getTableWhereClause($table, $classAlias = 'c', $namespaceAlias = 'n') |
382 | 382 | { |
383 | - $whereClause = $namespaceAlias.".nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast') AND "; |
|
383 | + $whereClause = $namespaceAlias . ".nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast') AND "; |
|
384 | 384 | if (strpos($table, ".") !== false) { |
385 | 385 | list($schema, $table) = explode(".", $table); |
386 | 386 | $schema = $this->quoteStringLiteral($schema); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | FROM pg_description WHERE pg_description.objoid = c.oid AND a.attnum = pg_description.objsubid |
425 | 425 | ) AS comment |
426 | 426 | FROM pg_attribute a, pg_class c, pg_type t, pg_namespace n |
427 | - WHERE ".$this->getTableWhereClause($table, 'c', 'n') ." |
|
427 | + WHERE ".$this->getTableWhereClause($table, 'c', 'n') . " |
|
428 | 428 | AND a.attnum > 0 |
429 | 429 | AND a.attrelid = c.oid |
430 | 430 | AND a.atttypid = t.oid |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | return $callback($value ? true : false); |
823 | 823 | } |
824 | 824 | |
825 | - if (!is_string($value)) { |
|
825 | + if ( ! is_string($value)) { |
|
826 | 826 | return $callback(true); |
827 | 827 | } |
828 | 828 | |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | |
879 | 879 | return $this->doConvertBooleans( |
880 | 880 | $item, |
881 | - function ($boolean) { |
|
881 | + function($boolean) { |
|
882 | 882 | if (null === $boolean) { |
883 | 883 | return 'NULL'; |
884 | 884 | } |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | |
900 | 900 | return $this->doConvertBooleans( |
901 | 901 | $item, |
902 | - function ($boolean) { |
|
902 | + function($boolean) { |
|
903 | 903 | return null === $boolean ? null : (int) $boolean; |
904 | 904 | } |
905 | 905 | ); |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | */ |
1237 | 1237 | private function typeChangeBreaksDefaultValue(ColumnDiff $columnDiff) : bool |
1238 | 1238 | { |
1239 | - if (! $columnDiff->fromColumn) { |
|
1239 | + if ( ! $columnDiff->fromColumn) { |
|
1240 | 1240 | return $columnDiff->hasChanged('type'); |
1241 | 1241 | } |
1242 | 1242 |
@@ -455,8 +455,8 @@ |
||
455 | 455 | public function getListTablesSQL() |
456 | 456 | { |
457 | 457 | return "SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'sqlite_sequence' AND name != 'geometry_columns' AND name != 'spatial_ref_sys' " |
458 | - . "UNION ALL SELECT name FROM sqlite_temp_master " |
|
459 | - . "WHERE type = 'table' ORDER BY name"; |
|
458 | + . "UNION ALL SELECT name FROM sqlite_temp_master " |
|
459 | + . "WHERE type = 'table' ORDER BY name"; |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | /** |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | public function getLocateExpression($str, $substr, $startPos = false) |
132 | 132 | { |
133 | 133 | if ($startPos == false) { |
134 | - return 'LOCATE('.$str.', '.$substr.')'; |
|
134 | + return 'LOCATE(' . $str . ', ' . $substr . ')'; |
|
135 | 135 | } |
136 | 136 | |
137 | - return 'LOCATE('.$str.', '.$substr.', '.$startPos.')'; |
|
137 | + return 'LOCATE(' . $str . ', ' . $substr . ', ' . $startPos . ')'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | break; |
162 | 162 | } |
163 | 163 | |
164 | - if (! is_numeric($interval)) { |
|
164 | + if ( ! is_numeric($interval)) { |
|
165 | 165 | $interval = "' || " . $interval . " || '"; |
166 | 166 | } |
167 | 167 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function getDateDiffExpression($date1, $date2) |
176 | 176 | { |
177 | - return 'ROUND(JULIANDAY('.$date1 . ')-JULIANDAY('.$date2.'))'; |
|
177 | + return 'ROUND(JULIANDAY(' . $date1 . ')-JULIANDAY(' . $date2 . '))'; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -345,12 +345,12 @@ discard block |
||
345 | 345 | |
346 | 346 | if (isset($options['primary']) && ! empty($options['primary'])) { |
347 | 347 | $keyColumns = array_unique(array_values($options['primary'])); |
348 | - $queryFields.= ', PRIMARY KEY('.implode(', ', $keyColumns).')'; |
|
348 | + $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')'; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | if (isset($options['foreignKeys'])) { |
352 | 352 | foreach ($options['foreignKeys'] as $foreignKey) { |
353 | - $queryFields.= ', '.$this->getForeignKeyDeclarationSQL($foreignKey); |
|
353 | + $queryFields .= ', ' . $this->getForeignKeyDeclarationSQL($foreignKey); |
|
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | */ |
481 | 481 | public function getDropViewSQL($name) |
482 | 482 | { |
483 | - return 'DROP VIEW '. $name; |
|
483 | + return 'DROP VIEW ' . $name; |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | /** |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | } |
683 | 683 | |
684 | 684 | $sql = []; |
685 | - $tableName = $diff->newName ? $diff->getNewName(): $diff->getName($this); |
|
685 | + $tableName = $diff->newName ? $diff->getNewName() : $diff->getName($this); |
|
686 | 686 | foreach ($this->getIndexesInAlteredTable($diff) as $index) { |
687 | 687 | if ($index->isPrimary()) { |
688 | 688 | continue; |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | $sql = []; |
887 | 887 | $tableSql = []; |
888 | 888 | if ( ! $this->onSchemaAlterTable($diff, $tableSql)) { |
889 | - $dataTable = new Table('__temp__'.$table->getName()); |
|
889 | + $dataTable = new Table('__temp__' . $table->getName()); |
|
890 | 890 | |
891 | 891 | $newTable = new Table($table->getQuotedName($this), $columns, $this->getPrimaryIndexInAlteredTable($diff), $this->getForeignKeysInAlteredTable($diff), 0, $table->getOptions()); |
892 | 892 | $newTable->addOption('alter', true); |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | |
903 | 903 | if ($diff->newName && $diff->newName != $diff->name) { |
904 | 904 | $renamedTable = $diff->getNewName(); |
905 | - $sql[] = 'ALTER TABLE '.$newTable->getQuotedName($this).' RENAME TO '.$renamedTable->getQuotedName($this); |
|
905 | + $sql[] = 'ALTER TABLE ' . $newTable->getQuotedName($this) . ' RENAME TO ' . $renamedTable->getQuotedName($this); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | $sql = array_merge($sql, $this->getPostAlterTableIndexForeignKeySQL($diff)); |
@@ -975,13 +975,13 @@ discard block |
||
975 | 975 | $field['length'] = 255; |
976 | 976 | } |
977 | 977 | |
978 | - $sql[] = 'ALTER TABLE '.$table->getQuotedName($this).' ADD COLUMN '.$this->getColumnDeclarationSQL($field['name'], $field); |
|
978 | + $sql[] = 'ALTER TABLE ' . $table->getQuotedName($this) . ' ADD COLUMN ' . $this->getColumnDeclarationSQL($field['name'], $field); |
|
979 | 979 | } |
980 | 980 | |
981 | 981 | if ( ! $this->onSchemaAlterTable($diff, $tableSql)) { |
982 | 982 | if ($diff->newName !== false) { |
983 | 983 | $newTable = new Identifier($diff->newName); |
984 | - $sql[] = 'ALTER TABLE '.$table->getQuotedName($this).' RENAME TO '.$newTable->getQuotedName($this); |
|
984 | + $sql[] = 'ALTER TABLE ' . $table->getQuotedName($this) . ' RENAME TO ' . $newTable->getQuotedName($this); |
|
985 | 985 | } |
986 | 986 | } |
987 | 987 |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | public function getCreateSequenceSQL(Sequence $sequence) |
199 | 199 | { |
200 | 200 | return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . |
201 | - ' START WITH ' . $sequence->getInitialValue() . |
|
202 | - ' MINVALUE ' . $sequence->getInitialValue() . |
|
203 | - ' INCREMENT BY ' . $sequence->getAllocationSize() . |
|
204 | - $this->getSequenceCacheSQL($sequence); |
|
201 | + ' START WITH ' . $sequence->getInitialValue() . |
|
202 | + ' MINVALUE ' . $sequence->getInitialValue() . |
|
203 | + ' INCREMENT BY ' . $sequence->getAllocationSize() . |
|
204 | + $this->getSequenceCacheSQL($sequence); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | public function getAlterSequenceSQL(Sequence $sequence) |
211 | 211 | { |
212 | 212 | return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . |
213 | - ' INCREMENT BY ' . $sequence->getAllocationSize() |
|
214 | - . $this->getSequenceCacheSQL($sequence); |
|
213 | + ' INCREMENT BY ' . $sequence->getAllocationSize() |
|
214 | + . $this->getSequenceCacheSQL($sequence); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | $database = $this->quoteStringLiteral($database->getName()); |
391 | 391 | |
392 | 392 | return "SELECT sequence_name, min_value, increment_by FROM sys.all_sequences ". |
393 | - "WHERE SEQUENCE_OWNER = " . $database; |
|
393 | + "WHERE SEQUENCE_OWNER = " . $database; |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | public function getLocateExpression($str, $substr, $startPos = false) |
99 | 99 | { |
100 | 100 | if ($startPos == false) { |
101 | - return 'INSTR('.$str.', '.$substr.')'; |
|
101 | + return 'INSTR(' . $str . ', ' . $substr . ')'; |
|
102 | 102 | } |
103 | 103 | |
104 | - return 'INSTR('.$str.', '.$substr.', '.$startPos.')'; |
|
104 | + return 'INSTR(' . $str . ', ' . $substr . ', ' . $startPos . ')'; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function getDateDiffExpression($date1, $date2) |
169 | 169 | { |
170 | - return "TRUNC(TO_NUMBER(SUBSTR((" . $date1 . "-" . $date2 . "), 1, INSTR(" . $date1 . "-" . $date2 .", ' '))))"; |
|
170 | + return "TRUNC(TO_NUMBER(SUBSTR((" . $date1 . "-" . $date2 . "), 1, INSTR(" . $date1 . "-" . $date2 . ", ' '))))"; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getBitAndComparisonExpression($value1, $value2) |
177 | 177 | { |
178 | - return 'BITAND('.$value1 . ', ' . $value2 . ')'; |
|
178 | + return 'BITAND(' . $value1 . ', ' . $value2 . ')'; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $database = $this->normalizeIdentifier($database); |
390 | 390 | $database = $this->quoteStringLiteral($database->getName()); |
391 | 391 | |
392 | - return "SELECT sequence_name, min_value, increment_by FROM sys.all_sequences ". |
|
392 | + return "SELECT sequence_name, min_value, increment_by FROM sys.all_sequences " . |
|
393 | 393 | "WHERE SEQUENCE_OWNER = " . $database; |
394 | 394 | } |
395 | 395 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | */ |
492 | 492 | public function getDropViewSQL($name) |
493 | 493 | { |
494 | - return 'DROP VIEW '. $name; |
|
494 | + return 'DROP VIEW ' . $name; |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | /** |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | BEGIN |
523 | 523 | SELECT COUNT(CONSTRAINT_NAME) INTO constraints_Count FROM USER_CONSTRAINTS WHERE TABLE_NAME = \'' . $unquotedTableName . '\' AND CONSTRAINT_TYPE = \'P\'; |
524 | 524 | IF constraints_Count = 0 OR constraints_Count = \'\' THEN |
525 | - EXECUTE IMMEDIATE \''.$this->getCreateConstraintSQL($idx, $quotedTableName).'\'; |
|
525 | + EXECUTE IMMEDIATE \''.$this->getCreateConstraintSQL($idx, $quotedTableName) . '\'; |
|
526 | 526 | END IF; |
527 | 527 | END;'; |
528 | 528 | |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | last_InsertID NUMBER; |
543 | 543 | BEGIN |
544 | 544 | SELECT ' . $sequenceName . '.NEXTVAL INTO :NEW.' . $quotedName . ' FROM DUAL; |
545 | - IF (:NEW.' . $quotedName . ' IS NULL OR :NEW.'.$quotedName.' = 0) THEN |
|
545 | + IF (:NEW.' . $quotedName . ' IS NULL OR :NEW.' . $quotedName . ' = 0) THEN |
|
546 | 546 | SELECT ' . $sequenceName . '.NEXTVAL INTO :NEW.' . $quotedName . ' FROM DUAL; |
547 | 547 | ELSE |
548 | 548 | SELECT NVL(Last_Number, 0) INTO last_Sequence |
@@ -711,11 +711,11 @@ discard block |
||
711 | 711 | */ |
712 | 712 | public function getDropForeignKeySQL($foreignKey, $table) |
713 | 713 | { |
714 | - if (! $foreignKey instanceof ForeignKeyConstraint) { |
|
714 | + if ( ! $foreignKey instanceof ForeignKeyConstraint) { |
|
715 | 715 | $foreignKey = new Identifier($foreignKey); |
716 | 716 | } |
717 | 717 | |
718 | - if (! $table instanceof Table) { |
|
718 | + if ( ! $table instanceof Table) { |
|
719 | 719 | $table = new Identifier($table); |
720 | 720 | } |
721 | 721 | |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | $oldColumnName = new Identifier($oldColumnName); |
857 | 857 | |
858 | 858 | $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . |
859 | - ' RENAME COLUMN ' . $oldColumnName->getQuotedName($this) .' TO ' . $column->getQuotedName($this); |
|
859 | + ' RENAME COLUMN ' . $oldColumnName->getQuotedName($this) . ' TO ' . $column->getQuotedName($this); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | $fields = []; |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | } |
870 | 870 | |
871 | 871 | if (count($fields)) { |
872 | - $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' DROP (' . implode(', ', $fields).')'; |
|
872 | + $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' DROP (' . implode(', ', $fields) . ')'; |
|
873 | 873 | } |
874 | 874 | |
875 | 875 | $tableSql = []; |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | } |
995 | 995 | |
996 | 996 | if (preg_match('/^\s*SELECT/i', $query)) { |
997 | - if (!preg_match('/\sFROM\s/i', $query)) { |
|
997 | + if ( ! preg_match('/\sFROM\s/i', $query)) { |
|
998 | 998 | $query .= " FROM dual"; |
999 | 999 | } |
1000 | 1000 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | /** |
34 | 34 | * {@inheritDoc} |
35 | 35 | */ |
36 | - public function getCreateTableSQL(Table $table, $createFlags=self::CREATE_INDEXES) |
|
36 | + public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDEXES) |
|
37 | 37 | { |
38 | 38 | $sql = parent::getCreateTableSQL($table, $createFlags); |
39 | 39 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function getAlterSequenceSQL(Sequence $sequence) |
42 | 42 | { |
43 | 43 | return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . |
44 | - ' INCREMENT BY ' . $sequence->getAllocationSize(); |
|
44 | + ' INCREMENT BY ' . $sequence->getAllocationSize(); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | public function getCreateSequenceSQL(Sequence $sequence) |
51 | 51 | { |
52 | 52 | return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . |
53 | - ' START WITH ' . $sequence->getInitialValue() . |
|
54 | - ' INCREMENT BY ' . $sequence->getAllocationSize() . |
|
55 | - ' MINVALUE ' . $sequence->getInitialValue(); |
|
53 | + ' START WITH ' . $sequence->getInitialValue() . |
|
54 | + ' INCREMENT BY ' . $sequence->getAllocationSize() . |
|
55 | + ' MINVALUE ' . $sequence->getInitialValue(); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\DBAL\Platforms\Keywords; |
6 | 6 |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | } |
351 | 351 | |
352 | 352 | return "SELECT COLUMN_NAME, DATA_TYPE, COLUMN_COMMENT, IS_NULLABLE, IS_AUTO_INCREMENT, CHARACTER_MAXIMUM_LENGTH, COLUMN_DEFAULT," . |
353 | - " NUMERIC_PRECISION, NUMERIC_SCALE, COLLATION_NAME" . |
|
354 | - " FROM DATA_DICTIONARY.COLUMNS" . |
|
355 | - " WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME = '" . $table . "'"; |
|
353 | + " NUMERIC_PRECISION, NUMERIC_SCALE, COLLATION_NAME" . |
|
354 | + " FROM DATA_DICTIONARY.COLUMNS" . |
|
355 | + " WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME = '" . $table . "'"; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | return "SELECT CONSTRAINT_NAME, CONSTRAINT_COLUMNS, REFERENCED_TABLE_NAME, REFERENCED_TABLE_COLUMNS, UPDATE_RULE, DELETE_RULE" . |
370 | - " FROM DATA_DICTIONARY.FOREIGN_KEYS" . |
|
371 | - " WHERE CONSTRAINT_SCHEMA=" . $database . " AND CONSTRAINT_TABLE='" . $table . "'"; |
|
370 | + " FROM DATA_DICTIONARY.FOREIGN_KEYS" . |
|
371 | + " WHERE CONSTRAINT_SCHEMA=" . $database . " AND CONSTRAINT_TABLE='" . $table . "'"; |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | /** |
@@ -383,8 +383,8 @@ discard block |
||
383 | 383 | } |
384 | 384 | |
385 | 385 | return "SELECT INDEX_NAME AS 'key_name', COLUMN_NAME AS 'column_name', IS_USED_IN_PRIMARY AS 'primary', IS_UNIQUE=0 AS 'non_unique'" . |
386 | - " FROM DATA_DICTIONARY.INDEX_PARTS" . |
|
387 | - " WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME='" . $table . "'"; |
|
386 | + " FROM DATA_DICTIONARY.INDEX_PARTS" . |
|
387 | + " WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME='" . $table . "'"; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | /** |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | } |
602 | 602 | } |
603 | 603 | } elseif (is_bool($item) || is_numeric($item)) { |
604 | - $item = ($item) ? 'true' : 'false'; |
|
604 | + $item = ($item) ? 'true' : 'false'; |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | return $item; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | $query = 'CREATE '; |
234 | 234 | |
235 | - if (!empty($options['temporary'])) { |
|
235 | + if ( ! empty($options['temporary'])) { |
|
236 | 236 | $query .= 'TEMPORARY '; |
237 | 237 | } |
238 | 238 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | /** |
431 | 431 | * {@inheritDoc} |
432 | 432 | */ |
433 | - public function getDropIndexSQL($index, $table=null) |
|
433 | + public function getDropIndexSQL($index, $table = null) |
|
434 | 434 | { |
435 | 435 | if ($index instanceof Index) { |
436 | 436 | $indexName = $index->getQuotedName($this); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | |
443 | 443 | if ($table instanceof Table) { |
444 | 444 | $table = $table->getQuotedName($this); |
445 | - } elseif (!is_string($table)) { |
|
445 | + } elseif ( ! is_string($table)) { |
|
446 | 446 | throw new \InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); |
447 | 447 | } |
448 | 448 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | $queryParts = []; |
501 | 501 | |
502 | 502 | if ($diff->newName !== false) { |
503 | - $queryParts[] = 'RENAME TO ' . $diff->getNewName()->getQuotedName($this); |
|
503 | + $queryParts[] = 'RENAME TO ' . $diff->getNewName()->getQuotedName($this); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | foreach ($diff->addedColumns as $column) { |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | continue; |
519 | 519 | } |
520 | 520 | |
521 | - $queryParts[] = 'DROP ' . $column->getQuotedName($this); |
|
521 | + $queryParts[] = 'DROP ' . $column->getQuotedName($this); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | foreach ($diff->changedColumns as $columnDiff) { |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | } |
542 | 542 | |
543 | 543 | $columnArray['comment'] = $this->getColumnComment($column); |
544 | - $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' |
|
544 | + $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' |
|
545 | 545 | . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); |
546 | 546 | } |
547 | 547 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | |
555 | 555 | $columnArray = $column->toArray(); |
556 | 556 | $columnArray['comment'] = $this->getColumnComment($column); |
557 | - $queryParts[] = 'CHANGE ' . $oldColumnName->getQuotedName($this) . ' ' |
|
557 | + $queryParts[] = 'CHANGE ' . $oldColumnName->getQuotedName($this) . ' ' |
|
558 | 558 | . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); |
559 | 559 | } |
560 | 560 | |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | { |
583 | 583 | if ($table instanceof Table) { |
584 | 584 | $table = $table->getQuotedName($this); |
585 | - } elseif (!is_string($table)) { |
|
585 | + } elseif ( ! is_string($table)) { |
|
586 | 586 | throw new \InvalidArgumentException('getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); |
587 | 587 | } |
588 | 588 | |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | return 'LOCATE(' . $substr . ', ' . $str . ')'; |
617 | 617 | } |
618 | 618 | |
619 | - return 'LOCATE(' . $substr . ', ' . $str . ', '.$startPos.')'; |
|
619 | + return 'LOCATE(' . $substr . ', ' . $str . ', ' . $startPos . ')'; |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | /** |