Commit graph

280 commits

Author SHA1 Message Date
Sean Corfield
e03de7828a Document PR #64
Add to change log, Getting Started, and ns docstring for 
`next.jdbc.specs`. Also note docs in GitHub are for **master** now.
2019-09-14 13:32:34 -07:00
Gerred Dillon
740e1abaaf Add unstrument function to specs
Signed-off-by: Gerred Dillon <hello@gerred.org>
2019-09-14 15:51:46 -04:00
Sean Corfield
7a110f15ce Address #60 by adding two new schema formats
Still considering what #61 might need.
2019-09-08 17:05:07 -07:00
Sean Corfield
cae84736a3 Typo in docstring 2019-09-06 01:52:18 -07:00
Sean Corfield
1b93d3a04b Improve result set adapter docstrings 2019-08-24 11:25:19 -07:00
Sean Corfield
f95467a34c Improve docs for insert-multi! / execute-batch!
Call out the caveats more clearly. Note that Oracle doesn't support the 
`insert-multi!` syntax(!).
2019-08-22 13:09:07 -07:00
Sean Corfield
9a76e4c25a Add as-arrays-adapter 2019-08-21 14:47:55 -07:00
Sean Corfield
fed305dd2b Add and document as-maps-adapter 2019-08-21 14:19:32 -07:00
Sean Corfield
87e44ae6a6 Fixes #52 by using US-locale lower-case function 2019-08-08 17:01:23 -07:00
Sean Corfield
e0b0c214fd Improve printability as part of #51
Since `str` may be able to realize a row and render it as a string, attempts to print a row use this route to circumvent `print-sequential` failing due to lazy evaluation.
2019-08-02 12:42:00 -07:00
Sean Corfield
0fd8bf1a88 Fixes #51 by implementing IPersistentMap in full
* `dissoc`, `cons`, `=` -- both realize a full row.
* `count`, `empty` -- do not realize rows, `empty` doesn't use the builder at all.
* `str` -- attempts to realize a row (else returns the same "helpful" string as before).
2019-08-02 12:24:04 -07:00
Sean Corfield
5424353f2d Clarify position on default options
I.e., write your own wrapper if you want to globally override options.
2019-07-24 22:49:24 -07:00
Sean Corfield
b3f462e90b Fixes #48 by documenting connection/->pool 2019-07-18 12:12:09 -07:00
Sean Corfield
b1b2f13ebb Rename jdbc-url to ->pool 2019-07-18 11:01:55 -07:00
Sean Corfield
60c1e6660f Support connection pooling more easily 2019-07-17 23:50:56 -07:00
Sean Corfield
5d898ef27a Formatting tweak in ns docstring 2019-07-15 14:09:48 -07:00
Sean Corfield
3ffeb5dda9 Improve docstring 2019-07-15 14:01:42 -07:00
Sean Corfield
8e4ef3033c Note :none as possible value for :host 2019-07-15 13:51:23 -07:00
Sean Corfield
8883167805 Finish off #47
Make `dbtypes` public again (oops!). Note that it _won't_ contain defaults (if folks feel they need them, they can easily be added). Use `:host :none` in `dbtypes` to indicate a local database (no `:host`/`:port` segment) which is more consistent with how users would specify a new database.

Reduce the number of special cases in the JDBC URL assembly, now that `:host :none` from `dbtypes` can drive that.
2019-07-15 11:15:26 -07:00
Sean Corfield
816fc7ce4b Fix #47 by refactoring how db-specs are built 2019-07-14 21:46:59 -07:00
Sean Corfield
44dba4f29c Fixes #46 by allowing :host :none
Also adds `:dbname-separator` and `:host-prefix` for fine-grained 
control over the JDBC URL format.
2019-07-11 15:43:49 -07:00
Sean Corfield
4457161305 Assert/spec/tests for empty cols in insert-multi! 2019-07-11 12:52:36 -07:00
Sean Corfield
4d7a5a440b Fix #43 by relaxing the spec for insert-multi!
Adds tests for `insert-multi!` that pass sequences instead of vectors.
2019-07-11 12:34:02 -07:00
Sean Corfield
821f9b1a5a Fixes #44
Also adds `assert`s in SQL-generating functions, instead of just 
producing illegal SQL.
2019-07-11 12:11:32 -07:00
Sean Corfield
2131136c0d Another tweak to TimesTen direct 2019-07-10 20:00:40 -07:00
Sean Corfield
2c524614ce TimesTen client needs special dbname separator too 2019-07-10 19:47:19 -07:00
Sean Corfield
bb753f363b Fixes #45 by adding TimesTen driver suport 2019-07-10 19:32:24 -07:00
Sean Corfield
3c32bfe13d Fixes #42 by adding specs for next.jdbc.prepare API functions 2019-07-10 12:11:26 -07:00
Sean Corfield
79d6f5ef29 Improve documentation around :dbtype
Expose `next.jdbc.connection/dbtypes` which is a table of all known 
`:dbtype` values and their driver class names, ports, etc.
2019-07-10 11:54:13 -07:00
Sean Corfield
29d46439e6 Fixes #40 by adding next.jdbc.prepare/execute-batch! 2019-07-09 16:00:10 -07:00
Sean Corfield
7184ef996c Fixes #41; Addresses #40; Expand prepared statement documentation
* Combine adjacent `with-open` calls.
* Show how `set-parameters` is used.
* Add a section on batched parameters, with their caveats, and how to 
use them.
2019-07-08 20:48:56 -07:00
Sean Corfield
58aeff56f7 Updated insert-multi! docstring
Removed caveat about batching (doesn't apply) but added caveat about 
size/parameter limits.
2019-07-08 17:21:28 -07:00
Sean Corfield
dcb632d7cf Make it clear that next.jdbc.prepare/create should not be called 2019-07-08 12:40:19 -07:00
Sean Corfield
ba4dc837e1 Fixes #33 by improving specs 2019-07-02 18:50:25 -07:00
Sean Corfield
1cec0a2643 Fixes #37; Fixes #36
* Fix `with-transaction` spec and how it invokes `transact` when no 
options map is provided.
* Adds type hint to `with-transaction`.
* Document manual rollback of transactions.
2019-07-02 16:45:48 -07:00
Sean Corfield
85eba1bb2f Fixes #35 by documenting the DB-specific insert multi options 2019-06-28 19:18:26 -07:00
Sean Corfield
e1b42b1804 Address #31 by improving string representation of reified objects
At least this should give a hint as to what you did wrong...
2019-06-11 16:47:58 -07:00
Sean Corfield
22a3f2bb5f Fix #26 by adding datafiable-result-set
This makes handling metadata result sets much easier.
2019-06-08 15:09:42 -07:00
Sean Corfield
b4331146ff Stop Joker flagging some ns as unused
These are pulled into `next.jdbc` to extend/implement protocols only.
2019-06-07 17:39:58 -07:00
Sean Corfield
b64fbf35ff Fix #30 by adding modified builders
Adds `:label-fn` and `:qualifier-fn` options, and `as-modified-*` 
builder variants.
2019-06-04 18:01:19 -07:00
jet
df1c38c03f Correct documentation for transact and with-transaction
Previously both functions were documented as taking a `Connectable`
object. This amends the documentation as well as the fn signature to
take a `Transactable` object.
2019-06-02 12:07:01 -04:00
Sean Corfield
382d1bef10 Fix #24 by adding type hints 2019-05-29 13:51:11 -07:00
Sean Corfield
fdfb0697ec Address #24 by setting warn on reflection in tests
This highlights the reflection on `.close` (in the connection tests).
2019-05-29 09:04:21 -07:00
Sean Corfield
6a9df0f4aa Fix #22 by adding next.jdbc.optional
Includes four `as*maps` builders that omit `NULL` columns completely 
from the returned row hash maps.
2019-05-25 19:16:30 -07:00
Sean Corfield
b831525948 Remove leftover REPL debugging code 2019-05-23 10:05:27 -07:00
Sean Corfield
a32c5b9e66 Address #16 by renaming reducible! to plan for Beta 1 2019-05-22 16:22:14 -07:00
Sean Corfield
656a0d8d9a Add namespace docstring for new specs 2019-05-21 21:55:10 -07:00
Sean Corfield
adf5a03e05 Address #21 by adding next.jdbc.specs
Docs still need to be updated for this!
2019-05-21 21:45:05 -07:00
Sean Corfield
99ee285689 Fix #19 by caching loaded database driver classes 2019-05-08 15:11:37 -07:00
Sean Corfield
ff94962e27 Fixes #18 by cleaning up connection properties better. 2019-05-04 23:59:48 -07:00
Sean Corfield
eb981d5726 Another pass over documentation and docstrings 2019-04-26 22:42:27 -07:00
Sean Corfield
ee2fcc47ab Fixes #17 by changing sql-string to sql-params 2019-04-26 10:34:26 -07:00
Sean Corfield
cf75268087 Rename :gen-fn to :builder-fn 2019-04-24 14:22:35 -07:00
Sean Corfield
13ad917864 Fix #15 by passing SQL string to builders
Adds internal `:next.jdbc/sql-string` option.
2019-04-24 10:07:52 -07:00
Sean Corfield
2c018654d3 Alpha 9; fixes #14; improves protocol docstrings
* Move documentation from `ns` into `defprotocol` and the method 
declarations.
* Indicate which protocols may be extended via metadata 
(`SettableParameter` and `Sourceable`).
2019-04-22 17:41:31 -07:00
Sean Corfield
2badd9f835 Big docstring cleanup 2019-04-21 16:13:52 -07:00
Sean Corfield
03b09f6e03 Alpha 5; fixes #12 by adding :order-by option to for-query 2019-04-21 13:42:33 -07:00
Sean Corfield
c2c798770a Alpha 4; fixes #11 by adding schema meta-quoting function 2019-04-21 13:00:03 -07:00
Sean Corfield
6f637b4e36 Start documenting differences/migration more seriously 2019-04-21 00:48:16 -07:00
Sean Corfield
d688e639d0 Document prepared statement handling 2019-04-20 22:28:21 -07:00
Sean Corfield
2ab35132a7 Document Result Set Builders
And sketch out the remaining documentation outline.
2019-04-20 22:00:40 -07:00
Sean Corfield
6e1dba1bce Fix user (name) property 2019-04-20 16:03:01 -07:00
Sean Corfield
f691d59be7 Update set-parameters docstring
Uses set-parameter and SettableParameter now, not `.setObject`
2019-04-19 22:51:05 -07:00
Sean Corfield
3588d526fa execute-all should return a vector even for update counts 2019-04-19 22:50:10 -07:00
Sean Corfield
12e396683c Add tests for map-like reducible! result set
Ensures basic associative/lookup access do not cause row building; 
ensures assoc/seq produce real maps; ensure datafiable-row produces a 
real map with metadata.
2019-04-19 21:53:55 -07:00
Sean Corfield
bfda745a70 Add row builder tests; fix row builder bug in execute-one 2019-04-18 23:03:09 -07:00
Sean Corfield
d4f79a68fd Add datafication tests; fix regex bug! 2019-04-18 22:43:19 -07:00
Sean Corfield
3b0b059f62 Add connection tests
Improve handling of relative files with H2 database connections.
2019-04-18 21:35:38 -07:00
Sean Corfield
d59b1ec2fb Basic SQL tests and bug fix!
Multi-row insert did not apply `:column-fn` correctly.
2019-04-18 18:31:15 -07:00
Sean Corfield
2cd9e9372d Fix docstring typos 2019-04-18 14:09:07 -07:00
Sean Corfield
e85cbf7c95 Make datafy/nav implementation more robust
Also some documentation cleanup
2019-04-18 14:06:14 -07:00
Sean Corfield
8c508b8416 Documentation cleanup 2019-04-18 13:19:59 -07:00
Sean Corfield
7f2d3479e9 Split :entities into two options
`:table-fn` and `:column-fn`
2019-04-18 08:12:56 -07:00
Sean Corfield
e5ea6af959 Rewrite builders as records
This seems to be very slightly faster than using `reify`. Also rename 
the map builder to `as-maps` and add unqualified variants of builders.
2019-04-18 08:12:12 -07:00
Sean Corfield
86db20b94b Improve default behavior of reducible! when forced to create a row
Defaults to `map-row-builder`; add examples of `assoc`, 
`datafiable-row`.
2019-04-18 00:36:22 -07:00
Sean Corfield
50fbc5f8f1 Respect :gen-fn in execute-one 2019-04-18 00:28:23 -07:00
Sean Corfield
5019995feb Move SQL sugar functions to next.jdbc.sql
Make SQL string builder functions private.
2019-04-17 23:56:44 -07:00
Sean Corfield
a17054b61a Improve protocol documentation 2019-04-17 23:43:32 -07:00
Sean Corfield
b5eb5b880e Consolidate the three use cases
* Remove `execute!` and `execute-one!` from `result-set`.
* Add `-execute-all` and `-execute-one` to the `Executable` protocol 
instead.
* Remove `:row-fn` support.
* Allow a `PreparedStatement` to be `Connectable` so it can be used with 
`datafy`/`nav`.
* Rewrite `RowBuilder` protocol and add `ResultSetBuilder` protocol; add 
`as-arrays` as a builder.
2019-04-17 23:34:31 -07:00
Sean Corfield
788015909f First cut at RowBuilder
Temporarily disables as-arrays
2019-04-10 23:59:19 -07:00
Sean Corfield
d2f0afa973 Fix #9 by combining ->factory and create again 2019-04-10 21:46:38 -07:00
Sean Corfield
9abf9f6380 Fix update count key to :next.jdbc/update-count 2019-04-04 20:25:20 -07:00
Tommi Reiman
c7ebec1fa2 Manually destructure options 2019-04-02 22:37:53 +03:00
Sean Corfield
e85f627a00 Address #2 by solidifying row function API
Low-level `execute!` requires row function to be passed. High-level API 
allows row function, else `datafiable-row`. Syntactic sugar still uses 
`:row-fn`.
2019-04-02 00:41:39 -07:00
Sean Corfield
c2c9bcbba4 Address #1 by solidifying syntactic sugar functions
Cleans up how options are handled. Adds `query` alias for `execute!`, 
clarifiies the syntactic sugar nature of the additional functions.
2019-04-01 23:57:12 -07:00
Sean Corfield
a76189d9c8 Fix #4 by adding transact
`with-transaction` now delegates to `transact` which in turn delegates 
to `p/-transact`.
2019-04-01 23:43:10 -07:00
Sean Corfield
be9e4a6a55 Rename protocols
For internal consistency and also to avoid confusion with 
`clojure.java.jdbc` protocols.
2019-04-01 23:32:24 -07:00
Sean Corfield
6d1a42a0a0 Fix #6 by adding IReadColumn and ISQLParameter protocols
The latter can be extended via metadata but the former cannot (since 
only the latter is coming from Clojure).
2019-04-01 23:25:10 -07:00
Sean Corfield
4b81a42b4d Allow Sourceable to be overridden via metadata 2019-04-01 23:22:59 -07:00
Sean Corfield
f217e86038 Address #2 by adding rs/as-arrays 2019-04-01 22:19:02 -07:00
Sean Corfield
81be787316 Improve docstrings throughout 2019-04-01 21:31:38 -07:00
Sean Corfield
6e08557d92 Add docstrings to everything 2019-03-31 23:17:12 -07:00
Sean Corfield
8646472e79 Flesh out more SQL generators
Add high-level insert!, insert-multi!, update!, delete!

Add more examples to tests.
2019-03-31 19:30:01 -07:00
Sean Corfield
561ccfc621 Add simple SQL generators 2019-03-31 18:22:04 -07:00
Sean Corfield
31cbecf411 Improve function naming in prepare ns 2019-03-31 17:30:10 -07:00
Sean Corfield
38017d720d Move examples to tests for now 2019-03-31 17:29:40 -07:00
Sean Corfield
376856600e Add quoted entity functions 2019-03-31 17:29:21 -07:00
Sean Corfield
ac95379bce Reorganize into multiple namespaces 2019-03-31 16:54:34 -07:00
Sean Corfield
4d41faa8cd Restore :identifiers functionality 2019-03-30 23:31:35 -07:00
Sean Corfield
2cb3c20122 Renaming/cleanup 2019-03-30 23:13:01 -07:00
Sean Corfield
451a5fbd3b Handle generated keys 2019-03-30 23:12:37 -07:00
Sean Corfield
4741db1453 Fix column name when table name not known 2019-03-30 23:12:04 -07:00
Sean Corfield
69324ccbe6 in-transaction -> with-transaction 2019-03-30 23:11:37 -07:00
Sean Corfield
a44f59a468 Clean up Preparable; add Transactable 2019-03-30 20:36:53 -07:00
Sean Corfield
93eb286bd0 Optimize by removing destructuring 2019-01-26 02:05:25 -08:00
Sean Corfield
19ae37b3fe Add options back to get-connection
So we can do read-only, non-auto-commit connections
2019-01-26 01:59:37 -08:00
Sean Corfield
8d9289bd14 Optimizations
Strip options from datasource.
Implement full prepared statement.
Lift options handling.
2019-01-26 01:35:31 -08:00
Sean Corfield
a1d9d869d6 Add raw Java benchmark 2019-01-26 00:27:15 -08:00
Sean Corfield
c1e8b351a2 Drop options; add query-one/command! conveniences 2019-01-26 00:21:03 -08:00
Sean Corfield
781a6d19e1 Perform base reduce on update counts 2019-01-10 23:25:29 -08:00
Sean Corfield
eaffa2fd74 Dispatch execute! on a protocol
Improves performance. Handles the connect-with-connection problem.
Clean up formatting.
2019-01-10 19:23:35 -08:00
Sean Corfield
362dd5aac0 Avoid with-open call on Connection
This doesn't improve performance as much as I expected
2019-01-10 18:47:48 -08:00
Sean Corfield
aed569af61 Bug fix for empty params 2019-01-10 18:46:24 -08:00
Sean Corfield
70c22add30 Fix a few calls 2019-01-10 18:33:12 -08:00
Sean Corfield
7d9a53127d Add options to DataSource 2019-01-10 18:30:05 -08:00
Sean Corfield
73a7b2af10 Note: broken transaction machinery
After removing records and relying entirely on protocols, transaction handling is broken because you can't `assoc` into a non-map.
2019-01-10 18:24:55 -08:00
Sean Corfield
a5027066f9 Perf test query wrapper 2019-01-10 13:16:29 -08:00
Sean Corfield
01a13fe4fa Implement and test assoc on a row 2019-01-10 13:16:14 -08:00
Sean Corfield
5cb185f16e Tidy up 2019-01-10 13:15:58 -08:00
Sean Corfield
fc1ca82e4e Add a quick'n'dirty query function
For benchmarking overhead.
2019-01-10 11:44:19 -08:00
Sean Corfield
4ae5b44a52 Allow execute! on a PreparedStatement
Refactors reduce of prepared statement so it can be reused.
Remove options from `mapify-result-set` until option handling is figured out.
2019-01-10 11:35:17 -08:00
Sean Corfield
a99b4542ca Revert to as-is column names
At least until I figure out how options should flow through the whole stack.
2019-01-10 11:33:19 -08:00
Sean Corfield
85d400e28e Factor out set-parameters
This allows for a prepared statement to be reused for queries with different argument values.
2019-01-10 11:32:46 -08:00
Sean Corfield
d25171e434 Refactor spec / string to common code 2019-01-09 23:30:46 -08:00
Sean Corfield
320f40ecca Do more with protocols for performance 2019-01-09 23:05:21 -08:00
Sean Corfield
b321120518 Put CONTRIBUTING in the right place! 2019-01-09 22:07:57 -08:00
Sean Corfield
e7d0065ced Work in progress
Basic machinery is working: spec -> connection -> prepared statement -> execute -> reduce.

Everything is still very much in flux at this point.
2019-01-09 22:06:49 -08:00
Sean Corfield
8a44a8cbca Prepare for public viewing/contribution 2019-01-09 22:05:58 -08:00
Sean Corfield
954a1ed306 First functioning version of execute! 2019-01-07 23:03:20 -08:00
Sean Corfield
a8c1c37cfd Baseline project setup 2019-01-07 20:38:58 -08:00