Work around bug. Fixes #18.
parent
8f3345bcdf
commit
364a3584d5
|
|
@ -595,8 +595,12 @@ def _to_date(rs, col):
|
||||||
java_val = rs.getDate(col)
|
java_val = rs.getDate(col)
|
||||||
if not java_val:
|
if not java_val:
|
||||||
return
|
return
|
||||||
d = datetime.datetime.strptime(str(java_val)[:10], "%Y-%m-%d")
|
# The following code requires Python 3.3+ on dates before year 1900.
|
||||||
return d.strftime("%Y-%m-%d")
|
# 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):
|
def _to_binary(rs, col):
|
||||||
java_val = rs.getObject(col)
|
java_val = rs.getObject(col)
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ class MockTest(unittest.TestCase):
|
||||||
except jaydebeapi.DatabaseError as e:
|
except jaydebeapi.DatabaseError as e:
|
||||||
self.assertEquals(str(e), "java.sql.SQLException: expected")
|
self.assertEquals(str(e), "java.sql.SQLException: expected")
|
||||||
|
|
||||||
|
|
||||||
def test_runtime_exception_on_execute(self):
|
def test_runtime_exception_on_execute(self):
|
||||||
self.conn.jconn.mockExceptionOnExecute("java.lang.RuntimeException", "expected")
|
self.conn.jconn.mockExceptionOnExecute("java.lang.RuntimeException", "expected")
|
||||||
cursor = self.conn.cursor()
|
cursor = self.conn.cursor()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue