Fwd: Re: CLSQL indirect table bug

Russ Tyndall <[email protected]> Tue, 10 Jul 2012 09:16:23 -0400
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>


-------- Original Message --------
Subject: 	Re: CLSQL indirect table bug
Date: 	Mon, 09 Jul 2012 17:14:06 -0400
From: 	bobbysmith007 <[email protected]>
To: 	Philipp Marek <philipp-8mGJuhTcji29ZAADn/[email protected]>
CC: 	[email protected]



Hello Phil,

This is definitely something I have seen happen, but have not till now
taken the time to track down.  (The place I have run against this most
is running the test suite).  One thing to remember is that [name] is
evaluated at read time while (make-instance
'clsql-sys:sql-ident-attribute ...) is a run time construction. This
means that all calls to sel with the make-instance use a new object, but
all calls using [name] reuse the same object.

This was a hack added to fix a different bug (about duplicating columns
when using unqualified attributes in the order-by, from the select
function).  I have tracked down the issue and replaced the destructive
code with a non destructive variant.  This fixed the immediate problem,
but I don't have time to run the test suite today. (It definitely fixed
your sel function).

The patch is available at:
https://github.com/UnwashedMeme/clsql/

The patch ID:
b475f491ffc24cacd2d7250e356a3d3a15532e94

Thanks for the bug reports, please keep them coming.

Cheers and Hope this Helps,
Russ Tyndall

PS: CC'ing the list in case others experience the same issue


On 7/6/2012 12:24 PM, Philipp Marek wrote:
> Hello Russ,
>
> I've found another bug in CLSQL.
>
> (defun sel (tbl)
>    (clsql:select tbl :order-by [name]))
>
> and then call that function with two different tables/classes ... the second time you
> get an error, because it remembered the first class in the name ORDER-BY clause, and
> this column isn't available when selecting the second time.
>
>
> Even trying to split that up via something similar to
>    #.(append `(case cl-sym)
>        (loop for c in *allowed-view-classes*
>         collect `(,c (clsql:select cl-sym :order-by [name]))))))
> didn't help ...
>
>
> I *got* it working by an explicit
>
>    (clsql:select tbl
>      :order-by
>      (make-instance 'clsql-sys:sql-ident-attribute
>        :name :name
>        :qualifier nil
>        :type nil))))
>
>
> Perhaps that should be fixed in CLSQL in some way?
>
>
> Regards,
>
> Phil
>
>

_______________________________________________
CLSQL mailing list
[email protected]
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql