summaryrefslogtreecommitdiff
path: root/src/clojure_sql/util.clj
AgeCommit message (Collapse)Author
2013-06-16Bring the DSL back up to previous features, fix the compilerCarlo Zancanaro
It should generally be usable at this point. It should generate the queries correctly (including join order and stuff) and approximately properly do things. The type of join stuff still hasn't been finished, but if the code were left as-is it would still be possible to get whatever you wanted out of it, I think. Basically: lots of work has been done and we're approaching something more usable.
2013-06-13Starting a re-write of the DSL, to be followed by the compiler.Carlo Zancanaro
Flip around field/table aliases, do joins a bit differently. They're my main aims at the moment! I'll also add a preprocessor for the compiler to massage it into a nicer form there. I discovered that joins can be done with a pretty sweet syntax in SQL: (tableA LEFT JOIN tableB) RIGHT JOIN tableC This is pretty much perfect for my purposes. Flipping alias maps just makes more sense and removes a whole bunch of `flip-map` calls that would be unnecessary if the aliases were the other way around. The user-facing side of the DSL will be left unchanged, though. The user provides an `{old-name new-name}` map and internally we convert that into `{new-name old-name}`. Like magic. I'm also adding a bunch more tests. Hopefully that will make things more likely to work for long periods of time. Peace out!
2013-05-23Simplify the compiler, better subquery supportCarlo Zancanaro
The compiler's been simplified a bit by breaking out the `writer` stuff into its own namespace and by generally making the monadic stuff better. It's all hidden behind a nice, simple, `clojure-sql.compiler/compile` function now. Call that and you'll get back what you need. (Internally it's a writer monad which is really modelled as a state monad with the only operation able to be performed on the state being `tell`.) Subqueries are now handled by the DSL in such a way as to not blow up everything. Subqueries have no support for referencing values in the superquery, though, so their utility is quite limited at present. Thinking about how to do subqueries properly may be difficult.
2013-05-14Most of the RA stuff works now.Carlo Zancanaro
Need to fix up the compilation to return a query ready for value substitution by the jdbc stuff, or something (rather than embedding parameters in the query). Also need to add insert!, update! and delete! functions.