OSDN Git Service

Add selective sync, cleanup debug messages, & correct network sync not disconnecting...
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / sql / SyncTable.java
index 092609b..21f90ea 100644 (file)
@@ -20,6 +20,9 @@
 \r
 package cx.fbn.nevernote.sql;\r
 \r
 \r
 package cx.fbn.nevernote.sql;\r
 \r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
 import cx.fbn.nevernote.sql.driver.NSqlQuery;\r
 import cx.fbn.nevernote.utilities.ApplicationLogger;\r
 import cx.fbn.nevernote.utilities.ListManager;\r
 import cx.fbn.nevernote.sql.driver.NSqlQuery;\r
 import cx.fbn.nevernote.utilities.ApplicationLogger;\r
 import cx.fbn.nevernote.utilities.ListManager;\r
@@ -70,7 +73,7 @@ public class SyncTable {
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
        }\r
                        logger.log(logger.MEDIUM, query.lastError());\r
                }\r
        }\r
-       // Set a key field\r
+       // Get a key field\r
        public String getRecord(String key) {\r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
         query.prepare("Select value from Sync where key=:key");\r
        public String getRecord(String key) {\r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
         query.prepare("Select value from Sync where key=:key");\r
@@ -114,7 +117,23 @@ public class SyncTable {
        public int getUpdateSequenceNumber() {\r
                return new Integer(getRecord("UpdateSequenceNumber"));\r
        }\r
        public int getUpdateSequenceNumber() {\r
                return new Integer(getRecord("UpdateSequenceNumber"));\r
        }\r
-       \r
-\r
+       // Get notebooks/tags to ignore\r
+       public List<String> getIgnoreRecords(String type) {\r
+               List<String> values = new ArrayList<String>();\r
+        NSqlQuery query = new NSqlQuery(db.getConnection());\r
+        if (!query.prepare("Select value from Sync where key like :type")) {\r
+                       logger.log(logger.MEDIUM, "getIgnoreRecords from sync failed.");\r
+                       logger.log(logger.MEDIUM, query.lastError());\r
+                       return null;\r
+               }\r
+        query.bindValue(":type", "IGNORE" +type +"-%");\r
+        query.exec();\r
+               while (query.next()) {\r
+                       values.add(query.valueString(0));\r
+               }\r
+               return values;\r
+       }\r
+       // Expunge ignore records\r
+       // Add an item to the table\r
 \r
 }\r
 \r
 }\r