Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Reverted "[1.3.x] Fixed #18135 -- Close connection used for db versio…

…n checking"

This reverts commit a15d3b5. Django
1.3.x is in security fixes only state, and this wasn't a security
issue.
  • Loading branch information...
commit 7ca10b1dac758924f9bbd219880cc17a537c5e47 1 parent a15d3b5
@akaariai akaariai authored
View
15 django/db/backends/mysql/base.py
@@ -334,19 +334,10 @@ def _rollback(self):
def get_server_version(self):
if not self.server_version:
- new_connection = False
if not self._valid_connection():
- # Ensure we have a connection with the DB by using a temporary
- # cursor
- new_connection = True
- self.cursor().close()
- server_info = self.connection.get_server_info()
- if new_connection:
- # Make sure we close the connection
- self.connection.close()
- self.connection = None
- m = server_version_re.match(server_info)
+ self.cursor()
+ m = server_version_re.match(self.connection.get_server_info())
if not m:
- raise Exception('Unable to determine MySQL version from version string %r' % server_info)
+ raise Exception('Unable to determine MySQL version from version string %r' % self.connection.get_server_info())
self.server_version = tuple([int(x) for x in m.groups()])
return self.server_version
View
8 tests/regressiontests/backends/tests.py
@@ -56,14 +56,6 @@ def test_client_encoding(self):
self.assertEqual(connection.connection.encoding, "UTF-8")
self.assertEqual(connection.connection.nencoding, "UTF-8")
-class MySQLTests(TestCase):
- @unittest.skipUnless(connection.vendor == 'mysql',
- "Test valid only for MySQL")
- def test_server_version_connections(self):
- connection.close()
- connection.get_server_version()
- self.assertTrue(connection.connection is None)
-
class DateQuotingTest(TestCase):
def test_django_date_trunc(self):
Please sign in to comment.
Something went wrong with that request. Please try again.