From 1ef88b0c7dcb72410e1036b899da6dcf02fdf14e Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Tue, 13 Dec 2016 14:16:54 +0100 Subject: [PATCH] Refactored SQL part to dedicated package. --- src/fr/devinsy/sikevadb/SikevaDBFactory.java | 2 ++ src/fr/devinsy/sikevadb/{ => sql}/SQLSikevaDB.java | 7 +++++-- src/fr/devinsy/sikevadb/{ => sql}/SQLSikevaDBTools.java | 2 +- src/fr/devinsy/sikevadb/{ => sql}/createTable-HSQL.sql | 0 src/fr/devinsy/sikevadb/{ => sql}/createTable-MySQL.sql | 0 test/fr/devinsy/sikevadb/{ => sql}/SQLSikevaDBTest.java | 5 ++++- test/fr/devinsy/sikevadb/{ => sql}/data.xml | 0 7 files changed, 12 insertions(+), 4 deletions(-) rename src/fr/devinsy/sikevadb/{ => sql}/SQLSikevaDB.java (99%) rename src/fr/devinsy/sikevadb/{ => sql}/SQLSikevaDBTools.java (98%) rename src/fr/devinsy/sikevadb/{ => sql}/createTable-HSQL.sql (100%) rename src/fr/devinsy/sikevadb/{ => sql}/createTable-MySQL.sql (100%) rename test/fr/devinsy/sikevadb/{ => sql}/SQLSikevaDBTest.java (99%) rename test/fr/devinsy/sikevadb/{ => sql}/data.xml (100%) diff --git a/src/fr/devinsy/sikevadb/SikevaDBFactory.java b/src/fr/devinsy/sikevadb/SikevaDBFactory.java index e5c4068..c39d37f 100644 --- a/src/fr/devinsy/sikevadb/SikevaDBFactory.java +++ b/src/fr/devinsy/sikevadb/SikevaDBFactory.java @@ -20,6 +20,8 @@ package fr.devinsy.sikevadb; import java.io.File; +import fr.devinsy.sikevadb.sql.SQLSikevaDB; + /** * * diff --git a/src/fr/devinsy/sikevadb/SQLSikevaDB.java b/src/fr/devinsy/sikevadb/sql/SQLSikevaDB.java similarity index 99% rename from src/fr/devinsy/sikevadb/SQLSikevaDB.java rename to src/fr/devinsy/sikevadb/sql/SQLSikevaDB.java index 2f1e3ce..98508df 100644 --- a/src/fr/devinsy/sikevadb/SQLSikevaDB.java +++ b/src/fr/devinsy/sikevadb/sql/SQLSikevaDB.java @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with SikevaDB. If not, see . */ -package fr.devinsy.sikevadb; +package fr.devinsy.sikevadb.sql; import java.io.FileNotFoundException; import java.io.IOException; @@ -38,6 +38,9 @@ import org.joda.time.DateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import fr.devinsy.sikevadb.Element; +import fr.devinsy.sikevadb.Elements; +import fr.devinsy.sikevadb.SikevaDB; import fr.devinsy.util.StringList; /** @@ -709,7 +712,7 @@ public class SQLSikevaDB implements SikevaDB StringList sqlCommands; String databaseProductName = connection.getMetaData().getDatabaseProductName().split(" ")[0]; logger.debug("[datatbaseProductName={}]", databaseProductName); - sqlCommands = SQLSikevaDBTools.loadSQLScript(SQLSikevaDB.class.getResource("/fr/devinsy/sikevadb/createTable-" + databaseProductName + ".sql")); + sqlCommands = SQLSikevaDBTools.loadSQLScript(SQLSikevaDB.class.getResource("/fr/devinsy/sikevadb/sql/createTable-" + databaseProductName + ".sql")); if (sqlCommands == null) { diff --git a/src/fr/devinsy/sikevadb/SQLSikevaDBTools.java b/src/fr/devinsy/sikevadb/sql/SQLSikevaDBTools.java similarity index 98% rename from src/fr/devinsy/sikevadb/SQLSikevaDBTools.java rename to src/fr/devinsy/sikevadb/sql/SQLSikevaDBTools.java index 22e5a78..6a2aa56 100644 --- a/src/fr/devinsy/sikevadb/SQLSikevaDBTools.java +++ b/src/fr/devinsy/sikevadb/sql/SQLSikevaDBTools.java @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with SikevaDB. If not, see . */ -package fr.devinsy.sikevadb; +package fr.devinsy.sikevadb.sql; import java.io.BufferedReader; import java.io.IOException; diff --git a/src/fr/devinsy/sikevadb/createTable-HSQL.sql b/src/fr/devinsy/sikevadb/sql/createTable-HSQL.sql similarity index 100% rename from src/fr/devinsy/sikevadb/createTable-HSQL.sql rename to src/fr/devinsy/sikevadb/sql/createTable-HSQL.sql diff --git a/src/fr/devinsy/sikevadb/createTable-MySQL.sql b/src/fr/devinsy/sikevadb/sql/createTable-MySQL.sql similarity index 100% rename from src/fr/devinsy/sikevadb/createTable-MySQL.sql rename to src/fr/devinsy/sikevadb/sql/createTable-MySQL.sql diff --git a/test/fr/devinsy/sikevadb/SQLSikevaDBTest.java b/test/fr/devinsy/sikevadb/sql/SQLSikevaDBTest.java similarity index 99% rename from test/fr/devinsy/sikevadb/SQLSikevaDBTest.java rename to test/fr/devinsy/sikevadb/sql/SQLSikevaDBTest.java index 5119cae..f8b7a26 100644 --- a/test/fr/devinsy/sikevadb/SQLSikevaDBTest.java +++ b/test/fr/devinsy/sikevadb/sql/SQLSikevaDBTest.java @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with SikevaDB. If not, see . */ -package fr.devinsy.sikevadb; +package fr.devinsy.sikevadb.sql; import java.io.IOException; import java.sql.SQLException; @@ -34,6 +34,9 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; +import fr.devinsy.sikevadb.Element; +import fr.devinsy.sikevadb.Elements; +import fr.devinsy.sikevadb.sql.SQLSikevaDB; import fr.devinsy.util.StringList; /** diff --git a/test/fr/devinsy/sikevadb/data.xml b/test/fr/devinsy/sikevadb/sql/data.xml similarity index 100% rename from test/fr/devinsy/sikevadb/data.xml rename to test/fr/devinsy/sikevadb/sql/data.xml