From 2df253987210c805782aaeea5cea4e21b2038670 Mon Sep 17 00:00:00 2001 From: "nikit91@gmail.com" Date: Fri, 19 Oct 2018 09:10:54 +0200 Subject: [PATCH] deleting unused class --- .../word2vecrestful/db/SQLiteDBHandler.java | 98 ------------------- 1 file changed, 98 deletions(-) delete mode 100644 src/main/java/org/aksw/word2vecrestful/db/SQLiteDBHandler.java diff --git a/src/main/java/org/aksw/word2vecrestful/db/SQLiteDBHandler.java b/src/main/java/org/aksw/word2vecrestful/db/SQLiteDBHandler.java deleted file mode 100644 index e37f0dd..0000000 --- a/src/main/java/org/aksw/word2vecrestful/db/SQLiteDBHandler.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.aksw.word2vecrestful.db; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; - -import org.apache.log4j.Logger; -import org.sqlite.SQLiteConfig; - -public class SQLiteDBHandler { - - public static Logger LOG = Logger.getLogger(AbstractSQLightDB.class); - - private static int queryTimeout = 30; - - private String db; - protected Connection connection = null; - protected Statement statement = null; - - public SQLiteDBHandler(String dbName) { - try { - this.db = dbName.concat(".db"); - Class.forName("org.sqlite.JDBC"); - } catch (final ClassNotFoundException e) { - LOG.error(e.getLocalizedMessage(), e); - } - - } - - public void commit() throws SQLException { - if (connection != null) { - connection.commit(); - } - } - - /** - * Executes the given query on database and returns the numbers of rows updated - * - * @param query - * - statement to be executed - * @return - numbers of rows updated - */ - protected boolean executeStatement(String query) { - boolean res = false; - if (connect()) { - try { - statement = connection.createStatement(); - statement.setQueryTimeout(queryTimeout); - res = statement.execute(query); - } catch (final SQLException e) { - LOG.error(e.getLocalizedMessage(), e); - } finally { - disconnect(); - } - } - return res; - } - - /** - * Disconnect DB. - */ - public void disconnect() { - try { - if (connection != null) { - connection.close(); - } - } catch (final SQLException e) { - LOG.error("\n", e); - } - } - - /** - * Connect DB. - */ - public boolean connect() { - final SQLiteConfig config = new SQLiteConfig(); - // config.setEncoding(SQLiteConfig.Encoding.UTF8); - return connect(config); - } - - /** - * Connect DB. - * - * @param config - * @return true if connected - */ - protected boolean connect(final SQLiteConfig config) { - try { - connection = DriverManager.getConnection("jdbc:sqlite:".concat(db), config.toProperties()); - } catch (final SQLException e) { - LOG.error("\n", e); - statement = null; - } - return connection == null ? false : true; - } - -}