src/strip.vala
[app.mailtrimmer] / src / strip.vala
index 833a9ca..f486c20 100644 (file)
@@ -370,7 +370,7 @@ public class Strip : GLib.Object {
        
        // initialize it with known data..
        // that should wipe out dupes.
-       var matches = this.execute("SELECT count(id) as nid FROM Attachment WHERE id = %d".printf(
+       var matches = this.execute("SELECT id   FROM Attachment WHERE id = %d".printf(
                        int.parse(sid)));  
 
                 
@@ -452,10 +452,9 @@ public class Strip : GLib.Object {
                                                ,GLib.FileQueryInfoFlags.NONE,null);
        var file_size = (int) fileinfo.get_size();
 
-               
-
+                
       
-               this.execute("""
+               this.real_query(-1, """
                       
                       
                                INSERT INTO Attachment  (  
@@ -685,13 +684,19 @@ public class Strip : GLib.Object {
     }
     public string query(string str)
     {
-           return this.real_query(true, str);
+           return this.real_query(1, str);
     }
     public string execute(string str)
     {
-           return this.real_query(false, str);
+           return this.real_query(0, str);
     }
-    public string real_query(bool need_return, string str)
+    /**
+    * need_return 
+    0 = no
+    1 = yes
+    -1 = don't try.
+    */
+    public string real_query(int need_return, string str)
     {
                GLib.debug("Before Query : %u  : %s\n", this.mysql.errno(), this.mysql.error());
 
@@ -709,7 +714,9 @@ public class Strip : GLib.Object {
                                Posix.exit(1);
                }
                
-
+               if (need_return == -1) {
+                       return "";
+               }
         var rs = mysql.use_result();
         
         //GLib.debug("got %d rows", (int) rs.num_rows());
@@ -722,7 +729,7 @@ public class Strip : GLib.Object {
                        ret = row[0];
                
                }
-               if (!need_return) {
+               if (need_return == 0) {
                if (StripApplication.opt_debug_sql) {
                                GLib.debug("got %s", got_row ? "=Nothing=" : ret);
                        }