OSDN Git Service

Correct error not uploading and stack sync error.
authorRandy Baumgarte <randy@fbn.cx>
Sat, 13 Oct 2012 11:14:07 +0000 (07:14 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Sat, 13 Oct 2012 11:14:07 +0000 (07:14 -0400)
src/cx/fbn/nevernote/sql/NoteResourceTable.java
src/cx/fbn/nevernote/sql/NoteTable.java
src/cx/fbn/nevernote/sql/NotebookTable.java
src/cx/fbn/nevernote/threads/SyncRunner.java

index 1f24b68..49386b3 100644 (file)
@@ -167,7 +167,7 @@ public class NoteResourceTable  {
                NSqlQuery query = new NSqlQuery(db.getResourceConnection());\r
                SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");\r
                \r
-               check = query.prepare("Insert Into NoteResources ("\r
+               query.prepare("Insert Into NoteResources ("\r
                                +"guid, noteGuid, dataHash, dataSize, dataBinary, updateSequenceNumber, "\r
                                +"mime, width, height, duration, active, recognitionHash, "                             \r
                                +"recognitionSize, recognitionBinary, attributeSourceUrl, attributeTimestamp, "\r
@@ -182,10 +182,6 @@ public class NoteResourceTable  {
                                +":attributeCameraModel, "\r
                                +":attributeClientWillIndex, :attributeRecoType, :attributeFileName, :attributeAttachment, "\r
                                +":isDirty, true)");\r
-               if (!check) {\r
-                       logger.log(logger.EXTREME, "NoteResource SQL insert prepare has failed.");\r
-                       logger.log(logger.MEDIUM, query.lastError());\r
-               }\r
        \r
                        query.bindValue(":guid", r.getGuid());\r
                        query.bindValue(":noteGuid", r.getNoteGuid());\r
@@ -226,7 +222,7 @@ public class NoteResourceTable  {
                                query.bindValue(":attributeRecoType", r.getAttributes().getRecoType());\r
                                query.bindValue(":attributeFileName", r.getAttributes().getFileName());\r
                                query.bindValue(":attributeAttachment", r.getAttributes().isAttachment());                      \r
-                       }\r
+                       } \r
                        query.bindValue(":isDirty", isDirty);\r
                                                \r
                        check = query.exec();\r
@@ -674,4 +670,10 @@ public class NoteResourceTable  {
                logger.log(logger.HIGH, "Leaving NoteResourceTable.getDistinctNoteGuids()");\r
                return guids;\r
        }\r
+\r
+       public void resetAllDirty() {\r
+               NSqlQuery query = new NSqlQuery(db.getResourceConnection());\r
+               query.exec("update noteresources set isdirty=false");\r
+       }\r
 }\r
+\r
index f19deee..a949425 100644 (file)
@@ -838,7 +838,7 @@ public class NoteTable {
                boolean retVal = query.next();\r
                return retVal;\r
        }\r
-       // This is a convience method to check if a note exists & update/create based upon it\r
+       // This is a convenience method to check if a note exists & update/create based upon it\r
        public void syncNote(Note note) {\r
                logger.log(logger.HIGH, "Entering NoteTable.syncNote");\r
                // If we got the note from Evernote we use its \r
@@ -873,7 +873,7 @@ public class NoteTable {
                \r
                boolean check;                  \r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
-                                       \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 or linked = true)");\r
                if (!check) \r
                        logger.log(logger.EXTREME, "Note SQL retrieve has failed: " +query.lastError().toString());\r
index 25e4819..0dd10e0 100644 (file)
@@ -332,7 +332,8 @@ public class NotebookTable {
                        } catch (ParseException e) {\r
                                e.printStackTrace();\r
                        }\r
-                       tempNotebook.setStack(query.valueString(7));\r
+                       if (query.valueString(7) != null && !query.valueString(7).trim().equals(""))\r
+                               tempNotebook.setStack(query.valueString(7));\r
                        index.add(tempNotebook); \r
                }       \r
                return index;\r
@@ -379,7 +380,8 @@ public class NotebookTable {
                                e.printStackTrace();\r
                        }\r
                        tempNotebook.setPublished(new Boolean(query.valueString(6)));\r
-                       tempNotebook.setStack(query.valueString(7));\r
+                       if (query.valueString(7) != null && !query.valueString(7).trim().equals(""))\r
+                               tempNotebook.setStack(query.valueString(7));\r
                        \r
                        if (tempNotebook.isPublished()) {\r
                                Publishing p = new Publishing();\r
@@ -505,7 +507,8 @@ public class NotebookTable {
                                e.printStackTrace();\r
                        }\r
                        tempNotebook.setPublished(new Boolean(query.valueString(6)));\r
-                       tempNotebook.setStack(query.valueString(7));\r
+                       if (query.valueString(7) != null && !query.valueString(7).trim().equals(""))\r
+                               tempNotebook.setStack(query.valueString(7));\r
                        \r
                        if (tempNotebook.isPublished()) {\r
                                Publishing p = new Publishing();\r
@@ -553,7 +556,8 @@ public class NotebookTable {
                                e.printStackTrace();\r
                        }\r
                        tempNotebook.setPublished(new Boolean(query.valueString(6)));\r
-                       tempNotebook.setStack(query.valueString(7));\r
+                       if (query.valueString(7) != null && !query.valueString(7).trim().equals(""))\r
+                               tempNotebook.setStack(query.valueString(7));\r
                        \r
                        if (tempNotebook.isPublished()) {\r
                                Publishing p = new Publishing();\r
index 9933f25..0423de1 100644 (file)
@@ -411,8 +411,8 @@ public class SyncRunner extends QObject implements Runnable {
                        //*****************************************\r
                        //* Sync linked/shared notebooks \r
                        //*****************************************\r
-                       syncLinkedNotebooks();\r
-                       \r
+                       //syncLinkedNotebooks();\r
+                       conn.getNoteTable().getDirty();\r
                        if (!disableUploads) {\r
                                logger.log(logger.EXTREME, "Uploading changes");\r
                                // Synchronize remote changes\r
@@ -743,7 +743,7 @@ public class SyncRunner extends QObject implements Runnable {
                                conn.getSyncTable().setUpdateSequenceNumber(updateSequenceNumber);\r
                        } catch (EDAMUserException e) {\r
                                logger.log(logger.LOW, "*** EDAM User Excepton syncLocalNotebooks");\r
-                               logger.log(logger.LOW, e.toString());   \r
+                               logger.log(logger.LOW, e.toString() + ": Stack : " +enNotebook.getStack());     \r
                                error = true;\r
                        } catch (EDAMSystemException e) {\r
                                logger.log(logger.LOW, "*** EDAM System Excepton syncLocalNotebooks");\r