RE: Single-table joins and the OO interface
Ok, I'll try that. It looks like I'm in ansi sql mode by default with both
mysql and oracle, at least from what I can tell. Thanks...
dey
-----Original Message-----
From: John C. Mallery [mailto:jcma@ai.mit.edu]
Sent: Sunday, April 11, 2004 4:17 PM
To: Young, David
Cc: 'lisp-hug@xanalys.com'
Subject: Re: Single-table joins and the OO interface
At 11:27 AM -0400 5/11/04, Young, David wrote:
>I have a view class on a database table, say something like:
>
>(def-view-class frodo-view (...) ((code ...)...)
> (:base-table frodo))
>
>In the db there are pairs of frodos, identifier by 'code, that I want to
>find. In functional sql, I can write this and have it work:
>
>(sql:select ["t1" code] ["t2" code] :from '([frodo "t1"] [frodo "t2"])
>:where [and [= ["t1" code] "00100"] [= ["t2" code] "93701"]])
>
>But, I can't figure out how to reference my view class in the query rather
>than using this lower level stuff; as in this incorrect phrasing:
>
>(sql:select ["t1" code] ["t2" code] :from '([frodo-view "t1"] [frodo-view
>"t2"])
> ...)
I have just been doing ["t1.code"]. Works fine.
Better make sure you're in ANSI SQL mode on your database, because the view
class
layer gets pretty unhappy if you're not (with MySQL anyway).
Try turning on SQL recording so you can see what is being sent to the DB.
This email message is for the sole use of the intended recipients(s) and may contain confidential and privileged information of Bloodhound Software, Inc.. Any unauthorized review, use, disclosure is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.