Fix getElement* methods.

This commit is contained in:
Christian P. MOMON 2013-12-11 16:12:58 +01:00
parent db926b2afb
commit 9fca939109

View file

@ -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) {