@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | { |
57 | 57 | $table = $this->db->getTableSchema($tableName); |
58 | 58 | |
59 | - if ($table !== null && isset($table->columns[$table->sequenceName])) { |
|
59 | + if ($table !== null && isset($table->columns[ $table->sequenceName ])) { |
|
60 | 60 | if ($value === null) { |
61 | - $sql = 'SELECT MAX("'. $table->sequenceName .'") FROM "'. $tableName . '"'; |
|
61 | + $sql = 'SELECT MAX("' . $table->sequenceName . '") FROM "' . $tableName . '"'; |
|
62 | 62 | $value = $this->db->createCommand($sql)->queryScalar() + 1; |
63 | 63 | } else { |
64 | 64 | $value = (int) $value; |
65 | 65 | } |
66 | - return 'ALTER TABLE "' . $tableName . '" ALTER COLUMN "'.$table->sequenceName.'" RESTART WITH ' . $value; |
|
66 | + return 'ALTER TABLE "' . $tableName . '" ALTER COLUMN "' . $table->sequenceName . '" RESTART WITH ' . $value; |
|
67 | 67 | } elseif ($table === null) { |
68 | 68 | throw new InvalidParamException("Table not found: $tableName"); |
69 | 69 | } else { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function checkIntegrity($check = true, $schema = '', $table = '') |
84 | 84 | { |
85 | 85 | if ($table) { |
86 | - $tableNames = [$table]; |
|
86 | + $tableNames = [ $table ]; |
|
87 | 87 | } else { |
88 | 88 | //Return only tables |
89 | 89 | $sql = "SELECT t.tabname FROM syscat.tables AS t" |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | return ''; |
113 | 113 | } |
114 | 114 | |
115 | - $quotedTableNames = []; |
|
115 | + $quotedTableNames = [ ]; |
|
116 | 116 | foreach ($tableNames as $tableName) { |
117 | - $quotedTableNames[] = $this->db->quoteTableName($tableName) . ($check? '' : ' ALL'); |
|
117 | + $quotedTableNames[ ] = $this->db->quoteTableName($tableName) . ($check ? '' : ' ALL'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $enable = $check ? 'CHECKED' : 'UNCHECKED'; |
121 | - return 'SET INTEGRITY FOR ' . implode(', ', $quotedTableNames) . ' IMMEDIATE ' . $enable. ';'; |
|
121 | + return 'SET INTEGRITY FOR ' . implode(', ', $quotedTableNames) . ' IMMEDIATE ' . $enable . ';'; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -131,22 +131,22 @@ discard block |
||
131 | 131 | $sql = str_replace(':query', $sql, $limitOffsetStatment); |
132 | 132 | |
133 | 133 | //convert "item"."id" to "id" to use in OVER() |
134 | - $newOrderBy = []; |
|
134 | + $newOrderBy = [ ]; |
|
135 | 135 | |
136 | - if(!empty($orderBy)){ |
|
136 | + if (!empty($orderBy)) { |
|
137 | 137 | foreach ($orderBy as $name => $direction) { |
138 | - if(is_string($name)){ |
|
138 | + if (is_string($name)) { |
|
139 | 139 | $e = explode('.', $name); |
140 | 140 | $name = array_pop($e); |
141 | 141 | } |
142 | - $newOrderBy[$name] = $direction; |
|
142 | + $newOrderBy[ $name ] = $direction; |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | 146 | $orderByStatment = $this->buildOrderBy($newOrderBy); |
147 | 147 | |
148 | - $sql = str_replace(':order', $orderByStatment,$sql); |
|
149 | - }else{ |
|
148 | + $sql = str_replace(':order', $orderByStatment, $sql); |
|
149 | + } else { |
|
150 | 150 | $orderByStatment = $this->buildOrderBy($orderBy); |
151 | 151 | if ($orderByStatment !== '') { |
152 | 152 | $sql .= $this->separator . $orderByStatment; |
@@ -190,24 +190,24 @@ discard block |
||
190 | 190 | */ |
191 | 191 | protected function buildCompositeInCondition($operator, $columns, $values, &$params) |
192 | 192 | { |
193 | - $vss = []; |
|
193 | + $vss = [ ]; |
|
194 | 194 | foreach ($values as $value) { |
195 | - $vs = []; |
|
195 | + $vs = [ ]; |
|
196 | 196 | foreach ($columns as $column) { |
197 | - if (isset($value[$column])) { |
|
197 | + if (isset($value[ $column ])) { |
|
198 | 198 | $phName = self::PARAM_PREFIX . count($params); |
199 | - $params[$phName] = $value[$column]; |
|
200 | - $vs[] = $phName; |
|
199 | + $params[ $phName ] = $value[ $column ]; |
|
200 | + $vs[ ] = $phName; |
|
201 | 201 | } else { |
202 | - $vs[] = 'NULL'; |
|
202 | + $vs[ ] = 'NULL'; |
|
203 | 203 | } |
204 | 204 | } |
205 | - $vss[] = 'select ' . implode(', ', $vs) . ' from SYSIBM.SYSDUMMY1'; |
|
205 | + $vss[ ] = 'select ' . implode(', ', $vs) . ' from SYSIBM.SYSDUMMY1'; |
|
206 | 206 | } |
207 | 207 | |
208 | - $sqlColumns = []; |
|
208 | + $sqlColumns = [ ]; |
|
209 | 209 | foreach ($columns as $i => $column) { |
210 | - $sqlColumns[] = strpos($column, '(') === false ? $this->db->quoteColumnName($column) : $column; |
|
210 | + $sqlColumns[ ] = strpos($column, '(') === false ? $this->db->quoteColumnName($column) : $column; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | return '(' . implode(', ', $sqlColumns) . ") $operator (" . implode(' UNION ', $vss) . ')'; |
@@ -222,21 +222,21 @@ discard block |
||
222 | 222 | if (($tableSchema = $schema->getTableSchema($table)) !== null) { |
223 | 223 | $columnSchemas = $tableSchema->columns; |
224 | 224 | } else { |
225 | - $columnSchemas = []; |
|
225 | + $columnSchemas = [ ]; |
|
226 | 226 | } |
227 | - $names = []; |
|
228 | - $placeholders = []; |
|
227 | + $names = [ ]; |
|
228 | + $placeholders = [ ]; |
|
229 | 229 | foreach ($columns as $name => $value) { |
230 | - $names[] = $schema->quoteColumnName($name); |
|
230 | + $names[ ] = $schema->quoteColumnName($name); |
|
231 | 231 | if ($value instanceof Expression) { |
232 | - $placeholders[] = $value->expression; |
|
232 | + $placeholders[ ] = $value->expression; |
|
233 | 233 | foreach ($value->params as $n => $v) { |
234 | - $params[$n] = $v; |
|
234 | + $params[ $n ] = $v; |
|
235 | 235 | } |
236 | 236 | } else { |
237 | 237 | $phName = self::PARAM_PREFIX . count($params); |
238 | - $placeholders[] = $phName; |
|
239 | - $params[$phName] = !is_array($value) && isset($columnSchemas[$name]) ? $columnSchemas[$name]->dbTypecast($value) : $value; |
|
238 | + $placeholders[ ] = $phName; |
|
239 | + $params[ $phName ] = !is_array($value) && isset($columnSchemas[ $name ]) ? $columnSchemas[ $name ]->dbTypecast($value) : $value; |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 |