]> uap-core.de Git - note.git/commitdiff
SQL formatting
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 15 May 2025 10:46:02 +0000 (12:46 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 15 May 2025 10:46:02 +0000 (12:46 +0200)
application/store.c

index 5a963b1ef90c542ee2071b96aeae0a5270f6b03c..48c18be237473e509b0b9d0940346aaf96b8e616 100644 (file)
     "select * from cols\n" \
     "order by path;"
 
-#define SQL_NOTEBOOK_GET_NOTES "select n.*, r.resource_id as [__resources__resource_id], r.parent_id, r.nodename, r.displayname, r.lastmodified, r.creationdate, r.iscollection, r.contenttype from resources r inner join notes n on r.resource_id = n.resource_id where parent_id = ? ;"
+#define SQL_NOTEBOOK_GET_NOTES \
+    "select n.*, r.resource_id as [__resources__resource_id], r.parent_id, " \
+    "r.nodename, r.displayname, r.lastmodified, r.creationdate, r.iscollection, r.contenttype " \
+    "from resources r inner join notes n on r.resource_id = n.resource_id where parent_id = ? ;"
 
 #define SQL_NOTE_GET_CONTENT "select content from resources where resource_id = ? ;"
 
-#define SQL_NOTE_RESOURCE_NEW "insert into resources(parent_id, nodename, displayname, lastmodified, creationdate, content) values (?, ?, ?, unixepoch(), unixepoch(), ?) returning resource_id;"
+#define SQL_NOTE_RESOURCE_NEW \
+    "insert into resources(parent_id, nodename, displayname, lastmodified, creationdate, content) values " \
+    "(?, ?, ?, unixepoch(), unixepoch(), ?) returning resource_id;"
 
 #define SQL_NOTE_NEW "insert into notes(resource_id, type) values (?, ?) returning note_id;"
 
 
 #define SQL_NOTE_DELETE "delete from resources where resource_id = ? ;"
 
-#define SQL_ATTACHMENT_RESOURCE_NEW "insert into resources(parent_id, nodename, lastmodified, creationdate, content) values ((select parent_id from resources where resource_id = ?), ?, unixepoch(), unixepoch(), ?) returning resource_id;"
-#define SQL_ATTACHMENT_NEW "insert into attachments(attachment_resource_id, parent_resource_id, type) values (?, ?, ?) returning attachment_id;"
+#define SQL_ATTACHMENT_RESOURCE_NEW \
+    "insert into resources(parent_id, nodename, lastmodified, creationdate, content) values " \
+    "((select parent_id from resources where resource_id = ?), ?, unixepoch(), unixepoch(), ?) returning resource_id;"
+
+#define SQL_ATTACHMENT_NEW \
+    "insert into attachments(attachment_resource_id, parent_resource_id, type) values " \
+    "(?, ?, ?) returning attachment_id;"
 
 #define SQL_ATTACHMENTS_GET "select attachment_id, attachment_resource_id, parent_resource_id, a.type, "\
     "r.nodename, r.displayname, r.content from attachments a "\
     "inner join resources r on a.attachment_resource_id = r.resource_id " \
     "where parent_resource_id = ? order by attachment_id;"
 
-#define SQL_NOTEBOOK_NEW "insert into resources(parent_id, nodename, iscollection) values (?, ?, 1) returning resource_id;"
+#define SQL_NOTEBOOK_NEW \
+    "insert into resources(parent_id, nodename, iscollection) values " \
+    "(?, ?, 1) returning resource_id;"
 
 static DBUConnection *connection;