boolean check; \r
NSqlQuery query = new NSqlQuery(db.getConnection());\r
\r
- check = query.exec("Select guid from Note where isDirty = true and isExpunged = false and notebookGuid not in (select guid from notebook where local = true)");\r
+ check = query.exec("Select guid from Note where isDirty = true and isExpunged = false and notebookGuid not in (select guid from notebook where local = true or linked = true)");\r
if (!check) \r
logger.log(logger.EXTREME, "Note SQL retrieve has failed: " +query.lastError().toString());\r
\r
return notes; \r
}\r
// Get a list of notes that need to be updated\r
+ public List <Note> getDirtyLinked(String notebookGuid) {\r
+ String guid;\r
+ Note tempNote;\r
+ List<Note> notes = new ArrayList<Note>();\r
+ List<String> index = new ArrayList<String>();\r
+ \r
+ boolean check; \r
+ NSqlQuery query = new NSqlQuery(db.getConnection());\r
+ \r
+ query.prepare("Select guid from Note where isDirty = true and isExpunged = false and notebookGuid=:notebookGuid");\r
+ query.bindValue(":notebookGuid", notebookGuid);\r
+ check = query.exec();\r
+ if (!check) \r
+ logger.log(logger.EXTREME, "Note SQL retrieve has failed getting dirty linked notes: " +query.lastError().toString());\r
+ \r
+ // Get a list of the notes\r
+ while (query.next()) {\r
+ guid = new String();\r
+ guid = query.valueString(0);\r
+ index.add(guid); \r
+ } \r
+ \r
+ // Start getting notes\r
+ for (int i=0; i<index.size(); i++) {\r
+ tempNote = getNote(index.get(i), true,true,false,true,true);\r
+ notes.add(tempNote);\r
+ }\r
+ return notes; \r
+ }\r
+ // Get a list of notes that need to be updated\r
+ public List <String> getNotesByNotebook(String notebookGuid) {\r
+ List<String> notes = new ArrayList<String>();\r
+ List<String> index = new ArrayList<String>();\r
+ \r
+ boolean check; \r
+ NSqlQuery query = new NSqlQuery(db.getConnection());\r
+ \r
+ check = query.prepare("Select guid from Note where notebookguid=:notebookguid");\r
+ if (!check) \r
+ logger.log(logger.EXTREME, "Note SQL retrieve has failed: " +query.lastError().toString());\r
+ query.bindValue(":notebookguid", notebookGuid);\r
+ query. exec();\r
+ \r
+ // Get a list of the notes\r
+ while (query.next()) {\r
+ index.add(query.valueString(0)); \r
+ } \r
+ \r
+ return notes; \r
+ }\r
+ // Get a list of notes that need to be updated\r
public boolean isNoteDirty(String guid) {\r
\r
boolean check; \r
boolean check; \r
NSqlQuery query = new NSqlQuery(db.getConnection());\r
\r
- check = query.exec("Select guid from Note where isDirty = true");\r
+ check = query.exec("Select guid from Note where isDirty=true");\r
if (!check) \r
logger.log(logger.EXTREME, "Note SQL retrieve has failed: " +query.lastError().toString());\r
\r
// Count unsynchronized notes\r
public int getDirtyCount() {\r
NSqlQuery query = new NSqlQuery(db.getConnection());\r
- query.exec("select count(*) from note where isDirty=true and isExpunged = false");\r
+ query.exec("select count(guid) from note where isDirty=true and isExpunged = false");\r
query.next(); \r
int returnValue = new Integer(query.valueString(0));\r
return returnValue;\r
}\r
\r
\r
- \r
// Update a note content's hash. This happens if a resource is edited outside of NN\r
public void updateResourceContentHash(String guid, String oldHash, String newHash) {\r
Note n = getNote(guid, true, false, false, false,false);\r