typhon-project / typhonql

Typhon Query Language
Eclipse Public License 2.0
4 stars 1 forks source link

[BUG] Problem with datetime value inserted #101

Closed meuriceloup closed 4 years ago

meuriceloup commented 4 years ago

Hi guys,

When I try to insert the following datetime value from a QL query, it returns an error: 2020-02-21T14:03:45.274+00:00 This is the error:

java.time.format.DateTimeParseException: Text '2020-02-21T14:03:45.274+00:00' could not be parsed, unparsed text found at index 23
        at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1952) ~[?:1.8.0_262]
        at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851) ~[?:1.8.0_262]
        at java.time.LocalDateTime.parse(LocalDateTime.java:492) ~[?:1.8.0_262]
        at java.time.LocalDateTime.parse(LocalDateTime.java:477) ~[?:1.8.0_262]
        at nl.cwi.swat.typhonql.client.XMIPolystoreConnection.lambda$8(XMIPolystoreConnection.java:288) ~[typhonql-0.1.0-SNAPSHOT.jar:?]
        at nl.cwi.swat.typhonql.client.XMIPolystoreConnection.buildExternalArguments(XMIPolystoreConnection.java:341) ~[typhonql-0.1.0-SNAPSHOT.jar:?]
        at nl.cwi.swat.typhonql.client.XMIPolystoreConnection.evaluatePreparedStatementQuery(XMIPolystoreConnection.java:230) ~[typhonql-0.1.0-SNAPSHOT.jar:?]
        at nl.cwi.swat.typhonql.client.XMIPolystoreConnection.executePreparedUpdate(XMIPolystoreConnection.java:397) ~[typhonql-0.1.0-SNAPSHOT.jar:?]
        at engineering.swat.typhonql.server.QLRestServer.handleCommand(QLRestServer.java:290) ~[classes/:?]

I also tried: 2020-02-21T14:03:45.274Z but it has the same behavior

I took a look at the code parsing the string date: qlValueMappers.put("datetime", s -> LocalDateTime.parse(s)); If I'm now wrong, I think the LocalDateTime class does not deal with the time zone (but class ZonedDateTime does). At this moment, it is not possible anymore to insert date time value with a time zone, and it was possible in the past (I think)

Thanks in advance, Loup