This is an automated email from the ASF dual-hosted git repository.
doebele pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/empire-db.git
The following commit(s) were added to refs/heads/master by this push:
new 0bf99b95 EMPIREDB-414 fix for LocalTime problem with Prepared
Statements disabled
0bf99b95 is described below
commit 0bf99b95f086a5ebd82762a43457a7a3e2578e99
Author: Rainer Döbele <[email protected]>
AuthorDate: Fri Aug 4 12:01:42 2023 +0200
EMPIREDB-414 fix for LocalTime problem with Prepared Statements disabled
---
empire-db/src/main/java/org/apache/empire/db/DBSQLBuilder.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/empire-db/src/main/java/org/apache/empire/db/DBSQLBuilder.java
b/empire-db/src/main/java/org/apache/empire/db/DBSQLBuilder.java
index 476a06f3..a98525e6 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBSQLBuilder.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBSQLBuilder.java
@@ -22,6 +22,7 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
+import java.time.LocalTime;
import java.util.Collection;
import java.util.Date;
@@ -375,6 +376,10 @@ public abstract class DBSQLBuilder implements Appendable
{ // Convert LocalDateTime to Timestamp
ts = java.sql.Timestamp.valueOf((LocalDateTime)value);
}
+ else if ((value instanceof LocalTime))
+ { // Convert LocalTime to Timestamp with current date
+ ts =
java.sql.Timestamp.valueOf(((LocalTime)value).atDate(LocalDate.now()));
+ }
else
{ // "Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]"
String dtValue = value.toString().trim();