Macro question

[email protected] Sun, 13 Jun 2010 20:31:52 -0000
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>
Hi all,

I have this macro:

(defmacro def-t-account-getter (name account idx)
  `(defun ,name (,idx)
     (with-mutex (*db-lock*)
       (select ',account
               :flatp t
               :refresh t
               :order-by [entry_idx]
               :where
               [= [slot-value ',account ',idx] ,idx]))))

and this use of the macro:

(def-t-account-getter get-expenses expense user-idx)

but I get this error:

While accessing database #<POSTGRESQL-DATABASE localhost/cmm/jcm OPEN
{B12BE51}>
  with expression "SELECT EXPENSE.AMOUNT,EXPENSE.DESCRIPTION,EXPENSE....":
  Error 42P01 / missing FROM-clause entry for table "asset"
LINE 1: ...TE,EXPENSE.ENTRY_IDX,EXPENSE.USER_IDX,EXPENSE.IDX,ASSET.ENTR...


So I somehow need to quality entry_idx to expense.entry_idx, but I'm not
sure how to do that in the macro and in bracket notation.  Any
suggestions?