From 1fe526a7341326e7504b6b0cc196c2b547259622 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Sat, 28 Oct 2023 14:04:35 -0700 Subject: [PATCH] prep for 2.5.1090 --- CHANGELOG.md | 2 +- README.md | 6 +++--- doc/clause-reference.md | 2 +- doc/databases.md | 2 +- doc/differences-from-1-x.md | 2 +- doc/extending-honeysql.md | 2 +- doc/getting-started.md | 6 +++--- doc/nrql.md | 2 +- doc/postgresql.md | 4 ++-- src/honey/sql/helpers.cljc | 19 ++++++++++--------- 10 files changed, 24 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7b91c2..0ecb929 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changes -* 2.4.next in progress +* 2.5.1090 -- 2023-10-28 * Address [#512](https://github.com/seancorfield/honeysql/issues/512) by adding support for subqueries in the `:array` special syntax (for BigQuery and PostgreSQL). This also adds support for metadata on the `:select` value to produce `AS STRUCT` or `DISTINCT`. * Address [#511](https://github.com/seancorfield/honeysql/issues/511) by adding support for BigQuery `CREATE OR REPLACE`. * Address [#510](https://github.com/seancorfield/honeysql/issues/510) by adding initial support for an NRQL dialect. diff --git a/README.md b/README.md index 02fd74b..244b87c 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ SQL as Clojure data structures. Build queries programmatically -- even at runtim ## Build -[![Clojars](https://img.shields.io/badge/clojars-com.github.seancorfield/honeysql_2.4.1078-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABjFBMVEUAAAAdCh0qDikdChwAAAAnDSY0EjM2FjUnDiYnDSYnDSYpDigyEDEEAQRGNUb///////8mDSYAAAAAAAAAAAAFAgUqEyoAAAAAAAAAAAAFAgUAAABXU1c2FjVMx+dQx+f///////9Nx+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MjowMCgWtSoAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTUtMDctMDdUMjI6NTg6NDYrMDI6MDBZSw2WAAAAAElFTkSuQmCC)](https://clojars.org/com.github.seancorfield/honeysql) -[![cljdoc](https://cljdoc.org/badge/com.github.seancorfield/honeysql?2.4.1078)](https://cljdoc.org/d/com.github.seancorfield/honeysql/CURRENT) +[![Clojars](https://img.shields.io/badge/clojars-com.github.seancorfield/honeysql_2.5.1090-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABjFBMVEUAAAAdCh0qDikdChwAAAAnDSY0EjM2FjUnDiYnDSYnDSYpDigyEDEEAQRGNUb///////8mDSYAAAAAAAAAAAAFAgUqEyoAAAAAAAAAAAAFAgUAAABXU1c2FjVMx+dQx+f///////9Nx+b////4/f6y4vRPt+RQtOT///9Qt+P///8oDSey4vRQr9/////3/P5hzelNx+dNx+dNx+f///8AAAAuDy0zETIAAAAoDScAAAAAAAARBREAAAAvDy40ETMwEC9gSF+Ne42ilKKuoK6Rg5B5ZXlaP1o4Gzf///9nTWZ4YncyEDF/bn/8/Pz9/P339/c1FTUlDCRRM1AbCRtlS2QyEDEuDy1gRWAxEDAzETIwEC/g4OAvDy40EjOaiZorDiq9sbzNyM3UzdQyEDE0ETMzETKflZ/UzdQ5Fzmu4fNYyuhNx+dPt+RLu9xQyOhBbo81GTuW2vCo4PJNx+c4MFE5N1lHiLFEhKQyEDGDboMzETI5Fjh5bXje2d57aHrIw8jc2NyWhJUrDioxe9o4AAAAPnRSTlMAkf+IAQj9+e7n6e31RtqAD/QAAAED+A0ZEQ8DwvkLBsmcR4aG8+cdAD6C8/MC94eP+qoTrgH+/wj1HA8eEvpXOCUAAAABYktHRA8YugDZAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wcHFjou4Z/shwAAAUpJREFUOMul0/VTwzAUB/AAwyW4y3B3h8EDNuTh7u6UDHcd8I+TbHSjWdrjju/1h77kc+3Lu5aQvyakF/r6B5wu1+DQMEBomLRtG0EpozYDCEccA4iIjIqOiY0bB5iYxHgZ4FQCpYneKmmal0aQPMOXZnUAvJhLkbpInf8NFtKCTrGImK6DJcTlDGl/BXGV6oCsrSNIYAM3aQDwl2xJYBtBB5lZAuyYgWzY3YMcNcjN2wc4EGMEFTg8+hlyfgEenygAj71Q9FBExH0wKC4p1bRTJlJWXqEAVNM05ovbXfkPAHBmAUQPAGaAsXMBLiwA8z3h0gRcsWsObuAWLJu8Awb3ZoB5T8EvS/CgBo9Y5Z8TPwXBJwlUI9Ia/yRrEZ8lID71Olrf0MiamkkL4kurDEjba+C/e2sninR0wrsH8eMTvrqIWbodjh7jyjdtCY3Aniz4jwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNS0wNy0wN1QyMjo1ODo0NiswMjowMCgWtSoAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTUtMDctMDdUMjI6NTg6NDYrMDI6MDBZSw2WAAAAAElFTkSuQmCC)](https://clojars.org/com.github.seancorfield/honeysql) +[![cljdoc](https://cljdoc.org/badge/com.github.seancorfield/honeysql?2.5.1090)](https://cljdoc.org/d/com.github.seancorfield/honeysql/CURRENT) [![Slack](https://img.shields.io/badge/slack-HoneySQL-orange.svg?logo=slack)](https://clojurians.slack.com/app_redirect?channel=honeysql) [![Join Slack](https://img.shields.io/badge/slack-join_clojurians-orange.svg?logo=slack)](http://clojurians.net) @@ -759,7 +759,7 @@ be quoted according to the selected dialect. If you override the dialect in a `format` call, by passing the `:dialect` option, SQL entity names will be automatically quoted. You can override the dialect and turn off quoting by passing `:quoted false`. Valid `:dialect` options are `:ansi` (the default, use this for PostgreSQL), -`:mysql`, `:oracle`, or `:sqlserver`. As of 2.4.next, `:nrql` is also supported: +`:mysql`, `:oracle`, or `:sqlserver`. As of 2.5.1090, `:nrql` is also supported: ```clojure (-> (select :foo.a) diff --git a/doc/clause-reference.md b/doc/clause-reference.md index 55df6f1..44136af 100644 --- a/doc/clause-reference.md +++ b/doc/clause-reference.md @@ -509,7 +509,7 @@ name reference. `:select-distinct` works the same way but produces `SELECT DISTINCT`. -As of 2.4.next, you can use metadata on the argument to `:select` to +As of 2.5.1090, you can use metadata on the argument to `:select` to provide qualifiers for the `SELECT` clause: ```clojure diff --git a/doc/databases.md b/doc/databases.md index e729849..69b2598 100644 --- a/doc/databases.md +++ b/doc/databases.md @@ -7,7 +7,7 @@ databases. As a reminder, HoneySQL supports the following dialects out of the box: * `:ansi` -- which is the default and provides broad support for PostgreSQL as well * `:mysql` -- which includes MariaDB and Percona -* `:nrql` -- as of 2.4.next +* `:nrql` -- as of 2.5.1090 * `:oracle` * `:sqlserver` -- Microsoft SQL Server diff --git a/doc/differences-from-1-x.md b/doc/differences-from-1-x.md index 2db58bc..c97c827 100644 --- a/doc/differences-from-1-x.md +++ b/doc/differences-from-1-x.md @@ -63,7 +63,7 @@ Supported Clojure versions: 1.7 and later. In `deps.edn`: ```clojure -com.github.seancorfield/honeysql {:mvn/version "2.4.1078"} +com.github.seancorfield/honeysql {:mvn/version "2.5.1090"} ``` Required as: diff --git a/doc/extending-honeysql.md b/doc/extending-honeysql.md index c5f6a60..066f8da 100644 --- a/doc/extending-honeysql.md +++ b/doc/extending-honeysql.md @@ -182,7 +182,7 @@ _New in HoneySQL 2.3.x_ The built-in dialects that HoneySQL supports are: * `:ansi` -- the default, that quotes SQL entity names with double-quotes, like `"this"` * `:mysql` -- quotes SQL entity names with backticks, and changes the precedence of `SET` in `UPDATE` -* `:nrql` -- as of 2.4.next, see [New Relic NRQL Support](nrsql.md) for more details of the NRQL dialect +* `:nrql` -- as of 2.5.1090, see [New Relic NRQL Support](nrsql.md) for more details of the NRQL dialect * `:oracle` -- quotes SQL entity names like `:ansi`, and does not use `AS` in aliases * `:sqlserver` -- quotes SQL entity names with brackets, like `[this]` diff --git a/doc/getting-started.md b/doc/getting-started.md index a5e158e..db205d5 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -10,14 +10,14 @@ For the Clojure CLI, add the following dependency to your `deps.edn` file: ```clojure - com.github.seancorfield/honeysql {:mvn/version "2.4.1078"} + com.github.seancorfield/honeysql {:mvn/version "2.5.1090"} ``` For Leiningen, add the following dependency to your `project.clj` file: ```clojure - [com.github.seancorfield/honeysql "2.4.1078"] + [com.github.seancorfield/honeysql "2.5.1090"] ``` HoneySQL produces SQL statements but does not execute them. @@ -341,7 +341,7 @@ The dialects supported by HoneySQL 2.x are: * `:ansi` -- the default, including most PostgreSQL extensions * `:sqlserver` -- Microsoft SQL Server * `:mysql` -- MySQL (and Percona and MariaDB) -* `:nrql` -- as of 2.4.next +* `:nrql` -- as of 2.5.1090 * `:oracle` -- Oracle The most visible difference between dialects is how SQL entities diff --git a/doc/nrql.md b/doc/nrql.md index b6d8563..c526bf8 100644 --- a/doc/nrql.md +++ b/doc/nrql.md @@ -1,6 +1,6 @@ # New Relic NRQL Support -As of 2.4.next, HoneySQL provides some support for New Relic's NRQL query language. +As of 2.5.1090, HoneySQL provides some support for New Relic's NRQL query language. At present, the following additional SQL clauses (and their corresponding helper functions) are supported: diff --git a/doc/postgresql.md b/doc/postgresql.md index dd0519b..0de9d3e 100644 --- a/doc/postgresql.md +++ b/doc/postgresql.md @@ -50,14 +50,14 @@ PostgreSQL also has an "array constructor" for creating arrays from subquery res SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%'); ``` -As of 2.4.next, HoneySQL supports this syntax directly: +As of 2.5.1090, HoneySQL supports this syntax directly: ```clojure user=> (sql/format {:select [[[:array {:select :oid :from :pg_proc :where [:like :proname [:inline "bytea%"]]}]]]}) ["SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%')"] ``` -Prior to 2.4.next, you had to use HoneySQL's "as-is" function syntax to circumvent +Prior to 2.5.1090, you had to use HoneySQL's "as-is" function syntax to circumvent the special syntax: ```clojure diff --git a/src/honey/sql/helpers.cljc b/src/honey/sql/helpers.cljc index eefd51e..9a556f2 100644 --- a/src/honey/sql/helpers.cljc +++ b/src/honey/sql/helpers.cljc @@ -55,11 +55,12 @@ ;; implementation helpers: (defn- default-merge [current args] - (let [current (cond + (let [mdata (meta current) + current (cond (nil? current) [] (sequential? current) (vec current) :else [current])] - (c/into current args))) + (c/into (with-meta current mdata) args))) (defn- conjunction? [e] @@ -143,7 +144,7 @@ (assoc data k' clause) data) :else - (clojure.core/update data k' default-merge args)))) + (c/update data k' default-merge args)))) (defn- generic [k args] (if (map? (first args)) @@ -1158,9 +1159,9 @@ ;; ensure #295 stays true (all public functions have docstring): (assert (empty? (->> (ns-publics *ns*) (vals) (c/filter (comp not :doc meta)))))) ;; ensure all public functions match clauses: - (assert (= (clojure.core/set (conj @#'honey.sql/default-clause-order - :composite :filter :lateral :over :within-group - :upsert - :generic-helper-variadic :generic-helper-unary)) - (clojure.core/set (conj (map keyword (keys (ns-publics *ns*))) - :nest :raw)))))) + (assert (= (c/set (conj @#'honey.sql/default-clause-order + :composite :filter :lateral :over :within-group + :upsert + :generic-helper-variadic :generic-helper-unary)) + (c/set (conj (map keyword (keys (ns-publics *ns*))) + :nest :raw))))))