Skip to content
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

MySQL doesn't support multiple statements #240

Closed
wxiaoguang opened this issue Oct 31, 2024 · 2 comments
Closed

MySQL doesn't support multiple statements #240

wxiaoguang opened this issue Oct 31, 2024 · 2 comments

Comments

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Oct 31, 2024

This change is not right. MySQL doesn't work that way.

LoadFixtures failed after retries: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE `issue` AUTO_INCREMENT = 10000;ALTER TABLE `release` AUTO_INCREMENT ' at line 1

Originally posted by @wxiaoguang in #208 (comment)


Well ... see the REAMDE: ?multiStatements=true but it is not a good approach. It makes the tests different from the production config.

The testfixtures should use the same connection parameters as production IMO

@slsyy
Copy link
Contributor

slsyy commented Oct 31, 2024

I will think about solution

The testfixtures should use the same connection parameters as production IMO

You can use a separate connection for testfixtures. It won't work in transaction though

slsyy added a commit to slsyy/testfixtures that referenced this issue Dec 22, 2024
`multiStatements=true` parameter in connection string to work properly

It looks like that the requirement for that parameter (which is stated
in `README.md`) was not honored by users (e.g go-testfixtures#240), so I want to
keep the old behavior for convienience

This commit:
* remove mention about parameter requirement from `README.md`
* revert default to `one query per one statement`
* allows to keep `one query per multiple statements` logic with a
  `testfixtures.AllowMultipleStatementsInOneQuery` flag
slsyy added a commit to slsyy/testfixtures that referenced this issue Dec 22, 2024
The go-testfixtures#208 PR introduced an optimisation, which requires the
`multiStatements=true` parameter in connection string to work properly

It looks like that the requirement for that parameter (which is stated
in `README.md`) was not honored by users (e.g go-testfixtures#240), so I want to
keep the old behavior for convienience

This commit:
* remove mention about parameter requirement from `README.md`
* revert default to `one query per one statement`
* allows to keep `one query per multiple statements` logic with a
  `testfixtures.AllowMultipleStatementsInOneQuery` flag
* some tests for both use cases
slsyy added a commit to slsyy/testfixtures that referenced this issue Dec 22, 2024
The go-testfixtures#208 PR introduced an optimisation, which requires the
`multiStatements=true` parameter in connection string to work properly

It looks like that the requirement for that parameter (which is stated
in `README.md`) was not honored by users (e.g go-testfixtures#240), so I want to
keep the old behavior for convenience

This commit:
* remove mention about parameter requirement from `README.md`
* revert default to `one query per one statement`
* allows to keep `one query per multiple statements` logic with a
  `testfixtures.AllowMultipleStatementsInOneQuery` flag
* some tests for both use cases
slsyy added a commit that referenced this issue Dec 22, 2024
The #208 PR introduced an optimisation, which requires the
`multiStatements=true` parameter in connection string to work properly

It looks like that the requirement for that parameter (which is stated
in `README.md`) was not honored by users (e.g #240), so I want to
keep the old behavior for convenience

This commit:
* remove mention about parameter requirement from `README.md`
* revert default to `one query per one statement`
* allows to keep `one query per multiple statements` logic with a
  `testfixtures.AllowMultipleStatementsInOneQuery` flag
* some tests for both use cases
@slsyy
Copy link
Contributor

slsyy commented Dec 22, 2024

@slsyy slsyy closed this as completed Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants