Commit graph

299 commits

Author SHA1 Message Date
Sean Corfield
762252b660 fixes #459 by making all operators variadic
except for := and the various :<> variants

some operators only make sense in binary usage and will produce invalid
SQL if used in a non-binary manner
2023-02-11 13:35:55 -08:00
Sean Corfield
213c152fdb fixes #456 2023-02-01 22:20:14 -08:00
Sean Corfield
4a7c3631a6 fix #454 by allowing - to be variadic 2023-01-14 15:35:03 -08:00
Sean Corfield
6bdc262e7c close #452 - support :replace-into in all dialects 2023-01-14 15:27:42 -08:00
Sean Corfield
d17d44ffcf fix #451 2023-01-14 15:11:16 -08:00
Sean Corfield
6b015400ed fix #445 #453 2023-01-14 14:58:13 -08:00
Sean Corfield
ca953e3c42 add test for #455 (which passes) 2023-01-13 13:01:35 -08:00
Sean Corfield
bf96f034c3 update docs; fix set-options! 2022-12-17 16:02:02 -08:00
Sean Corfield
d0ae02a6ef more tests 2022-12-17 00:15:11 -08:00
Sean Corfield
c62f5da3f8 make numbered params work with 'in' 2022-12-16 23:56:53 -08:00
Sean Corfield
4ea630ed90 basic testing for numbered params 2022-12-16 23:20:17 -08:00
Youngil Choi
a87fa0c9ab Improve type formatting logic in :cast function 2022-11-20 06:51:43 +09:00
Sean Corfield
562b20634a fix #434 by special-casing array 2022-11-17 22:39:48 -08:00
Sean Corfield
95e50a930e fixes #386 #437 #439 2022-11-05 17:15:32 -07:00
Sean Corfield
e8ea9283cc fix Support full TRUNCATE syntax (cascade, identity) #438 2022-11-04 23:40:30 -07:00
Sean Corfield
dda3aa017e Merge branch 'develop' of github.com:seancorfield/honeysql into develop 2022-10-01 00:31:25 -07:00
Sean Corfield
6c107b7cf0 fix #435 by documenting CREATE TEMP TABLE etc 2022-10-01 00:31:20 -07:00
Ike Mawira
73d36ab2b5 Update docs and tests for WITH clause 2022-09-23 16:54:30 +03:00
Sean Corfield
e553f4f169 add a test for #431 :) 2022-09-20 04:37:43 -07:00
Sean Corfield
061288f1c0 address #415 by supporting multi-column add/alter/modify 2022-09-12 18:17:26 -07:00
Sean Corfield
5d7a3faea5 address #415 by supporting multiple drop columns 2022-09-12 13:51:54 -07:00
Sean Corfield
2f1d3ae870 fixes #421 replace into 2022-09-03 21:34:09 -07:00
Sean Corfield
9569b19a34 address #425 for map inserts 2022-09-02 22:35:17 -07:00
Sean Corfield
3073d28525 address #423 by adding support for default
needs documentation
2022-09-01 22:54:00 -07:00
Sean Corfield
e204f3b45e add security notes about quoting
also consistently use SQL entity names instead of identifiers so the
documentation is consistent in terminology.
2022-08-23 17:18:00 -07:00
Sean Corfield
a879a2d8a1 auto-quote unusual entities by default 2022-08-23 15:41:38 -07:00
Rob Hanlon
204f6fa72a
Support materialization control in WITH
Adds an optional third value to `with` vectors, which can be the
following:

* `:materialized` -> SQL is `WITH cte AS MATERIALIZED (...)`
* `:not-materialized` -> SQL is `WITH cte AS NOT MATERIALIZED (...)`
* omitted or anything else -> SQL is `WITH cte AS (...)`

Note that materialization control is not available on WITH RECURSIVE
CTEs, so `format-with` was modified to take a third argument that
returns the `AS ...` separator, which is constantly `"AS"` for WITH
RECURSIVE, and obeys the aforementioned rules for non-recursive CTEs.

Resolves #392.
2022-08-16 16:01:52 -07:00
Sean Corfield
e6654f7a22 check for empty where clauses fix #413 2022-08-06 21:11:08 -07:00
Sean Corfield
d065a04e18 placeholder (should :array unwrap params?) 2022-05-20 10:34:10 -07:00
Sean Corfield
5fe73c75bc Support custom dialects fixes #401 (add docs/tests) 2022-05-01 17:34:31 -07:00
Sean Corfield
e45ea8586e Add PostgreSQL JSON / regex operators fixes #398 2022-04-23 15:40:47 -07:00
Sean Corfield
124fac6f28 :insert-into should support abitrary functions for table fixes #402 2022-04-23 15:12:55 -07:00
Sean Corfield
a2e02c8a03 fix #394 by escaping quote chars
This matches the HoneySQL 1.x behavior now.
2022-03-31 17:34:51 -07:00
Sean Corfield
ab7c235329 fix #399 by correcting docs and tests 2022-03-26 13:45:43 -07:00
Sean Corfield
c4efcc0cad #398 || is variadic (by default) 2022-03-26 08:33:05 -07:00
Sean Corfield
17319cdd26 #398 treat -> as variadic 2022-03-26 08:28:24 -07:00
Sean Corfield
af69f12630 address #398 (needs docs) 2022-03-25 21:48:00 -07:00
Sean Corfield
f711b934fa fix #387 properly 2022-02-22 21:27:10 -08:00
Sean Corfield
803ff41dc0 Dehyphen improvements fixes #387 2022-02-21 19:09:49 -08:00
Sean Corfield
4bf76920ef fix #385 by quoting inlined uuids 2022-02-09 10:20:36 -08:00
Sean Corfield
c7c634d694 change :' to use format-entity #352 2022-02-02 23:51:01 -08:00
Sean Corfield
1f2773bd16 address #352 by treating :'foo literally 2022-02-02 22:04:44 -08:00
Sean Corfield
1d22086fce fix #381 by adding generic helpers; prep for 2.2.861 2022-01-30 22:31:37 -08:00
Sean Corfield
8a2f447676 Fix #382 by adding :case-expr syntax 2022-01-29 17:19:17 -08:00
Sean Corfield
139de6f56c fix #380 by accounting for vars 2022-01-21 13:05:15 -08:00
Sean Corfield
33ddaa74b6 verify cache entries based on varying parameter names 2022-01-08 12:22:53 -08:00
Sean Corfield
06102e9334 add asserts on cache sizes 2022-01-08 12:16:54 -08:00
Sean Corfield
826407e9db first pass of caching formatter
needs more documentation.

Initial results suggest a speedup for simple queries of 2-3x.
Complex queries can see up to 20x speedup.
2022-01-08 00:41:21 -08:00
Sean Corfield
2670abc75f fix #377 by adopting @corasaurus-hex function as map= 2022-01-07 23:16:56 -08:00
Sean Corfield
99ce051a9d add array/struct support 2022-01-07 12:53:30 -08:00
Sean Corfield
e8e6c7f932 address #281 - support select foo.* except 2022-01-07 11:35:08 -08:00
Sean Corfield
a653f9b157 address #281 add select * except / replace for BigQuery 2022-01-06 23:02:20 -08:00
Sean Corfield
499b9de0ae proposed syntax for #281 2022-01-06 20:41:51 -08:00
Sean Corfield
8979e938f3 fixes #374 2021-12-23 13:32:47 -08:00
Sean Corfield
6aee04e25c fixes #365 2021-10-03 22:18:12 -07:00
Sean Corfield
dae09ff601 fixes #363 by improving inlining capability 2021-09-25 17:06:48 -07:00
Sean Corfield
9ece8972b5 fixes #344 by special-casing MySQL SET 2021-08-12 18:26:39 -07:00
Sean Corfield
50bbfef07f Fixes #338 properly by making offset/fetch smarter 2021-07-17 17:57:17 -07:00
Sean Corfield
7e84b58463 fixes #338 by adding ONLY to :fetch 2021-07-17 13:32:43 -07:00
Sean Corfield
a393cd89e2 fixes #337 by using clojure.test for cljs 2021-07-15 19:26:59 -07:00
Sean Corfield
fe4be6cca6 Make test cljs-compatible 2021-05-10 22:46:36 -07:00
Sean Corfield
9e0b31bbd9 Fixes #325 Fixes #326 adds tests/docs 2021-05-10 22:44:57 -07:00
Neil McCalum
9c38554154 format with opts, hyphen to under in function names, improve and relocate tests 2021-05-11 01:07:34 +12:00
Neil McCalum
6ebc017969 quoting for :%fun.col(s) syntax to match with [[:fun :col]] 2021-05-09 17:18:39 +12:00
Sean Corfield
d73560b7e3 Add :quoted-snake option 2021-05-08 21:01:28 -07:00
Sean Corfield
46b3c1773b Fixes #324 by correcting insert-into 2021-05-01 12:56:42 -07:00
Sean Corfield
20cba15da2 Fixes #321 by adding :checking option
Initial linting is only for IN () and IN (NULL)
2021-04-22 22:13:32 -07:00
Sean Corfield
f606dc6044 Fixes #323 by allowing multiple column names 2021-04-22 19:16:30 -07:00
Sean Corfield
dd52ebe7e8 Fixes #322 by rewriting where/having merge 2021-04-13 12:51:21 -07:00
Sean Corfield
272b088918 Revert "Addresses #315 by expanding IN to handle nil"
This reverts commit 8a1e2cca71.
2021-04-12 15:04:17 -07:00
Sean Corfield
e6a5bdb001 Fixes #308 by adding support for clauses
This also corrects the docstring for the join-by helper.
2021-04-11 04:18:14 -07:00
Sean Corfield
d734767877 Remove the old 1.x code
It hasn't been part of the deployed library for quite a while because I
had moved it into the test folder, while I was reaching parity.
2021-04-11 03:21:35 -07:00
Sean Corfield
50fd829752 Addresses #310 by adding filter, order-by, within-group syntax 2021-04-11 14:32:48 -07:00
Sean Corfield
862a2496c6 Consistent use of 1.x / 2.x 2021-04-11 11:09:47 -07:00
Sean Corfield
8a1e2cca71 Addresses #315 by expanding IN to handle nil 2021-04-10 10:57:13 -07:00
Sean Corfield
88282ee258 Fixes #316 by adding check on entity characters
Also record that documentation addresses #300, #309, #313, and #314.
2021-04-09 23:41:59 -07:00
Sean Corfield
2fe083f8e6 Support named arguments in format again
With the advent of Clojure 1.11 and the ability to call functions that
accept named arguments using a hash map, I have restored the named
argument version of `format` (in addition to the hash map version),
and if you are using Clojure 1.11 you can mix'n'match styles.
2021-04-09 17:04:48 -07:00
Sean Corfield
af382708e5 Fixes #319 by making register-clause! idempotent
Technically, it removes any instance of the clause from the ordering
before it attempts to add it back in, allowing you to correct the
order if you got it wrong.
2021-04-09 15:58:56 -07:00
Sean Corfield
06f25ed2e3 Fixes #317 by dropping qualifier in :set clause 2021-04-01 12:50:09 -07:00
Sean Corfield
16d04a1dfd Fixes #297 by adding into/bulk-collect-into 2021-03-13 13:42:08 -08:00
Sean Corfield
cff1e5b43c Fixes #284 by adding lateral expression syntax 2021-03-13 13:13:35 -08:00
Sean Corfield
6b070df52c Finish off TOP implementation #292 2021-03-13 12:10:42 -08:00
Sean Corfield
479008c294 Address #292 by starting to support SELECT TOP 2021-03-12 18:54:19 -08:00
Sean Corfield
dc6a3662f0 Fixes #303 by adding ON DUPLICATE KEY UPDATE 2021-03-12 16:13:52 -08:00
Sean Corfield
d35d9141bc Fixes #280 by adding [:escape pattern chars] 2021-03-12 15:39:54 -08:00
Sean Corfield
ddebda9481 Fixes #301 Fixes #306 by expanding drop/create syntax 2021-03-12 11:43:21 -08:00
Sean Corfield
e70985e93b Fixes #277 by adding join-by 2021-03-07 19:21:13 -08:00
Sean Corfield
b600348808 Addresses #283 on the v1 branch 2021-03-06 22:10:43 -08:00
Sean Corfield
06d90c174e Rework and-merge WIP (tests fail) 2021-03-06 18:40:23 -08:00
Sean Corfield
5e2036a922 Temporarily comment out WIP tests 2021-02-27 09:35:03 -08:00
Sean Corfield
78ca2a0530 Fixes #305 by supporting more complex JOIN source 2021-02-27 09:33:20 -08:00
Sean Corfield
770beec886 Add test for (v1) SQL Injection in insert #299 2021-02-22 10:56:32 -08:00
Sean Corfield
28a4074e12 Add flexibility for on conflict / on constraint 2021-02-15 20:43:53 -08:00
Sean Corfield
155ae25ad0 Clean up create extension test 2021-02-15 17:56:18 -08:00
Sean Corfield
0b687c5eb0 Add nilenso version of tests for comparison
This shows all the changes side-by-side.
2021-02-15 16:27:08 -08:00
Sean Corfield
f4137d3fc1 Enhance insert-into; document more helpers 2021-02-14 20:39:32 -08:00
Sean Corfield
e23502eba8 Add create/drop extension #293 2021-02-13 22:06:43 -08:00
Sean Corfield
e585ded37e Restore upsert helper for #293 2021-02-13 19:08:40 -08:00
Sean Corfield
7b928fecb2 Addresses #293 by porting nilenso tests
I intended to keep all the original tests inline but it got harder than
I expected, so I'm going to make another pass over this and insert the
original tests back in later.
2021-02-13 16:02:13 -08:00
Sean Corfield
f6975ef6bd Fix select as, select distinct on 2021-02-13 15:58:56 -08:00