Fix bug di mysql vecchissimo
This commit is contained in:
+10
-2
@@ -617,10 +617,18 @@ def _unknownSqlTypeConverter(rs, col):
|
|||||||
return rs.getObject(col)
|
return rs.getObject(col)
|
||||||
|
|
||||||
def _to_datetime(rs, col):
|
def _to_datetime(rs, col):
|
||||||
java_val = rs.getTimestamp(col)
|
import jpype
|
||||||
|
SQLException = jpype.java.sql.SQLException
|
||||||
|
try:
|
||||||
|
java_val = rs.getTimestamp(col)
|
||||||
|
except:
|
||||||
|
java_val = bytes(rs.getBytes(col)).decode('utf-8')
|
||||||
if not java_val:
|
if not java_val:
|
||||||
return
|
return
|
||||||
d = datetime.datetime.strptime(str(java_val)[:19], "%Y-%m-%d %H:%M:%S")
|
try:
|
||||||
|
d = datetime.datetime.strptime(str(java_val)[:19], "%Y-%m-%d %H:%M:%S")
|
||||||
|
except ValueError:
|
||||||
|
return ""
|
||||||
d = d.replace(microsecond=int(str(java_val.getNanos())[:6]))
|
d = d.replace(microsecond=int(str(java_val.getNanos())[:6]))
|
||||||
return str(d)
|
return str(d)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user