@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $table = $this->db->getTableSchema($tableName); |
| 60 | 60 | |
| 61 | - if ($table !== null && isset($table->columns[$table->sequenceName])) { |
|
| 61 | + if ($table !== null && isset($table->columns[ $table->sequenceName ])) { |
|
| 62 | 62 | if ($value === null) { |
| 63 | - $sql = 'SELECT MAX("'. $table->sequenceName .'") FROM "'. $tableName . '"'; |
|
| 63 | + $sql = 'SELECT MAX("' . $table->sequenceName . '") FROM "' . $tableName . '"'; |
|
| 64 | 64 | $value = $this->db->createCommand($sql)->queryScalar() + 1; |
| 65 | 65 | } else { |
| 66 | 66 | $value = (int) $value; |
| 67 | 67 | } |
| 68 | - return 'ALTER TABLE "' . $tableName . '" ALTER COLUMN "'.$table->sequenceName.'" RESTART WITH ' . $value; |
|
| 68 | + return 'ALTER TABLE "' . $tableName . '" ALTER COLUMN "' . $table->sequenceName . '" RESTART WITH ' . $value; |
|
| 69 | 69 | } elseif ($table === null) { |
| 70 | 70 | throw new InvalidParamException("Table not found: $tableName"); |
| 71 | 71 | } else { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | public function checkIntegrity($check = true, $schema = '', $table = '') |
| 86 | 86 | { |
| 87 | 87 | if ($table) { |
| 88 | - $tableNames = [$table]; |
|
| 88 | + $tableNames = [ $table ]; |
|
| 89 | 89 | } else { |
| 90 | 90 | if (!$schema) { |
| 91 | 91 | $schema = $this->db->defaultSchema; |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | return ''; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - $quotedTableNames = []; |
|
| 121 | + $quotedTableNames = [ ]; |
|
| 122 | 122 | foreach ($tableNames as $tableName) { |
| 123 | - $quotedTableNames[] = $this->db->quoteTableName($tableName) . ($check? '' : ' ALL'); |
|
| 123 | + $quotedTableNames[ ] = $this->db->quoteTableName($tableName) . ($check ? '' : ' ALL'); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $enable = $check ? 'CHECKED' : 'UNCHECKED'; |
| 127 | - return 'SET INTEGRITY FOR ' . implode(', ', $quotedTableNames) . ' IMMEDIATE ' . $enable. ';'; |
|
| 127 | + return 'SET INTEGRITY FOR ' . implode(', ', $quotedTableNames) . ' IMMEDIATE ' . $enable . ';'; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -137,22 +137,22 @@ discard block |
||
| 137 | 137 | $sql = str_replace(':query', $sql, $limitOffsetStatment); |
| 138 | 138 | |
| 139 | 139 | //convert "item"."id" to "id" to use in OVER() |
| 140 | - $newOrderBy = []; |
|
| 140 | + $newOrderBy = [ ]; |
|
| 141 | 141 | |
| 142 | - if(!empty($orderBy)){ |
|
| 142 | + if (!empty($orderBy)) { |
|
| 143 | 143 | foreach ($orderBy as $name => $direction) { |
| 144 | - if(is_string($name)){ |
|
| 144 | + if (is_string($name)) { |
|
| 145 | 145 | $e = explode('.', $name); |
| 146 | 146 | $name = array_pop($e); |
| 147 | 147 | } |
| 148 | - $newOrderBy[$name] = $direction; |
|
| 148 | + $newOrderBy[ $name ] = $direction; |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | $orderByStatment = $this->buildOrderBy($newOrderBy); |
| 153 | 153 | |
| 154 | - $sql = str_replace(':order', $orderByStatment,$sql); |
|
| 155 | - }else{ |
|
| 154 | + $sql = str_replace(':order', $orderByStatment, $sql); |
|
| 155 | + } else { |
|
| 156 | 156 | $orderByStatment = $this->buildOrderBy($orderBy); |
| 157 | 157 | if ($orderByStatment !== '') { |
| 158 | 158 | $sql .= $this->separator . $orderByStatment; |
@@ -196,24 +196,24 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | protected function buildCompositeInCondition($operator, $columns, $values, &$params) |
| 198 | 198 | { |
| 199 | - $vss = []; |
|
| 199 | + $vss = [ ]; |
|
| 200 | 200 | foreach ($values as $value) { |
| 201 | - $vs = []; |
|
| 201 | + $vs = [ ]; |
|
| 202 | 202 | foreach ($columns as $column) { |
| 203 | - if (isset($value[$column])) { |
|
| 203 | + if (isset($value[ $column ])) { |
|
| 204 | 204 | $phName = self::PARAM_PREFIX . count($params); |
| 205 | - $params[$phName] = $value[$column]; |
|
| 206 | - $vs[] = $phName; |
|
| 205 | + $params[ $phName ] = $value[ $column ]; |
|
| 206 | + $vs[ ] = $phName; |
|
| 207 | 207 | } else { |
| 208 | - $vs[] = 'NULL'; |
|
| 208 | + $vs[ ] = 'NULL'; |
|
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | - $vss[] = 'select ' . implode(', ', $vs) . ' from SYSIBM.SYSDUMMY1'; |
|
| 211 | + $vss[ ] = 'select ' . implode(', ', $vs) . ' from SYSIBM.SYSDUMMY1'; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - $sqlColumns = []; |
|
| 214 | + $sqlColumns = [ ]; |
|
| 215 | 215 | foreach ($columns as $i => $column) { |
| 216 | - $sqlColumns[] = strpos($column, '(') === false ? $this->db->quoteColumnName($column) : $column; |
|
| 216 | + $sqlColumns[ ] = strpos($column, '(') === false ? $this->db->quoteColumnName($column) : $column; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | return '(' . implode(', ', $sqlColumns) . ") $operator (" . implode(' UNION ', $vss) . ')'; |
@@ -228,21 +228,21 @@ discard block |
||
| 228 | 228 | if (($tableSchema = $schema->getTableSchema($table)) !== null) { |
| 229 | 229 | $columnSchemas = $tableSchema->columns; |
| 230 | 230 | } else { |
| 231 | - $columnSchemas = []; |
|
| 231 | + $columnSchemas = [ ]; |
|
| 232 | 232 | } |
| 233 | - $names = []; |
|
| 234 | - $placeholders = []; |
|
| 233 | + $names = [ ]; |
|
| 234 | + $placeholders = [ ]; |
|
| 235 | 235 | foreach ($columns as $name => $value) { |
| 236 | - $names[] = $schema->quoteColumnName($name); |
|
| 236 | + $names[ ] = $schema->quoteColumnName($name); |
|
| 237 | 237 | if ($value instanceof Expression) { |
| 238 | - $placeholders[] = $value->expression; |
|
| 238 | + $placeholders[ ] = $value->expression; |
|
| 239 | 239 | foreach ($value->params as $n => $v) { |
| 240 | - $params[$n] = $v; |
|
| 240 | + $params[ $n ] = $v; |
|
| 241 | 241 | } |
| 242 | 242 | } else { |
| 243 | 243 | $phName = self::PARAM_PREFIX . count($params); |
| 244 | - $placeholders[] = $phName; |
|
| 245 | - $params[$phName] = !is_array($value) && isset($columnSchemas[$name]) ? $columnSchemas[$name]->dbTypecast($value) : $value; |
|
| 244 | + $placeholders[ ] = $phName; |
|
| 245 | + $params[ $phName ] = !is_array($value) && isset($columnSchemas[ $name ]) ? $columnSchemas[ $name ]->dbTypecast($value) : $value; |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | public function selectExists($rawSql) |
| 266 | 266 | { |
| 267 | - return 'SELECT CASE WHEN COUNT(*)>0 THEN 1 ELSE 0 END FROM (' . $rawSql . ') CHECKEXISTS';; |
|
| 267 | + return 'SELECT CASE WHEN COUNT(*)>0 THEN 1 ELSE 0 END FROM (' . $rawSql . ') CHECKEXISTS'; ; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |