Author: jflesch
Date: 2007-03-21 09:54:38 +0000 (Wed, 21 Mar 2007)
New Revision: 12249

Modified:
   trunk/apps/Thaw/src/thaw/plugins/index/File.java
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
Log:
Improve SQL query used to find the files in the index matchin a running 
insertion at Thaw startup

Modified: trunk/apps/Thaw/src/thaw/plugins/index/File.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/File.java    2007-03-21 02:45:19 UTC 
(rev 12248)
+++ trunk/apps/Thaw/src/thaw/plugins/index/File.java    2007-03-21 09:54:38 UTC 
(rev 12249)
@@ -380,12 +380,12 @@
                PreparedStatement st;

                try {
-                       st = db.getConnection().prepareStatement("SELECT id, 
filename, publicKey, "+
-                                                                "localPath, 
mime, size, indexParent "+
-                                                                "FROM files "+
-                                                                "WHERE 
filename LIKE ?");
+                       st = db.getConnection().prepareStatement("SELECT a.id, 
a.filename, a.publicKey, "+
+                                                                "a.localPath, 
a.mime, a.size, a.indexParent "+
+                                                                "FROM files AS 
a JOIN indexes AS b ON (a.indexParent = b.id)"+
+                                                                "WHERE 
b.privateKey IS NOT NULL AND a.filename LIKE ?");
                } catch(SQLException e) {
-                       Logger.error("thaw.plugin.index.File", "Please tell to 
JFlesch that his SQL sux because : "+e.toString());
+                       Logger.error("thaw.plugin.index.File", "Error while 
sending query to the database : "+e.toString());
                        return false;
                }


Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-03-21 02:45:19 UTC 
(rev 12248)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-03-21 09:54:38 UTC 
(rev 12249)
@@ -1269,7 +1269,9 @@

                        if (privateKeyTag) {
                                if (privateKey == null || 
privateKey.trim().equals(txt.trim())) {
-                                       /* the public key was published, we 
will have to do the same later */
+                                       /**
+                                        * the private key was published, we 
will have to do the same later
+                                        */
                                        setPublishPrivateKey(true);
                                }
                                else


Reply via email to