Author: jflesch
Date: 2007-07-02 01:54:35 +0000 (Mon, 02 Jul 2007)
New Revision: 13876
Modified:
trunk/apps/Thaw/src/thaw/plugins/index/DatabaseManager.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java
Log:
Fix the function to delete ALL the indexes in the database
Modified: trunk/apps/Thaw/src/thaw/plugins/index/DatabaseManager.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/DatabaseManager.java 2007-07-02
01:45:38 UTC (rev 13875)
+++ trunk/apps/Thaw/src/thaw/plugins/index/DatabaseManager.java 2007-07-02
01:54:35 UTC (rev 13876)
@@ -297,18 +297,19 @@
sendQuery(db, "DROP TABLE files");
sendQuery(db, "DROP TABLE links");
+ sendQuery(db, "DROP TABLE indexBlackList");
+
+ sendQuery(db, "DROP TABLE indexCommentKeys");
+ sendQuery(db, "DROP TABLE indexComments");
+ sendQuery(db, "DROP TABLE indexCommentBlackList");
+
sendQuery(db, "DROP TABLE indexes");
sendQuery(db, "DROP TABLE indexFolders");
sendQuery(db, "DROP TABLE indexParents");
sendQuery(db, "DROP TABLE folderParents");
- sendQuery(db, "DROP TABLE indexCommentKeys");
- sendQuery(db, "DROP TABLE indexComments");
-
sendQuery(db, "DROP TABLE categories");
-
- sendQuery(db, "DROP TABLE indexBlackList");
}
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java 2007-07-02
01:45:38 UTC (rev 13875)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexRoot.java 2007-07-02
01:54:35 UTC (rev 13876)
@@ -92,33 +92,9 @@
Logger.warning(this, "DELETING ALL THE INDEXES");
- try {
- synchronized(getDb().dbLock) {
- PreparedStatement st;
+ DatabaseManager.dropTables(indexBrowser.getDb());
+ DatabaseManager.createTables(indexBrowser.getDb());
- st =
getDb().getConnection().prepareStatement("DELETE FROM FILES");
- st.execute();
-
- st =
getDb().getConnection().prepareStatement("DELETE FROM LINKS");
- st.execute();
-
- st =
getDb().getConnection().prepareStatement("DELETE FROM INDEXES");
- st.execute();
-
- st =
getDb().getConnection().prepareStatement("DELETE FROM INDEXFOLDERS");
- st.execute();
-
- st =
getDb().getConnection().prepareStatement("DELETE FROM INDEXPARENTS");
- st.execute();
-
- st =
getDb().getConnection().prepareStatement("DELETE FROM FOLDERPARENTS");
- st.execute();
- }
- } catch(SQLException e) {
- Logger.error(this, "Woops, error while destroying the
world : "+e.toString());
- return;
- }
-
IndexManagementHelper.addIndex(queueManager, indexBrowser, null,
thaw.plugins.IndexBrowser.DEFAULT_INDEX);