@@ -110,6 +110,11 @@ class object, used to create cursors (keyword only)
110
110
:param int client_flag:
111
111
flags to use or 0 (see MySQL docs or constants/CLIENTS.py)
112
112
113
+ :param bool multi_statements:
114
+ If True, enable multi statements for clients >= 4.1 and multi
115
+ results for clients >= 5.0. Set to False to disable it, which gives
116
+ some protection against injection attacks. Defaults to True.
117
+
113
118
:param str ssl_mode:
114
119
specify the security settings for connection to the server;
115
120
see the MySQL documentation for more details
@@ -169,13 +174,16 @@ class object, used to create cursors (keyword only)
169
174
self ._binary_prefix = kwargs2 .pop ("binary_prefix" , False )
170
175
171
176
client_flag = kwargs .get ("client_flag" , 0 )
172
- client_version = tuple (
173
- [numeric_part (n ) for n in _mysql .get_client_info ().split ("." )[:2 ]]
174
- )
175
- if client_version >= (4 , 1 ):
176
- client_flag |= CLIENT .MULTI_STATEMENTS
177
- if client_version >= (5 , 0 ):
178
- client_flag |= CLIENT .MULTI_RESULTS
177
+
178
+ multi_statements = kwargs2 .pop ("multi_statements" , True )
179
+ if multi_statements :
180
+ client_version = tuple (
181
+ [numeric_part (n ) for n in _mysql .get_client_info ().split ("." )[:2 ]]
182
+ )
183
+ if client_version >= (4 , 1 ):
184
+ client_flag |= CLIENT .MULTI_STATEMENTS
185
+ if client_version >= (5 , 0 ):
186
+ client_flag |= CLIENT .MULTI_RESULTS
179
187
180
188
kwargs2 ["client_flag" ] = client_flag
181
189
0 commit comments