Commit graph

114 commits

Author SHA1 Message Date
Mike Blume
5603e9df9f Add ClojureScript build, move files to cljc.
ClojureScript build fails.
2016-07-18 14:10:52 -07:00
Michael Blume
3265e4e14d fix arglist metadata 2016-05-21 13:26:18 -07:00
Alexander K. Hudek
3ec65bd198 Treat numbers as paramterized values to fix issues with NaN, Infinity, and -Infinity. 2016-05-17 14:37:39 -04:00
Michael Blume
43df955a86 Merge pull request #111 from stuarth/master
allow joins without a pred
2016-03-30 23:10:18 -07:00
Michael Blume
d9567e64e0 Merge pull request #110 from csummers/master
escape quote characters in quoted identifiers
2016-03-12 17:33:09 -08:00
Dave Della Costa
0662a00722 Merge pull request #103 from jakemcc/add-intersect
add intersect support
2016-03-02 12:37:17 -05:00
Stuart Hinson
80e9d2ec44 allow joins without a pred 2016-03-01 09:39:21 -05:00
Curtis Summers
47cefd0371 escape quote characters in quoted identifiers 2016-02-24 06:45:49 -06:00
Michael Blume
06c97376ef prevent records from being treated as maps
Thanks to @djwhitt and @blinsay for reporting and for providing
test cases.

Fixes #106
2016-02-09 14:09:22 -08:00
Jake McCrary
8fa44d22b3 add INTERSECT support 2015-11-29 17:49:45 -06:00
Michael Blume
607ee17cca Merge pull request #95 from emidln/emidln/with_column_names
Support column names in :with clauses
2015-10-18 11:07:03 -07:00
Brandon Adams
10a1565467 Support column names in :with clauses
This binds `honeysql.format/*subquery?*` to `false` which turns
on processing of a cte-name like `[:foo {:columns [:a :b :c]}]`
resulting in a string like `WITH foo (a, b, c)`.
2015-10-12 15:13:16 -05:00
Jon Doane
4b1f26632e Add a "huh" on the allow-dashed-names option on honeysql.format/format. 2015-10-11 12:14:47 -04:00
Jon Doane
1f6e9151fd Updated default for allowing dashes. 2015-10-11 11:03:03 -04:00
Jon Doane
95e208485a Added support for preserving dashes in quoted names.o 2015-10-11 10:47:14 -04:00
loganlinn
b51611d4d6 Add fn-handler for CASE statement 2015-08-06 11:29:54 -07:00
Mike Blume
81f2c72675 one more field accessor 2015-06-15 15:54:27 -07:00
Mike Blume
fae5545e8a move format-predicate down 2015-06-15 15:54:27 -07:00
Mike Blume
38e3812e66 just call it to-sql 2015-06-15 15:54:26 -07:00
Mike Blume
cb296e2e31 avoid boilerplate using defrecord 2015-06-15 15:44:35 -07:00
Mike Blume
04a7086687 be clear that these are field accessors
not function calls
2015-06-15 15:44:34 -07:00
Donald Ball
713f72cfb6 Fix the parameterizable protocol to include nil
I forgot that Object doesn't include nil on protocols.

I added test coverage demonstrating the regression, only to note that
parameterized and literal queries produce different sql for the nil
case. I believe only the former is actually valid ANSI SQL, though mysql
at least does not care.
2015-05-20 11:23:36 -04:00
Mike Blume
115ac81fee Merge pull request #74 2015-05-08 16:41:11 -07:00
Mike Blume
6b64743315 add pname to *param-names* once per value
keep *params* and *param-names* at the same count
2015-05-08 14:23:28 -07:00
Andy Chambers
203296149f Add support for exists 2015-04-24 08:08:13 -07:00
Donald Ball
4bdaae39af Convert seq param values to literal sql param lists
This allows seqs to be used as param values, e.g. for IN clauses. It
also converts sets to seqs for the same purpose.

It does not expand the parameter name when this occurs, which will lead
to a mismatch between the *param-names* and *params* collections. It is
not clear how *param-names* are intended to be used, so I have no better
fix to suggest other than repeating a seq's param name the corresponding
number of times into that collection.
2015-04-21 14:28:28 -04:00
Donald Ball
2820662f59 Apply seq to sets when converting to sql
This allows them to be used as values, e.g. for in clauses, as
demonstrated in the test.
2015-04-20 23:40:59 -04:00
Mike Blume
72784452b9 Merge remote-tracking branch 'dball/support-locking-selects' into HEAD 2015-04-17 14:25:23 -07:00
Michael Blume
198115fb84 Merge pull request #69 from mishok13/nulls-first-last-in-order-by
NULL order specification support
2015-04-17 14:20:23 -07:00
Donald Ball
bc0b7e904f Support locking selects
This will need documentation before being merged.
2015-04-17 15:15:23 -04:00
Andrii V. Mishkovskyi
500b55775e Handle :nulls-first and :nulls-last in order-by
This commit implements NULLS (FIRST | LAST) in ORDER BY clause, as
introduced by SQL:2003, link to grammar specification:
http://savage.net.au/SQL/sql-2003-2.bnf.html#sort%20specification%20list

Only PostgreSQL 8.4+ and Oracle 10+ support said feature as of
currently.
2015-04-17 12:33:30 +02:00
Andrii V. Mishkovskyi
11d4ff37ec Adding a comment for future reference 2015-04-16 21:23:19 +02:00
Logan Buckley
f5c111a1be Simplify -to-sql. 2015-04-15 10:39:33 -05:00
Logan Buckley
33ae0c4239 Remove unused require. 2015-04-15 10:37:46 -05:00
Logan Buckley
84387afaa5 Add SqlArray type and reader literal support. 2015-04-15 10:29:34 -05:00
Andrii V. Mishkovskyi
1ff93eb964 Adding stubs for future support of NULLS FIRST/LAST 2015-04-15 17:01:05 +02:00
Mike Blume
f410aed5a1 use a for loop
bit more readable
2015-04-01 12:32:42 -07:00
Mike Blume
d74f2d2437 Allow maps/vectors not to be read as subqueries 2015-03-26 22:59:47 -07:00
Mike Blume
48c501d2c4 break out SqlParam as its own ToSql instance 2015-03-26 22:23:16 -07:00
Mike Blume
a996b93dd3 pull out a couple helpers for param logic 2015-03-26 22:23:14 -07:00
Michael Blume
49096b59a4 Merge pull request #57 from MichaelBlume/avoid-reflection
avoid reflection
2015-03-16 12:45:55 -07:00
Mike Blume
ae7d42bd32 use case instead of condp 2015-03-16 12:32:30 -07:00
Mike Blume
c97f9a3a9d avoid reflection 2015-03-15 23:32:41 -07:00
Michael Blume
4add0b49e2 Merge pull request #55 from MichaelBlume/params-merge
support postgres-native parameters
2015-03-15 22:29:50 -07:00
Michael Blume
f0be1d39ed Merge pull request #52 from MichaelBlume/late-bind
late-bind custom readers
2015-03-15 12:46:01 -07:00
Mike Blume
27b906859d simplify call to parameterizer 2015-03-15 11:03:07 -07:00
Mike Blume
7115456d9e Merge remote-tracking branch 'upstream/master' into params-merge 2015-03-15 10:53:52 -07:00
Mike Blume
44a22e3787 format the format namespace a bit more nicely 2015-03-13 11:33:48 -07:00
Mike Blume
5329d020e6 late-bind custom readers
this much-less-invasively fixes the problem I was trying to fix in #48.

In resources/data_readers.clj we direct clojure to use these functions
in honeysql.types to read tagged literals in EDN as SqlCalls, SqlRaws,
and SqlParams. Clojure does this by making a permanent binding to the
Vars for these functions which exist in honeysql.types when it starts
up. The trouble is that if someone is doing REPL-driven development
and calls clojure.tools.namespace.repl/refresh, those vars will be
wholely recreated, along with the deftype classes they point to.

This means that if there's a sql/call in a piece of edn we're reading,
we'll get an instance of the *old* SqlCall class, but if someone just
calls honeysql.types/call they'll get an instance of the *new* class.
These won't match up, and this'll cause some of the tests in core_tests
to fail.

This patch works around that by causing these custom reader functions
to resolve the helpers they call each time they are called, so we
always create instances of the new types if they've been redefined.

Again, this has basically zero effect on the end user, but it removes
a pain-point for someone using REPL-driven development to work on
honeysql itself.
2015-03-13 11:28:08 -07:00
Mike Blume
42c29506a0 Merge remote-tracking branch 'icambron/parameter-fns' into HEAD 2015-03-09 23:31:17 -07:00