* Add pool_concurrency_test manual spec
Add MT connection count without Mutex
* Drop checkout_some, simpler pool_prepared statement
* Make pool statement a struct
* Drop StringKeyCache mutex
The StringKeyCache is now only used inside a connection. It's assumed that connections are not used concurrently with multiple queries.
* Drop do_close in pool statements
* Add specs and update comment
* Fix typo
* Start moving out URI from ConnectionContext
Create connections with an initial context. Database will set itself as context after connection has been created
* Migrate to simpler/decoupled factory in driver
This allows more freedom on how the connection is created. It will no longer need to have an explicit reference to the connection URI
* Introduce DB::Connection::Options
Move prepared_statements out from ConnectionContext
* Delegate options parsing to driver
DRY parsing connection options for database
* Introduce DB::Pool::Options
* Rename Driver#connection_pool_options to pool_options
* Drop driver getter from database
* Drop uri getter from database
* Add public Database#initialize method
* Drop :nodoc: Database#initialize
* Pass spec helper explicitly (to access methods within each spec)
* Update docs
* Update src/db/pool.cr
Co-authored-by: Beta Ziliani <beta@manas.tech>
* Use ConnectionBuilder instead of procs
* Fix inferred type when there is a single concrete connection type
* Update src/db/driver.cr
Co-authored-by: Beta Ziliani <beta@manas.tech>
---------
Co-authored-by: Beta Ziliani <beta@manas.tech>
* Returns block's value on #transaction method
* Update src/db/begin_transaction.cr
Co-authored-by: Johannes Müller <straightshoota@gmail.com>
Co-authored-by: Johannes Müller <straightshoota@gmail.com>
* Raise a specific class error instead of string literal when the type returned doesn't match the type expected. Allows for drivers to catch the specific error.
* Add ResultSet#next_column_index
* Add shared specs for next_column_index
* Add properties to ColumnTypeMismatchError
* Add shared specs for ColumnTypeMismatchError
* Fix specs
Co-authored-by: Brian J. Cardiff <bcardiff@gmail.com>
* Add logging for executing queries
Arguments are translated to Log::Metadata::Value via DB::Statement#arg_to_log method.
DB::Statement#before_query_or_exec & after_query_or_exec protected methods can be used to hook and run around the statement execution
* Move the metadata converter to a module
* Replace before/after with def_around_query_or_exec macro
* Update src/db/enumerable_concat.cr
Co-authored-by: Ary Borenszweig <asterite@gmail.com>
Co-authored-by: Ary Borenszweig <asterite@gmail.com>
* Allow DB::Pool to be a generic connection pool
* Use fully qualified class name for consistency
Co-authored-by: Brian J. Cardiff <bcardiff@gmail.com>
* Wrap only the necessary code in an `ensure`
* Add spec for http client pool
* Fix ICE in crystal-sqlite3
Co-authored-by: Brian J. Cardiff <bcardiff@gmail.com>