cl-2sql

Lisp to SQL compiler for Common Lisp
git clone https://logand.com/git/cl-2sql.git/
Log | Files | Refs | README | LICENSE

commit 77692d7673bf8fa22917e0578fd9db45e11a5004
parent 72bd345286f2c395ff945235a11bc0370fd53091
Author: Tomas Hlavaty <tom@logand.com>
Date:   Mon,  5 Sep 2011 22:00:01 +0200

load-instance moved in the source file

Diffstat:
Morm.lisp | 22+++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/orm.lisp b/orm.lisp @@ -213,17 +213,6 @@ (defstruct (proxy (:constructor make-proxy (oid))) oid) -(defun load-instance (class-name oid) - (let ((x (2sql-orm:query (oid) - `(q:select ((instance ,class-name)) - (q:from ,class-name) - (q:where (q:= oid (q:qvar oid))))))) - (assert (not (cdr x))) - (assert (car x)) - (assert (not (cadr x))) - (assert (typep (caar x) class-name)) - (caar x))) - (defmethod c2mop:slot-value-using-class :around ((class persistent-class) (a %persistent-object) slotd) @@ -598,6 +587,17 @@ name))) (mapcar (lambda (x) (sym (pslot-name x))) pslots))))) +(defun load-instance (class-name oid) + (let ((x (2sql-orm:query (oid) + `(q:select ((instance ,class-name)) + (q:from ,class-name) + (q:where (q:= oid (q:qvar oid))))))) + (assert (not (cdr x))) + (assert (car x)) + (assert (not (cadr x))) + (assert (typep (caar x) class-name)) + (caar x))) + (defmacro with-pclasses (names &body body) (labels ((rec (x) (if x