Rename SQL table.

This commit is contained in:
Christian P. MOMON 2013-11-06 16:07:49 +01:00
parent 0ed02e7d99
commit dd838b4104
4 changed files with 52 additions and 52 deletions

View file

@ -108,7 +108,7 @@ public class SQLSikevaDB implements SikevaDB {
// //
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("UPDATE elements SET ARCHIVE_DATE=? WHERE TOPKEY=? AND SUBKEY IS NULL"); statement = connection.prepareStatement("UPDATE sikevadb_elements SET ARCHIVE_DATE=? WHERE TOPKEY=? AND SUBKEY IS NULL");
statement.setTimestamp(1, toTimestamp(element.getArchiveDate())); statement.setTimestamp(1, toTimestamp(element.getArchiveDate()));
statement.setString(2, element.getKey()); statement.setString(2, element.getKey());
@ -147,7 +147,7 @@ public class SQLSikevaDB implements SikevaDB {
// //
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("UPDATE elements SET ARCHIVE_DATE=? WHERE TOPKEY=? AND SUBKEY=?"); statement = connection.prepareStatement("UPDATE sikevadb_elements SET ARCHIVE_DATE=? WHERE TOPKEY=? AND SUBKEY=?");
statement.setTimestamp(1, toTimestamp(element.getArchiveDate())); statement.setTimestamp(1, toTimestamp(element.getArchiveDate()));
statement.setString(2, element.getKey()); statement.setString(2, element.getKey());
@ -175,7 +175,7 @@ public class SQLSikevaDB implements SikevaDB {
// //
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("DELETE FROM elements WHERE ARCHIVE_DATE IS NOT NULL"); statement = connection.prepareStatement("DELETE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL");
statement.executeUpdate(); statement.executeUpdate();
@ -201,7 +201,7 @@ public class SQLSikevaDB implements SikevaDB {
// //
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("DELETE FROM elements WHERE ARCHIVE_DATE IS NOT NULL AND UNIX_TIMESTAMP(ARCHIVE_DATE)<?"); statement = connection.prepareStatement("DELETE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL AND UNIX_TIMESTAMP(ARCHIVE_DATE)<?");
statement.setLong(1, beforeDate.getMillis() / 1000); statement.setLong(1, beforeDate.getMillis() / 1000);
@ -243,7 +243,7 @@ public class SQLSikevaDB implements SikevaDB {
// //
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("DELETE FROM elements"); statement = connection.prepareStatement("DELETE FROM sikevadb_elements");
statement.executeUpdate(); statement.executeUpdate();
@ -319,7 +319,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
statement = connection.createStatement(); statement = connection.createStatement();
resultSet = statement.executeQuery("SELECT count(*) FROM elements"); resultSet = statement.executeQuery("SELECT count(*) FROM sikevadb_elements");
resultSet.next(); resultSet.next();
result = resultSet.getLong(1); result = resultSet.getLong(1);
@ -345,7 +345,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT count(*) FROM elements WHERE TOPKEY=?"); statement = connection.prepareStatement("SELECT count(*) FROM sikevadb_elements WHERE TOPKEY=?");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -377,7 +377,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT count(*) FROM elements WHERE TOPKEY=? AND SUBKEY=?"); statement = connection.prepareStatement("SELECT count(*) FROM sikevadb_elements WHERE TOPKEY=? AND SUBKEY=?");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -408,7 +408,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.createStatement(); statement = connection.createStatement();
resultSet = statement.executeQuery("SELECT count(*) FROM elements WHERE ARCHIVE_DATE IS NOT NULL"); resultSet = statement.executeQuery("SELECT count(*) FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL");
resultSet.next(); resultSet.next();
result = resultSet.getLong(1); result = resultSet.getLong(1);
@ -434,7 +434,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT count(*) FROM elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=?"); statement = connection.prepareStatement("SELECT count(*) FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=?");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -466,7 +466,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT count(*) FROM elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? AND SUBKEY=?"); statement = connection.prepareStatement("SELECT count(*) FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? AND SUBKEY=?");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -499,7 +499,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.createStatement(); statement = connection.createStatement();
resultSet = statement.executeQuery("SELECT count(*) FROM elements WHERE ARCHIVE_DATE IS NULL"); resultSet = statement.executeQuery("SELECT count(*) FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL");
resultSet.next(); resultSet.next();
result = resultSet.getLong(1); result = resultSet.getLong(1);
@ -527,7 +527,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT count(*) FROM elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=?"); statement = connection.prepareStatement("SELECT count(*) FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=?");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -559,7 +559,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT count(*) FROM elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=?"); statement = connection.prepareStatement("SELECT count(*) FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=?");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -616,7 +616,7 @@ public class SQLSikevaDB implements SikevaDB {
System.out.println("============================== APRÈS"); System.out.println("============================== APRÈS");
statement = connection.createStatement(); statement = connection.createStatement();
statement.execute("delete from elements"); statement.execute("delete from sikevadb_elements");
System.out.println("============================== APRÈS2"); System.out.println("============================== APRÈS2");
} }
@ -643,7 +643,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection
.prepareStatement("SELECT TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM elements WHERE TOPKEY=? ORDER BY ARCHIVE_DATE ASC"); .prepareStatement("SELECT TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE TOPKEY=? ORDER BY ARCHIVE_DATE ASC");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -693,7 +693,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection
.prepareStatement("SELECT TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM elements WHERE TOPKEY=? AND SUBKEY=? ORDER BY ARCHIVE_DATE ASC"); .prepareStatement("SELECT TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE TOPKEY=? AND SUBKEY=? ORDER BY ARCHIVE_DATE ASC");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -740,7 +740,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT DISTINCT TOPKEY FROM elements ORDER BY CREATION_DATE ASC"); statement = connection.prepareStatement("SELECT DISTINCT TOPKEY FROM sikevadb_elements ORDER BY CREATION_DATE ASC");
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {
@ -773,7 +773,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT DISTINCT SUBKEY FROM elements WHERE TOPKEY=? ORDER BY CREATION_DATE ASC"); statement = connection.prepareStatement("SELECT DISTINCT SUBKEY FROM sikevadb_elements WHERE TOPKEY=? ORDER BY CREATION_DATE ASC");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -807,7 +807,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT VALUE FROM elements WHERE TOPKEY=? ORDER BY ARCHIVE_DATE ASC"); statement = connection.prepareStatement("SELECT VALUE FROM sikevadb_elements WHERE TOPKEY=? ORDER BY ARCHIVE_DATE ASC");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -845,7 +845,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT VALUE FROM elements WHERE TOPKEY=? AND SUBKEY=? ORDER BY ARCHIVE_DATE ASC"); statement = connection.prepareStatement("SELECT VALUE FROM sikevadb_elements WHERE TOPKEY=? AND SUBKEY=? ORDER BY ARCHIVE_DATE ASC");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -881,7 +881,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT VALUE FROM elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? ORDER BY CREATION_DATE"); statement = connection.prepareStatement("SELECT VALUE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? ORDER BY CREATION_DATE");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -920,7 +920,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection
.prepareStatement("SELECT VALUE FROM elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? AND SUBKEY=? ORDER BY ARCHIVE_DATE ASC"); .prepareStatement("SELECT VALUE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? AND SUBKEY=? ORDER BY ARCHIVE_DATE ASC");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -987,7 +987,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection
.prepareStatement("SELECT TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY IS NULL"); .prepareStatement("SELECT TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY IS NULL");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1041,7 +1041,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection
.prepareStatement("SELECT TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=?"); .prepareStatement("SELECT TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=?");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1094,7 +1094,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection
.prepareStatement("SELECT TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? ORDER BY CREATION_DATE ASC"); .prepareStatement("SELECT 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");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1144,7 +1144,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection
.prepareStatement("SELECT TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? AND SUBKEY=? ORDER BY CREATION_DATE ASC"); .prepareStatement("SELECT 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");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1191,7 +1191,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT DISTINCT TOPKEY FROM elements WHERE ARCHIVE_DATE IS NULL"); statement = connection.prepareStatement("SELECT DISTINCT TOPKEY FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL");
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {
@ -1233,7 +1233,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection
.prepareStatement("SELECT DISTINCT SUBKEY,CREATION_DATE FROM elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY IS NOT NULL ORDER BY CREATION_DATE ASC"); .prepareStatement("SELECT DISTINCT SUBKEY,CREATION_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY IS NOT NULL ORDER BY CREATION_DATE ASC");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1269,7 +1269,7 @@ public class SQLSikevaDB implements SikevaDB {
// //
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT VALUE FROM elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=?"); statement = connection.prepareStatement("SELECT VALUE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=?");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1312,7 +1312,7 @@ public class SQLSikevaDB implements SikevaDB {
// //
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT VALUE FROM elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=?"); statement = connection.prepareStatement("SELECT VALUE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=?");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1357,7 +1357,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection
.prepareStatement("SELECT VALUE,CREATION_DATE FROM elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? ORDER BY CREATION_DATE ASC"); .prepareStatement("SELECT VALUE,CREATION_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? ORDER BY CREATION_DATE ASC");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1396,7 +1396,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection
.prepareStatement("SELECT VALUE FROM elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=? ORDER BY ARCHIVE_DATE ASC"); .prepareStatement("SELECT VALUE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=? ORDER BY ARCHIVE_DATE ASC");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1429,7 +1429,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT SUM(SIZE) FROM elements"); statement = connection.prepareStatement("SELECT SUM(SIZE) FROM sikevadb_elements");
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
resultSet.next(); resultSet.next();
@ -1457,7 +1457,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT SUM(SIZE) FROM elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=?"); statement = connection.prepareStatement("SELECT SUM(SIZE) FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=?");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1490,7 +1490,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT SUM(SIZE) FROM elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=?"); statement = connection.prepareStatement("SELECT SUM(SIZE) FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=?");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1547,7 +1547,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT SUM(SIZE) FROM elements WHERE ARCHIVE_DATE IS NOT NULL"); statement = connection.prepareStatement("SELECT SUM(SIZE) FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL");
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
resultSet.next(); resultSet.next();
@ -1575,7 +1575,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT SUM(SIZE) FROM elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=?"); statement = connection.prepareStatement("SELECT SUM(SIZE) FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=?");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1608,7 +1608,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("SELECT SUM(SIZE) FROM elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? AND SUBKEY=?"); statement = connection.prepareStatement("SELECT SUM(SIZE) FROM sikevadb_elements WHERE ARCHIVE_DATE IS NOT NULL AND TOPKEY=? AND SUBKEY=?");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1666,7 +1666,7 @@ public class SQLSikevaDB implements SikevaDB {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection
.prepareStatement("INSERT INTO elements (TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"); .prepareStatement("INSERT INTO sikevadb_elements (TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE) VALUES(?, ?, ?, ?, ?, ?, ?, ?)");
statement.setString(1, element.getKey()); statement.setString(1, element.getKey());
statement.setString(2, element.getSubkey()); statement.setString(2, element.getSubkey());
@ -1715,7 +1715,7 @@ public class SQLSikevaDB implements SikevaDB {
connection.setAutoCommit(false); connection.setAutoCommit(false);
// Archive existing element. // Archive existing element.
statement = connection.prepareStatement("UPDATE elements SET ARCHIVE_DATE=? WHERE TOPKEY=? AND SUBKEY IS NULL"); statement = connection.prepareStatement("UPDATE sikevadb_elements SET ARCHIVE_DATE=? WHERE TOPKEY=? AND SUBKEY IS NULL");
statement.setTimestamp(1, toTimestamp(element.getEditionDate())); statement.setTimestamp(1, toTimestamp(element.getEditionDate()));
statement.setString(2, element.getKey()); statement.setString(2, element.getKey());
@ -1726,7 +1726,7 @@ public class SQLSikevaDB implements SikevaDB {
// Insert new version of the element. // Insert new version of the element.
statement.clearParameters(); statement.clearParameters();
statement = connection statement = connection
.prepareStatement("INSERT INTO elements (TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"); .prepareStatement("INSERT INTO sikevadb_elements (TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE) VALUES(?, ?, ?, ?, ?, ?, ?, ?)");
statement.setString(1, element.getKey()); statement.setString(1, element.getKey());
statement.setString(2, element.getSubkey()); statement.setString(2, element.getSubkey());
@ -1784,7 +1784,7 @@ public class SQLSikevaDB implements SikevaDB {
connection.setAutoCommit(false); connection.setAutoCommit(false);
// Archive existing element. // Archive existing element.
statement = connection.prepareStatement("UPDATE elements SET ARCHIVE_DATE=? WHERE TOPKEY=? AND SUBKEY=?"); statement = connection.prepareStatement("UPDATE sikevadb_elements SET ARCHIVE_DATE=? WHERE TOPKEY=? AND SUBKEY=?");
statement.setTimestamp(1, toTimestamp(element.getEditionDate())); statement.setTimestamp(1, toTimestamp(element.getEditionDate()));
statement.setString(2, element.getKey()); statement.setString(2, element.getKey());
@ -1796,7 +1796,7 @@ public class SQLSikevaDB implements SikevaDB {
// Insert new version of the element. // Insert new version of the element.
statement.clearParameters(); statement.clearParameters();
statement = connection statement = connection
.prepareStatement("INSERT INTO elements (TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"); .prepareStatement("INSERT INTO sikevadb_elements (TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE) VALUES(?, ?, ?, ?, ?, ?, ?, ?)");
statement.setString(1, element.getKey()); statement.setString(1, element.getKey());
statement.setString(2, element.getSubkey()); statement.setString(2, element.getSubkey());
@ -1841,7 +1841,7 @@ public class SQLSikevaDB implements SikevaDB {
// //
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("DELETE FROM elements WHERE TOPKEY=? AND SUBKEY IS NULL"); statement = connection.prepareStatement("DELETE FROM sikevadb_elements WHERE TOPKEY=? AND SUBKEY IS NULL");
statement.setString(1, element.getKey()); statement.setString(1, element.getKey());
@ -1874,7 +1874,7 @@ public class SQLSikevaDB implements SikevaDB {
try { try {
// //
connection = getConnection(); connection = getConnection();
statement = connection.prepareStatement("DELETE FROM elements WHERE TOPKEY=? AND SUBKEY=?"); statement = connection.prepareStatement("DELETE FROM sikevadb_elements WHERE TOPKEY=? AND SUBKEY=?");
statement.setString(1, element.getKey()); statement.setString(1, element.getKey());
statement.setString(2, element.getSubkey()); statement.setString(2, element.getSubkey());
@ -1909,7 +1909,7 @@ public class SQLSikevaDB implements SikevaDB {
// //
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection.prepareStatement("DELETE FROM elements WHERE TOPKEY=? AND SUBKEY IS NOT NULL"); statement = connection.prepareStatement("DELETE FROM sikevadb_elements WHERE TOPKEY=? AND SUBKEY IS NOT NULL");
statement.setString(1, element.getKey()); statement.setString(1, element.getKey());

View file

@ -1,8 +1,8 @@
-- Specific file for HSQLDB due difference between MySQL yntax and HSQLDB syntax. -- Specific file for HSQLDB due difference between MySQL yntax and HSQLDB syntax.
-- Warning: there is a convention about the file name. -- Warning: there is a convention about the file name.
DROP TABLE IF EXISTS elements; DROP TABLE IF EXISTS sikevadb_elements;
CREATE TABLE IF NOT EXISTS elements ( CREATE TABLE IF NOT EXISTS sikevadb_elements (
`ID` INTEGER NOT NULL AUTO_INCREMENT, `ID` INTEGER NOT NULL AUTO_INCREMENT,
`TOPKEY` varchar(255) NOT NULL, `TOPKEY` varchar(255) NOT NULL,
`SUBKEY` varchar(255) DEFAULT NULL, `SUBKEY` varchar(255) DEFAULT NULL,

View file

@ -9,8 +9,8 @@
-- Structure de la table `elements` -- Structure de la table `elements`
-- --
DROP TABLE IF EXISTS `elements`; DROP TABLE IF EXISTS `sikevadb_elements`;
CREATE TABLE IF NOT EXISTS `elements` ( CREATE TABLE IF NOT EXISTS `sikevadb_elements` (
`ID` INTEGER NOT NULL AUTO_INCREMENT, `ID` INTEGER NOT NULL AUTO_INCREMENT,
`TOPKEY` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `TOPKEY` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`SUBKEY` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `SUBKEY` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,

View file

@ -1,5 +1,5 @@
<dataset> <dataset>
<ELEMENTS <SIKEVADB_ELEMENTS
TOPKEY="alpha" TOPKEY="alpha"
SUBKEY="NULL" SUBKEY="NULL"
SIZE="10" SIZE="10"