From 86d1087f16f54c182ae290d75eda2fc5bb0d9c9b Mon Sep 17 00:00:00 2001 From: adustman Date: Mon, 27 Feb 2006 04:20:48 +0000 Subject: [PATCH] Enable MULTI_STATEMENTS if the client library is 4.1 or newer. Enable MULTI_RESULTS if the client library is 5.0 or newer. --- MySQLdb/MySQLdb/connections.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MySQLdb/MySQLdb/connections.py b/MySQLdb/MySQLdb/connections.py index 4131977..01f9fd9 100644 --- a/MySQLdb/MySQLdb/connections.py +++ b/MySQLdb/MySQLdb/connections.py @@ -130,7 +130,16 @@ class Connection(_mysql.connection): use_unicode = kwargs.get('use_unicode', 0) if kwargs.has_key('use_unicode'): del kwargs2['use_unicode'] - + + client_flag = kwargs.get('client_flag', 0) + client_version = [ int(n) for n in _mysql.get_client_info().split('.')[:2] ] + if client_version >= (4, 1): + client_version |= CLIENT.MULTI_STATEMENTS + if client_version >= (5, 0): + client_version |= CLIENT.MULTI_RESULTS + + kwargs2['client_flag'] = client_flag + super(Connection, self).__init__(*args, **kwargs2) self.charset = self.character_set_name().split('_')[0]