From df5e6db1839a2155c9754f5ea356b1e2d6b613ce Mon Sep 17 00:00:00 2001 From: games647 Date: Wed, 3 Aug 2022 13:21:44 +0200 Subject: [PATCH] Set SQLite setting using the correct data class Fixes #870 --- core/pom.xml | 7 +++++++ .../games647/fastlogin/core/storage/SQLiteStorage.java | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 48dcdbc5..bdf6ccd3 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -184,5 +184,12 @@ gson 2.9.1 + + + org.xerial + sqlite-jdbc + 3.36.0.3 + provided + diff --git a/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLiteStorage.java b/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLiteStorage.java index c57dec32..14645401 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLiteStorage.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLiteStorage.java @@ -37,6 +37,8 @@ import java.util.UUID; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import org.sqlite.SQLiteConfig; + public class SQLiteStorage extends SQLStorage { private static final String SQLITE_DRIVER = "org.sqlite.SQLiteDataSource"; @@ -52,11 +54,14 @@ public class SQLiteStorage extends SQLStorage { config.setConnectionTestQuery("SELECT 1"); config.setMaximumPoolSize(1); - config.addDataSourceProperty("databaseName", path); + config.addDataSourceProperty("url", path); // a try to fix https://www.spigotmc.org/threads/fastlogin.101192/page-26#post-1874647 // format strings retrieved by the timestamp column to match them from MySQL - config.addDataSourceProperty("date_string_format", "yyyy-MM-dd HH:mm:ss"); + // vs the default: yyyy-MM-dd HH:mm:ss.SSS + SQLiteConfig sqLiteConfig = new SQLiteConfig(); + sqLiteConfig.setDateStringFormat("yyyy-MM-dd HH:mm:ss"); + config.addDataSourceProperty("config", config); // TODO: test first for compatibility // config.addDataSourceProperty("date_precision", "seconds");