OSDN Git Service

Cleanup compiler warning messages and alter backup & restore to handle new database...
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / sql / NotebookTable.java
index 807fb90..647967e 100644 (file)
@@ -64,7 +64,6 @@ public class NotebookTable {
                        "published boolean, "+\r
                        "isDirty boolean, "+\r
                        "autoEncrypt boolean, "+\r
-                       "readOnly boolean, " +\r
                        "local boolean, "+\r
                        "archived boolean)"))                           \r
                logger.log(logger.HIGH, "Table Notebook creation FAILED!!!");   \r
@@ -79,11 +78,11 @@ public class NotebookTable {
         query = new NSqlQuery(db.getConnection());\r
                query.prepare("Insert Into Notebook (guid, sequence, name, defaultNotebook, "\r
                                +"serviceCreated, serviceUpdated, published, "   \r
-                               + "isDirty, autoEncrypt, readOnly, \r
+                               + "isDirty, autoEncrypt, " \r
                                + "local, archived) Values("\r
                                +":guid, :sequence, :name, :defaultNotebook,  "\r
                                +":serviceCreated, :serviceUpdated, :published, "\r
-                               +":isDirty, :autoEncrypt, :readOnly, "\r
+                               +":isDirty, :autoEncrypt, "\r
                                +":local, false)");\r
                query.bindValue(":guid", newnote.getGuid());\r
                query.bindValue(":sequence", newnote.getUpdateSequenceNum());\r
@@ -101,7 +100,6 @@ public class NotebookTable {
                query.bindValue(":isDirty", true);\r
                query.bindValue(":autoEncrypt", false);\r
                query.bindValue(":local", false);\r
-               query.bindValue(":readOnly", false);\r
 \r
                boolean check = query.exec();\r
                if (!check) {\r
@@ -552,6 +550,21 @@ public class NotebookTable {
                QIcon icon = new QIcon(QPixmap.fromImage(QImage.fromData(blob)));\r
                return icon;\r
        }\r
+       // Get the notebooks custom icon\r
+       public QByteArray getIconAsByteArray(String guid) {\r
+               NSqlQuery query = new NSqlQuery(db.getConnection());\r
+               \r
+               if (!query.prepare("Select icon from notebook where guid=:guid"))\r
+                       logger.log(logger.EXTREME, "Error preparing notebook icon select.");\r
+               query.bindValue(":guid", guid);\r
+               if (!query.exec())\r
+                       logger.log(logger.EXTREME, "Error finding notebook icon.");\r
+               if (!query.next() || query.getBlob(0) == null)\r
+                       return null;\r
+               \r
+               QByteArray blob = new QByteArray(query.getBlob(0));\r
+               return blob;\r
+       }\r
        // Set the notebooks custom icon\r
        public void setIcon(String guid, QIcon icon, String type) {\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r