Added disconnect checks for timeout, unable to read, and unable to write

This commit is contained in:
John Anderson
2013-03-18 14:49:28 -07:00
parent 9ad9ccec87
commit cb43db6bd1
2 changed files with 9 additions and 0 deletions
+3
View File
@@ -85,6 +85,9 @@ class MSDialect_pymssql(MSDialect):
def is_disconnect(self, e, connection, cursor):
for msg in (
"Error 20003", # Connection Timeout
"Error 20004", # Read from SQL server failed
"Error 20006", # Write to SQL Server failed
"Error 10054",
"Not connected to any MS SQL server",
"Connection is closed"
+6
View File
@@ -1320,6 +1320,12 @@ class ParseConnectTest(fixtures.TestBase, AssertsCompiledSQL):
'user': 'scott', 'database': 'test'}], connection
)
def test_pymssql_disconnect(self):
dialect = pymssql.dialect()
for error in ['20003', '20003', '20006']:
eq_(dialect.is_disconnect('Error %s' % error, None, None), True)
@testing.only_on(['mssql+pyodbc', 'mssql+pymssql'], "FreeTDS specific test")
def test_bad_freetds_warning(self):
engine = engines.testing_engine()