Fix bug di mysql vecchissimo
parent
cd2fd4c6c0
commit
56e7c7b578
|
|
@ -617,10 +617,18 @@ def _unknownSqlTypeConverter(rs, col):
|
|||
return rs.getObject(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:
|
||||
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]))
|
||||
return str(d)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue