OSDN Git Service

- Correct issue with importing when not a premium member.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / sql / NoteResourceTable.java
index b3a0806..1f24b68 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * This file is part of NeverNote \r
+ * This file is part of NixNote \r
  * Copyright 2009 Randy Baumgarte\r
  * \r
  * This file may be licensed under the terms of of the\r
@@ -37,7 +37,7 @@ public class NoteResourceTable  {
        /**\r
         * \r
         */\r
-       private static final long serialVersionUID = 1L;\r
+//     private static final long serialVersionUID = 1L;\r
        private final ApplicationLogger                 logger;\r
        private final DatabaseConnection                db;     \r
        \r
@@ -160,8 +160,10 @@ public class NoteResourceTable  {
        }\r
        \r
        public void saveNoteResource(Resource r, boolean isDirty) {\r
-               logger.log(logger.HIGH, "Entering DBRunner.saveNoteResources");\r
+               logger.log(logger.HIGH, "Entering saveNoteResources: isDirty " +isDirty);\r
                boolean check;\r
+               logger.log(logger.HIGH, "Note: " +r.getNoteGuid());\r
+               logger.log(logger.HIGH, "Resource: " +r.getGuid());\r
                NSqlQuery query = new NSqlQuery(db.getResourceConnection());\r
                SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");\r
                \r
@@ -188,9 +190,8 @@ public class NoteResourceTable  {
                        query.bindValue(":guid", r.getGuid());\r
                        query.bindValue(":noteGuid", r.getNoteGuid());\r
                        if (r.getData() != null) {\r
-//                             query.bindValue(":dataHash", new QByteArray(r.getData().getBodyHash()).toHex());\r
-//                             query.bindValue(":dataHash", "");\r
                                query.bindValue(":dataHash", byteArrayToHexString(r.getData().getBodyHash()));\r
+//                             query.bindValue(":dataHash", "c0369123fe9871d675ae456fd056ba33");\r
                                query.bindValue(":dataSize", r.getData().getSize());\r
                                query.bindBlob(":dataBody", r.getData().getBody());\r
                        }\r
@@ -660,4 +661,17 @@ public class NoteResourceTable  {
                logger.log(logger.HIGH, "Leaving RNoteResourceTable.getNoteSourceUrl() - no value found");\r
                return null;\r
        }\r
+       \r
+       // Get note source\r
+       public List<String> getDistinctNoteGuids() {\r
+               logger.log(logger.HIGH, "Entering NoteResourceTable.getDistinctNoteGuids()");\r
+               List<String> guids = new ArrayList<String>();\r
+               NSqlQuery query = new NSqlQuery(db.getResourceConnection());\r
+               query.exec("select distinct noteguid from noteresources");\r
+               if (query.next()) {\r
+                       guids.add(query.valueString(0));\r
+               }\r
+               logger.log(logger.HIGH, "Leaving NoteResourceTable.getDistinctNoteGuids()");\r
+               return guids;\r
+       }\r
 }\r