Work around bug. Fixes #18.

master
baztian 2017-03-12 21:47:29 +01:00
parent 8f3345bcdf
commit 364a3584d5
2 changed files with 6 additions and 3 deletions

View File

@ -595,8 +595,12 @@ def _to_date(rs, col):
java_val = rs.getDate(col)
if not java_val:
return
d = datetime.datetime.strptime(str(java_val)[:10], "%Y-%m-%d")
return d.strftime("%Y-%m-%d")
# The following code requires Python 3.3+ on dates before year 1900.
# d = datetime.datetime.strptime(str(java_val)[:10], "%Y-%m-%d")
# return d.strftime("%Y-%m-%d")
# Workaround / simpler soltution (see
# https://github.com/baztian/jaydebeapi/issues/18):
return str(java_val)[:10]
def _to_binary(rs, col):
java_val = rs.getObject(col)

View File

@ -66,7 +66,6 @@ class MockTest(unittest.TestCase):
except jaydebeapi.DatabaseError as e:
self.assertEquals(str(e), "java.sql.SQLException: expected")
def test_runtime_exception_on_execute(self):
self.conn.jconn.mockExceptionOnExecute("java.lang.RuntimeException", "expected")
cursor = self.conn.cursor()