Skip to content

Exception on affected record !=1 #733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/dbal/DbalProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function send(Destination $destination, Message $message): void
}

try {
$this->context->getDbalConnection()->insert($this->context->getTableName(), $dbalMessage, [
$rowsAffected = $this->context->getDbalConnection()->insert($this->context->getTableName(), $dbalMessage, [
'id' => Type::GUID,
'published_at' => Type::INTEGER,
'body' => Type::TEXT,
Expand All @@ -125,10 +125,14 @@ public function send(Destination $destination, Message $message): void
'queue' => Type::STRING,
'time_to_live' => Type::INTEGER,
'delayed_until' => Type::INTEGER,
'redelivered' => Type::BOOLEAN,
'redelivered' => Type::SMALLINT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is strange. Functional tests are working with the current code, and as far as I know doctrine should handle boolean type internally according to platform driver.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, should be investigated deeper.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found people had similar problems with boolean. For eample https://stackoverflow.com/questions/10242312/pdo-bindvalue-with-pdoparam-bool-causes-statement-execute-to-fail-silently

Try to search "insert with PDO::PARAM_BOOL fails"
I have php 7.3 and mysql 5.7, but the issue is still here.

May be if you could use SMALLINT everywhere for the type of this field it could be a solution.

'delivery_id' => Type::STRING,
'redeliver_after' => Type::BIGINT,
]);

if (1 !== $rowsAffected) {
throw new Exception('The message was not enqueued. Dbal did not confirm that the record is inserted.');
}
} catch (\Exception $e) {
throw new Exception('The transport fails to send the message due to some internal error.', 0, $e);
}
Expand Down