Refactored SQL part to dedicated package.

This commit is contained in:
Christian P. MOMON 2016-12-13 14:16:54 +01:00
parent bc969b91a6
commit 1ef88b0c7d
7 changed files with 12 additions and 4 deletions

View file

@ -20,6 +20,8 @@ package fr.devinsy.sikevadb;
import java.io.File; import java.io.File;
import fr.devinsy.sikevadb.sql.SQLSikevaDB;
/** /**
* *
* *

View file

@ -16,7 +16,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with SikevaDB. If not, see <http://www.gnu.org/licenses/>. * along with SikevaDB. If not, see <http://www.gnu.org/licenses/>.
*/ */
package fr.devinsy.sikevadb; package fr.devinsy.sikevadb.sql;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
@ -38,6 +38,9 @@ import org.joda.time.DateTime;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.sikevadb.Element;
import fr.devinsy.sikevadb.Elements;
import fr.devinsy.sikevadb.SikevaDB;
import fr.devinsy.util.StringList; import fr.devinsy.util.StringList;
/** /**
@ -709,7 +712,7 @@ public class SQLSikevaDB implements SikevaDB
StringList sqlCommands; StringList sqlCommands;
String databaseProductName = connection.getMetaData().getDatabaseProductName().split(" ")[0]; String databaseProductName = connection.getMetaData().getDatabaseProductName().split(" ")[0];
logger.debug("[datatbaseProductName={}]", databaseProductName); 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) if (sqlCommands == null)
{ {

View file

@ -16,7 +16,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with SikevaDB. If not, see <http://www.gnu.org/licenses/>. * along with SikevaDB. If not, see <http://www.gnu.org/licenses/>.
*/ */
package fr.devinsy.sikevadb; package fr.devinsy.sikevadb.sql;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;

View file

@ -16,7 +16,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with SikevaDB. If not, see <http://www.gnu.org/licenses/>. * along with SikevaDB. If not, see <http://www.gnu.org/licenses/>.
*/ */
package fr.devinsy.sikevadb; package fr.devinsy.sikevadb.sql;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
@ -34,6 +34,9 @@ import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; 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; import fr.devinsy.util.StringList;
/** /**