-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
MULTI_STATEMENTS & MULTI_RESULTS always enabled in client_flag in Connection #590
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
Comments
Hi @mjmaenpaa , what's your scenario on the MULTI_STATEMENTS & MULTI_RESULTS, why you need to disable it? It is not usual to disable it? Could you describe your scenario? |
Hi, main reason I needed to disable them was because I was doing security testing for my application and simplest way to detect multi statement sql injection was to simply disable multi statement support in connection. But I managed to disable it by monkey patching before creating connection:
|
@mjmaenpaa , I would suggest you just set conn = pymysql.connect(defer_connect=True)
conn.client_flag &= ~pymysql.constants.CLIENT.MULTI_STATEMENTS
conn.connect() This is a perfect way to do it by set per connections. |
@mjmaenpaa , and I do not think we can modify |
I think default should be same to MySQL Connector/C
|
@methane , In MySQL Connector/C, the Or should we put conn = pymysql.connect(defer_connect=True)
conn.client_flag &= ~pymysql.constants.CLIENT.MULTI_STATEMENTS
conn.connect() as FAQ about how to disable this attributes? |
I will do it at 0.8. Release note can have information about that. |
In PyMySQL the "MULTI_STATEMENT" flag has been disabled by default. (see PyMySQL/PyMySQL#590 ) Migration 98 had a single string with multiple statements ran in a single execution. Moving this to multiple executions of the same statements allows the migration to succeed with the new behaviour. Caused-By: PyMySQL/PyMySQL@c0aa317 Change-Id: I5f6d92f695c4c5830b8595b0cecbbafb426470a1
* Update designate from branch 'master' - PyMySQL 0.8.0 compat fix In PyMySQL the "MULTI_STATEMENT" flag has been disabled by default. (see PyMySQL/PyMySQL#590 ) Migration 98 had a single string with multiple statements ran in a single execution. Moving this to multiple executions of the same statements allows the migration to succeed with the new behaviour. Caused-By: PyMySQL/PyMySQL@c0aa317 Change-Id: I5f6d92f695c4c5830b8595b0cecbbafb426470a1
In PyMySQL the "MULTI_STATEMENT" flag has been disabled by default. (see PyMySQL/PyMySQL#590 ) Migration 98 had a single string with multiple statements ran in a single execution. Moving this to multiple executions of the same statements allows the migration to succeed with the new behaviour. Caused-By: PyMySQL/PyMySQL@c0aa317 Change-Id: I5f6d92f695c4c5830b8595b0cecbbafb426470a1
In PyMySQL the "MULTI_STATEMENT" flag has been disabled by default. (see PyMySQL/PyMySQL#590 ) Migration 98 had a single string with multiple statements ran in a single execution. Moving this to multiple executions of the same statements allows the migration to succeed with the new behaviour. Caused-By: PyMySQL/PyMySQL@c0aa317 Change-Id: I5f6d92f695c4c5830b8595b0cecbbafb426470a1
MULTI_STATEMENTS & MULTI_RESULTS are always enabled in Connection client_flag and there is no way to disable them. client_flag parameter is always bitwise or'd with constants.CLIENT.CAPABILITIES which includes MULTI_STATEMENTS & MULTI_RESULTS.
In connections.py:
client_flag |= CLIENT.CAPABILITIES
Small example to demonstrate issue:
And what happens currently:
And what happens if MULTI_STATEMENTS is removed from CAPABILITIES:
The text was updated successfully, but these errors were encountered: