Skip to content

Commit c387df2

Browse files
committed
Add column type inference to placeholders
1 parent 3c7ee57 commit c387df2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Processor/Expression/Evaluator.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,15 @@ public static function getColumnSchema(
236236
return self::getColumnTypeFromValue($expr, $scope->parameters[$expr->parameterName]);
237237
}
238238

239+
// When MySQL can't figure out a variable column's type
240+
// it defaults to string
241+
return new Column\Varchar(10);
242+
243+
case \Vimeo\MysqlEngine\Query\Expression\PlaceholderExpression::class:
244+
if (\array_key_exists($expr->offset, $scope->parameters)) {
245+
return self::getColumnTypeFromValue($expr, $scope->parameters[$expr->offset]);
246+
}
247+
239248
// When MySQL can't figure out a variable column's type
240249
// it defaults to string
241250
return new Column\Varchar(10);

0 commit comments

Comments
 (0)