Update-slots-from-instance now throws an exception if it generates an update without...
[clsql.git] / sql / oodml.lisp
index 3e7ec9af023c31fc1c5d0e4cdd538c4ab2e8cfa5..8eec40e98fed5840c6aa487108d81904324c2a43 100644 (file)
                                    (db-value-from-slot slot val database))))
                        slots)))
     (cond ((and avps (view-database obj))
-           (update-records (sql-expression :table vct)
-                           :av-pairs avps
-                           :where (key-qualifier-for-instance
-                                   obj :database database)
-                           :database database))
+          (let ((where (key-qualifier-for-instance
+                        obj :database database)))
+            (unless where
+              (error "update-record-from-slots: Could not generate a where clause for this object: ~a" obj))
+            (update-records (sql-expression :table vct)
+                            :av-pairs avps
+                            :where where
+                            :database database)))
           ((and avps (not (view-database obj)))
            (insert-records :into (sql-expression :table vct)
                            :av-pairs avps