summaryrefslogtreecommitdiff
path: root/src/record.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/record.lisp')
-rw-r--r--src/record.lisp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/record.lisp b/src/record.lisp
index 9502899..cbd79e2 100644
--- a/src/record.lisp
+++ b/src/record.lisp
@@ -160,6 +160,15 @@ on those slots."
(field-value-pairs record)
(expand-where-expression record (*where-expression record)))))
+(defmethod update-query-no-nulls ((record record))
+ (if (null (*where-expression record))
+ (error 'org-ckons-condition::handled-error (format nil "Attempting to update a record of type ~a, but it has no *WHERE-EXPRESSION" (type-of record)))
+ (format nil
+ "UPDATE ~a SET ~a~a"
+ (org-ckons-core::format-list (if (slot-exists-p record '*write-table) (slot-value record '*write-table) (slot-value record '*table)) `(,(*project record)))
+ (field-value-pairs-no-nulls record)
+ (expand-where-expression record (*where-expression record)))))
+
(defmethod select-query ((record record))
(format nil
"SELECT ~a FROM ~a"
@@ -180,6 +189,9 @@ on those slots."
(defmethod update-record* ((record record))
(execute-command (update-query record)))
+(defmethod update-record-no-nulls* ((record record))
+ (execute-command (update-query-no-nulls record)))
+
(defmethod select-records-impl* ((record record) where-expression order-by-clause)
(let* ((where-string (expand-where-expression record where-expression))
(order-by-string (if (org-ckons-core::null-or-empty-p order-by-clause)