From 9fca9391093fdf66798188a55cc9e9e087997dd1 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Wed, 11 Dec 2013 16:12:58 +0100 Subject: [PATCH] Fix getElement* methods. --- src/fr/devinsy/sikevadb/SQLSikevaDB.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/fr/devinsy/sikevadb/SQLSikevaDB.java b/src/fr/devinsy/sikevadb/SQLSikevaDB.java index aab155c..40ed4b5 100644 --- a/src/fr/devinsy/sikevadb/SQLSikevaDB.java +++ b/src/fr/devinsy/sikevadb/SQLSikevaDB.java @@ -1226,7 +1226,7 @@ public class SQLSikevaDB implements SikevaDB { connection = getConnection(); connection.setAutoCommit(true); statement = connection - .prepareStatement("SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? ORDER BY CREATION_DATE ASC"); + .prepareStatement("SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? ORDER BY CREATION_DATE ASC"); statement.setString(1, key); resultSet = statement.executeQuery(); @@ -1278,7 +1278,7 @@ public class SQLSikevaDB implements SikevaDB { connection = getConnection(); connection.setAutoCommit(true); statement = connection - .prepareStatement("SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? AND SUBKEY=? ORDER BY CREATION_DATE ASC"); + .prepareStatement("SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=? ORDER BY CREATION_DATE ASC"); statement.setString(1, key); statement.setString(2, subkey); resultSet = statement.executeQuery(); @@ -2089,6 +2089,8 @@ public class SQLSikevaDB implements SikevaDB { @Override public void renameKey(final String oldKey, final String newKey) throws SQLException { + logger.info("renameKey starting... [{}][{}]", oldKey, newKey); + // Connection connection = null; PreparedStatement statement = null; @@ -2107,6 +2109,8 @@ public class SQLSikevaDB implements SikevaDB { } finally { close(connection, statement, resultSet); } + + logger.info("renameKey done."); } /** @@ -2115,6 +2119,8 @@ public class SQLSikevaDB implements SikevaDB { @Override public void replaceInValue(final String key, final String... tokens) throws SQLException { + logger.info("replaceInValue starting... [{}]", key); + // String value = getValue(key); @@ -2125,6 +2131,8 @@ public class SQLSikevaDB implements SikevaDB { // put(key, value); + + logger.info("replaceInValue done."); } /** @@ -2133,13 +2141,15 @@ public class SQLSikevaDB implements SikevaDB { @Override public void replaceInValues(final String key, final String... tokens) throws SQLException { + logger.info("replaceInValues starting... [{}]", key); + // Elements elements = getElements(key); long count = 0; for (Element element : elements) { // - System.out.println(element.getKey() + count + " " + element.getSubkey() + "/" + elements.size()); + logger.info(element.getKey() + count + " " + element.getSubkey() + "/" + elements.size()); if (element.getSubkey() != null) { // @@ -2157,6 +2167,8 @@ public class SQLSikevaDB implements SikevaDB { put(element.getKey(), element.getSubkey(), value); } } + + logger.info("replaceInValues done."); } public void setDriverClassname(final String driverClassname) {