Commit Graph

14 Commits

Author SHA1 Message Date
Brian J. Cardiff 1d0105ffeb
Gracefully allow spec helper to fail on older crystal (#202) 2023-12-17 20:03:45 -03:00
Lachlan Dowding a527cfdc4e
Fix `DB::DriverSpecs#with_db` `connection_string` query param support (#192) 2023-10-31 10:10:25 -03:00
Brian J. Cardiff f13846b133
Refactor connection factory (#181)
* 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>
2023-06-22 22:03:08 -03:00
Jeremy Woertink b1299fcada
Raise a specific class error instead of string literal (#156)
* 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>
2021-10-12 20:49:26 -03:00
Brian J. Cardiff af200eac54 Comply exhaustive case check
Comply exhaustive case check
2020-04-02 12:34:27 -03:00
Johannes Müller b3898ae2a2 Statement#exec and #query require named argument for array values (#110)
This change allows to use an array as single argument for #exec and
 #query and #scalar methods. Before it was shadowed by the *args splat overload.
2019-09-20 17:23:09 -03:00
Brian J. Cardiff af6d837bcd
Remove call to obsolete Spec.matches? (#111)
It was an optimization but it does not work (and is not needed) since the changes in spec for Crystal 0.31
2019-09-12 11:04:34 -03:00
Brian J. Cardiff 6c7aea0528 docs & formatting 2017-04-10 10:28:17 -03:00
Brian J. Cardiff 456ff5aa36 Add specs to use ResultSet as DB::ResultSet 2017-04-06 15:57:27 -03:00
Brian J. Cardiff 074368a47e Add drop table syntax
* Allows to run all test in same database by deleting tables if exists
2017-04-06 15:57:27 -03:00
Brian J. Cardiff 07b4e9f4a8 Minor fixes. Use some type for `.scalar("select ?", nil)` 2017-04-06 15:57:27 -03:00
Brian J. Cardiff dba3c03da8 Include sql_type for sql_scalar when available. 2017-04-06 15:57:27 -03:00
Brian J. Cardiff 168aac142c switch for prepared/unprepared specs. pass ColumnDefs instead of names 2017-04-06 15:57:27 -03:00
Brian J. Cardiff f80e689c87 common specs extracted from crystal-mysql 2017-04-06 15:57:27 -03:00