[Generic object query functions clinton@unknownlamer.org**20101224072506 Ignore-this: e00329155dc6344f51e838370f715599 * `query-objects' calls a function with the table name and list of fields for an object type, and uses the returned s-sql program to query the database for instances of TYPE * Not currently exported--interface is subject to change ] hunk ./src/db-access-object-sql.lisp 5 +(defun %query-objects (type query-fn) + (let* ((class (find-class type)) + (fields (remove-duplicates + (mapcar #'slot-definition-column-name + (class-db-slots class))))) + (let ((*instance-is-persistent* t)) + (mapcar (curry 'make-object-from-plist type) + (funcall query-fn (class-table-name class) fields))))) + +(defun query-objects (type query-fn) + (%query-objects type (lambda (table fields) + (%query (funcall query-fn table fields))))) +