Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Directly use the driverConnection executeUpdate method #37358

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 1 commit into from
Jun 25, 2020
Merged

Directly use the driverConnection executeUpdate method #37358

merged 1 commit into from
Jun 25, 2020

Conversation

TristanPouliquen
Copy link
Contributor

@TristanPouliquen TristanPouliquen commented Jun 19, 2020

executeUpdate & executeQuery methods do not throw a TableNotFoundException. No need for the try/catch as it is done for executeQuery

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #37355
License MIT

As explained in #37355, when doing a write operation, one should avoid using the executeQuery method of a Connection, as Doctrine's MasterSlaveConnection can pick a slave instance (usually read-only) for these operations.

Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

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

Is it possible to write a test for your scenario?

@TristanPouliquen
Copy link
Contributor Author

@derrabus Hey, I tried but I don't know if I can easily simulate a master-slave connection with read-only slaves easily with the CI. If you have any clue on how to proceed, I'd be happy to do it!

@derrabus
Copy link
Member

🤔 I don't have a good idea either.

@fabpot
Copy link
Member

fabpot commented Jun 25, 2020

Thank you @TristanPouliquen.

@christickner
Copy link

Thanks @TristanPouliquen

This was referenced Jul 24, 2020
@TristanPouliquen TristanPouliquen deleted the use-execute-update-in-messenger-doctrine-transport branch October 10, 2022 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants