Re: Multiple table SELECT problem

2009-01-05 Thread Allen Rohner
I made a post about this in October, with an attached patch. I guess it got lost in the shuffle. http://groups.google.com/group/clojure/browse_frm/thread/e533e9cdf758f210?q=#43e5775c2d959dc7 I'll file a bug and attach the patch. Allen --~--~-~--~~~---~--~~ You r

Re: Multiple table SELECT problem

2009-01-05 Thread ck
For completeness of the post, here's the stack trace: java.lang.RuntimeException: java.lang.IllegalArgumentException: Too many arguments to struct constructor (NO_SOURCE_FILE:0) at clojure.lang.Compiler.eval(Compiler.java:4179) at clojure.core$eval__3756.invoke(core.clj:1566)

Re: Multiple table SELECT problem

2009-01-05 Thread ck
Yep, that's it. The two columns with the same name cause the problem. Interestingly enough, the quick fix using roles.name AS role_name does *not* help either. But that give me something to look at, in this case figuring out how 'resultset-seq' works and why it does not use the aliases col

Re: Multiple table SELECT problem

2009-01-05 Thread Stephen C. Gilardi
On Jan 5, 2009, at 8:52 PM, ck wrote: Stephen, thanks for pointing out the namespace problem. That fixed the exception mentioned above, which was stupidity on my part. With that I'm able to run (again) the scrapbook=> (db-read) in the second example, i.e. the one without the reference to sec

Re: Multiple table SELECT problem

2009-01-05 Thread ck
Stephen, thanks for pointing out the namespace problem. That fixed the exception mentioned above, which was stupidity on my part. With that I'm able to run (again) the scrapbook=> (db-read) in the second example, i.e. the one without the reference to second table in columns, I get list of maps

Re: Multiple table SELECT problem

2009-01-05 Thread Stephen C. Gilardi
On Jan 5, 2009, at 7:59 PM, ck wrote: Ops, my mistake. Second one should be: (defn db-read [] (sql/with-connection db (sql/with-results res "SELECT users.id, users.name FROM users INNER JOIN roles ON user.id = roles.user_i

Re: Multiple table SELECT problem

2009-01-05 Thread ck
Ops, my mistake. Second one should be: (defn db-read [] (sql/with-connection db (sql/with-results res "SELECT users.id, users.name FROM users INNER JOIN roles ON user.id = roles.user_id ORDER BY us