(global 'DBOBJ_UPDATE_SQL) "UPDATE %s SET %s=? WHERE %s" ; LIMIT isn't supported for UPDATE unless sqlite3 was compiled with the option
(global 'DBOBJ_INSERT_SQL) "INSERT INTO %s (%s) VALUES (%s)"
(global 'DBOBJ_INSERT_SQL2) "INSERT INTO %s VALUES (%s)"
+ (global 'DBOBJ_DELETE_SQL) "DELETE FROM %s WHERE %s"
(global 'DBOBJ_ROWID_COL) "ROWID=")
; The returned object is NOT autoreleased! YOU are responsible for releasing it when you're done with it!
(<- attr-str change-set))))))))
+(define (DB.OBJ:values from-revert-set)
'revert-set (assoc-row-with-db db (format DBOBJ_SELECT_SQL (join (map first revert-set) ",") table finder))
(if (null? (setf diff (difference change-set revert-set)))
(when (db:execute-update (format DBOBJ_UPDATE_SQL table (join (map first diff) "=?,") finder) (map last diff))
- (set 'revert-set change-set 'dirty nil) true)))
+ (set 'revert-set change-set 'dirty nil)
+ (when (db:execute-update (format DBOBJ_DELETE_SQL table finder))
+ (set 'revert-set '() 'change-set '())