summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-05-15Remove two bits of code that were lying around from experimentingCarlo Zancanaro
2013-05-15Fix query printing, operators, make joins better (also implicit on clause)Carlo Zancanaro
Queries now print out their `compile-query` output when they are printed, rather than complaining about `print-method`. This is completely a better idea, so whoo! Operators now compile more nicely, and SQL functions can be used too. So stuff like (substring :name 1 3) will work for getting the first three letters of the :name field. Joins now handle outer stuff more nicely, and compile to "INNER JOIN" rather than just "JOIN" (they're the same in SQL, but this makes the intent more clear). Additionally, joins now automatically add an equality constraint to fields which are aliased the same. So if two relations have shared fields then (join rel1 rel2) will give the natural join of the two relations (an on clause can still be provided, but it will be put in a conjunction with the implicit one). If the implicit on is generated for an OUTER join then the duplicate field which cannot be NULL is the one which will be selected (for INNER joins, or joins without an implicit on, there is no ambiguity).
2013-05-15Change some error reporting stuff. Nothing major.Carlo Zancanaro
2013-05-14Fix precondition on renameCarlo Zancanaro
The precondition was too strong. Loosen it just enough to make the function useful in all the ways it should be without allowing bad cases through.
2013-05-14join and rename preconditions removing ambiguity, `on` now optionalCarlo Zancanaro
`join` and `rename` both had the ability to introduce some ambiguity, whether by renaming two fields to the same alias (which one should use that alias?) or by joining two fields with the same alias (which one should use it?). Some preconditions have been added to warn against some ambiguous use cases (although I have just now realised the rename precondition is insufficient, so a new commit will be coming soon).
2013-05-14Throw a nicer exception on ambiguous field, also some cleanupCarlo Zancanaro
2013-05-14Parametrise deref behaviour, add two small tests.Carlo Zancanaro
Now a user can decide what the query's behaviour on deref should be. This means a user using jdbc can plug in with (set-query-deref-behaviour! #(... jdbc-query-code-here ...)) if they want, but if a user wants to use the code for something else then they can do so without needing to import jdbc stuff. (I'll admit I'm not sure what else they'd do with it, but that's slightly beside the point.) Still left to do is to provide a helper for the common case (performing an SQL query with jdbc).
2013-05-14Apparently I got the jdbc query syntax wrong. Corrected.Carlo Zancanaro
The parameters should be passed in the `rest` of the vector, not as a separate seq. My bad.
2013-05-14Fix up the README (example code)Carlo Zancanaro
2013-05-14Fix ordering issue, split out string parameters for jdbc stuffCarlo Zancanaro
The string parameters are now put in the query as a '?' and the string which should go in their place is now placed in an auxiliary list when the query is constructed. This should make it easier to avoid SQL injection stuff. (Although table/column names are still vulnerable to SQL injection, they should not be dynamic so the issue should be minimal.) There was also another issue where some things were used before they were declared (as a result of repl development) which has now been corrected.
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.
2013-04-27Initial commit.Carlo Zancanaro