Clarify :result-type/:concurrency interaction
Also further clarify MS SQL Server behavior.
This commit is contained in:
parent
9626d29d5c
commit
6450bfa0f2
3 changed files with 6 additions and 2 deletions
|
|
@ -9,7 +9,7 @@ The following changes have been committed to the **master** branch since the 1.0
|
|||
* Fix link to **All The Options** in **Migration from `clojure.java.jdbc`**. PR #71 (@laurio).
|
||||
* Address #70 by adding **CLOB & BLOB SQL Types** to the **Tips & Tricks** section of **Friendly SQL Functions** and by adding `next.jdbc.result-set/clob-column-reader` and `next.jdbc.result-set/clob->string` helper to make it easier to deal with `CLOB` column data.
|
||||
* Clarify what `execute!` and `execute-one!` produce when the result set is empty (`[]` and `nil` respectively, and there are now tests for this). Similarly for `find-by-keys` and `get-by-id`.
|
||||
* Add **MS SQL Server** section to **Tips & Tricks** to note that returns an empty string for table names by default (so table-qualified column names are not available). Passing a `:result-type` option of `:scroll-sensitive` or `:scroll-insensitive` should cause it to return table names (unconfirmed).
|
||||
* Add **MS SQL Server** section to **Tips & Tricks** to note that returns an empty string for table names by default (so table-qualified column names are not available). Using the `:result-type` (scroll) and `:concurrency` options will cause table names to be returned.
|
||||
* Clarify that **Friendly SQL Functions** are deliberately simple (hint: they will not be enhanced or expanded -- use `plan`, `execute!`, and `execute-one!` instead, with a DSL library if you want!).
|
||||
* Improve migration docs: explicitly recommend the use of a datasource for code that needs to work with both `clojure.java.jdbc` and `next.jdbc`; add caveat about column name conflicts.
|
||||
* Improve `datafy`/`nav` documentation around `:schema`.
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@ Any function that creates a `PreparedStatement` will accept the following option
|
|||
* `:return-keys` -- a truthy value asks that the JDBC driver to return any generated keys created by the operation; it can be `true` or it can be a vector of keywords identifying column names that should be returned,
|
||||
* `:timeout` -- an integer that specifies the timeout allowed for SQL operations.
|
||||
|
||||
If you specify either `:concurrency` or `:result-type`, you must specify _both_ of them. If you specify `:cursors`, you must also specify `:result-type` _and_ `:concurrency`.
|
||||
|
||||
*Note: For MS SQL Server to return table names (for qualified column names), you must specify `:result-type` with one of the scroll values (and so you must also specify `:concurrency`).*
|
||||
|
||||
Not all databases or drivers support all of these options, or all values for any given option. If `:return-keys` is a vector of column names and that is not supported, `next.jdbc` will attempt a generic "return generated keys" option instead. If that is not supported, `next.jdbc` will fall back to a regular SQL operation. If other options are not supported, you may get a `SQLException`.
|
||||
|
||||
In addition, `next.jdbc.prepare/execute-batch!` accepts an options hash map that can contain the following:
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ Consult the [java.sql.Blob documentation](https://docs.oracle.com/javase/8/docs/
|
|||
|
||||
### MS SQL Server
|
||||
|
||||
By default, you won't get table names as qualifiers with Microsoft's JDBC driver (you might with the jTDS drive -- I haven't tried that recently). See this [MSDN forum post about `.getTableName()`](https://social.msdn.microsoft.com/Forums/sqlserver/en-US/55e8cbb2-b11c-446e-93ab-dc30658caf99/resultsetmetadatagettablename-returns-instead-of-table-name) for details. According to one of the answers posted there, if you specify `{:result-type :scroll-insensitive}` or `{:result-type :scroll-sensitive}` in the options for `execute!`, `execute-one!`, `plan`, or `prepare`, that will cause SQL Server to return table names for columns. I have not confirmed this.
|
||||
By default, you won't get table names as qualifiers with Microsoft's JDBC driver (you might with the jTDS drive -- I haven't tried that recently). See this [MSDN forum post about `.getTableName()`](https://social.msdn.microsoft.com/Forums/sqlserver/en-US/55e8cbb2-b11c-446e-93ab-dc30658caf99/resultsetmetadatagettablename-returns-instead-of-table-name) for details. According to one of the answers posted there, if you specify `:result-type` and `:concurrency` in the options for `execute!`, `execute-one!`, `plan`, or `prepare`, that will cause SQL Server to return table names for columns. `:result-type` needs to be `:scoll-sensitive` or `:scroll-insensitive` for this to work. `:concurrency` can be `:read-only` or `:updatable`.
|
||||
|
||||
### MySQL
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue