1 | <?php |
||
22 | class QueryBuilder extends \yii\db\QueryBuilder |
||
23 | { |
||
24 | /** |
||
25 | * @var array mapping from abstract column types (keys) to physical column types (values). |
||
26 | */ |
||
27 | public $typeMap = [ |
||
28 | Schema::TYPE_PK => 'int NOT NULL AUTO_INCREMENT PRIMARY KEY', |
||
29 | Schema::TYPE_UPK => 'int UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY', |
||
30 | Schema::TYPE_BIGPK => 'bigint NOT NULL AUTO_INCREMENT PRIMARY KEY', |
||
31 | Schema::TYPE_UBIGPK => 'bigint UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY', |
||
32 | Schema::TYPE_CHAR => 'char(1)', |
||
33 | Schema::TYPE_STRING => 'varchar(255)', |
||
34 | Schema::TYPE_TEXT => 'varchar', |
||
35 | Schema::TYPE_SMALLINT => 'smallint', |
||
36 | Schema::TYPE_INTEGER => 'int', |
||
37 | Schema::TYPE_BIGINT => 'bigint', |
||
38 | Schema::TYPE_FLOAT => 'float(7)', |
||
39 | Schema::TYPE_DOUBLE => 'double(15)', |
||
40 | Schema::TYPE_DECIMAL => 'decimal(10,0)', |
||
41 | Schema::TYPE_DATETIME => 'datetime', |
||
42 | Schema::TYPE_TIMESTAMP => 'timestamp', |
||
43 | Schema::TYPE_TIME => 'time', |
||
44 | Schema::TYPE_DATE => 'date', |
||
45 | Schema::TYPE_BINARY => 'blob', |
||
46 | Schema::TYPE_BOOLEAN => 'smallint', |
||
47 | Schema::TYPE_MONEY => 'decimal(19,4)', |
||
48 | ]; |
||
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | protected function defaultExpressionBuilders() |
||
59 | |||
60 | /** |
||
61 | * @inheritdoc |
||
62 | * @see https://www.cubrid.org/manual/en/9.3.0/sql/query/merge.html |
||
63 | */ |
||
64 | public function upsert($table, $insertColumns, $updateColumns, &$params) |
||
115 | |||
116 | /** |
||
117 | * Creates a SQL statement for resetting the sequence value of a table's primary key. |
||
118 | * The sequence will be reset such that the primary key of the next new row inserted |
||
119 | * will have the specified value or 1. |
||
120 | * @param string $tableName the name of the table whose primary key sequence will be reset |
||
121 | * @param mixed $value the value for the primary key of the next new row inserted. If this is not set, |
||
122 | * the next new row's primary key will have a value 1. |
||
123 | * @return string the SQL statement for resetting sequence |
||
124 | * @throws InvalidArgumentException if the table does not exist or there is no sequence associated with the table. |
||
125 | */ |
||
126 | public function resetSequence($tableName, $value = null) |
||
145 | |||
146 | /** |
||
147 | * {@inheritdoc} |
||
148 | */ |
||
149 | public function buildLimit($limit, $offset) |
||
166 | |||
167 | /** |
||
168 | * {@inheritdoc} |
||
169 | * @since 2.0.8 |
||
170 | */ |
||
171 | public function selectExists($rawSql) |
||
175 | |||
176 | /** |
||
177 | * @inheritDoc |
||
178 | * @see http://www.cubrid.org/manual/93/en/sql/schema/table.html#drop-index-clause |
||
179 | */ |
||
180 | public function dropIndex($name, $table) |
||
192 | |||
193 | /** |
||
194 | * @inheritDoc |
||
195 | * @throws NotSupportedException this is not supported by CUBRID. |
||
196 | */ |
||
197 | public function addCheck($name, $table, $expression) |
||
201 | |||
202 | /** |
||
203 | * @inheritDoc |
||
204 | * @throws NotSupportedException this is not supported by CUBRID. |
||
205 | */ |
||
206 | public function dropCheck($name, $table) |
||
210 | |||
211 | /** |
||
212 | * {@inheritdoc} |
||
213 | * @since 2.0.8 |
||
214 | */ |
||
215 | public function addCommentOnColumn($table, $column, $comment) |
||
226 | |||
227 | /** |
||
228 | * {@inheritdoc} |
||
229 | * @since 2.0.8 |
||
230 | */ |
||
231 | public function addCommentOnTable($table, $comment) |
||
235 | |||
236 | /** |
||
237 | * {@inheritdoc} |
||
238 | * @since 2.0.8 |
||
239 | */ |
||
240 | public function dropCommentFromColumn($table, $column) |
||
244 | |||
245 | /** |
||
246 | * {@inheritdoc} |
||
247 | * @since 2.0.8 |
||
248 | */ |
||
249 | public function dropCommentFromTable($table) |
||
253 | |||
254 | |||
255 | /** |
||
256 | * Gets column definition. |
||
257 | * |
||
258 | * @param string $table table name |
||
259 | * @param string $column column name |
||
260 | * @return null|string the column definition |
||
261 | * @throws Exception in case when table does not contain column |
||
262 | * @since 2.0.8 |
||
263 | */ |
||
264 | private function getColumnDefinition($table, $column) |
||
288 | } |
||
289 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.