-
Notifications
You must be signed in to change notification settings - Fork 440
Description
When using the enqueue symfony bundle together with enqueue/dbal against a MS-SQL server , running the console command:-
php bin\console enqueue:consume --setup-broker -vv
fails with the error:-
[PDOException (42S22)] SQLSTATE[42S22]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Invalid column name 'false'.
I have traced this to the file vendor/enqueue/dbal/DbalConsumerHelperTrait.php, function removeExpiredMessages().
`
$delete = $this->getConnection()->createQueryBuilder()
->delete($this->getContext()->getTableName())
->andWhere('(time_to_live IS NOT NULL) AND (time_to_live < :now)')
->andWhere('delivery_id IS NULL')
->andWhere('redelivered = false')
->setParameter(':now', time(), Type::BIGINT)
;
`
Changing this query as below fixes the issue for me.
`
$delete = $this->getConnection()->createQueryBuilder()
->delete($this->getContext()->getTableName())
->andWhere('(time_to_live IS NOT NULL) AND (time_to_live < :now)')
->andWhere('delivery_id IS NULL')
->andWhere('redelivered = :redelivered')
->setParameter(':now', time(), Type::BIGINT)
->setParameter('redelivered', false, Type::BOOLEAN)
;
`