Commit Graph

23 Commits

Author SHA1 Message Date
Brian J. Cardiff 511fe20253
Use DB::NoResultsError on QueryMethods (#125) 2020-04-06 18:36:37 -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 adc755e5e4
Add type argument to QueryMethods module (#108) 2019-08-02 11:54:52 -03:00
Benjamin T 3820978820 query_methods.cr: Small typo fix in docs (#76) 2018-11-07 15:44:53 -03:00
Rob David c54fab415e Fixes query_one? handling no rows (#86) 2018-07-11 00:47:39 +01:00
Arthur Poulet d55a34e851 Allow query results to be read as named tuples directly (#56) 2017-12-29 19:32:25 -03:00
Brian J. Cardiff 1e882e35d2 Docs: minor edit 2017-09-08 10:08:24 -03:00
Brian J. Cardiff 39e17f82ca Add #query_each . Fixes #18 2017-04-10 12:48:48 -03:00
Brian J. Cardiff 5697bd5c58 Fix docs 2017-04-10 12:47:38 -03:00
Brian J. Cardiff eb82b96c0d update to crystal 0.20.3
* add missing forall annotations
2016-12-24 20:39:40 -03:00
Brian J. Cardiff fe0ed55ef9 introduce unprepared statements
* rename QueryMethods#prepare to QueryMethods#build
* rename Connection#build_statement to Connection#build_prepared_statement
* add Connection#build_unprepared_statement
* add Connection #prepared and #unprepared dsl methods
2016-12-07 01:50:06 -03:00
Brian J. Cardiff 325fa9d4ae ensure the connection is released after exec
avoid releasing connection twice on exec.
avoid releasing connection when QueryMethod#query is blockless called.
2016-08-29 01:23:20 -03:00
Ary Borenszweig 9c88f718e8 Require ResultSet to just implement `read`, optionally implementing `read(T.class)`. Fixes #5 2016-06-30 09:46:25 -03:00
Ary Borenszweig 038ffef33a Don't use tap so return value is that of `yield` 2016-06-29 16:54:16 -03:00
Ary Borenszweig 72431bb1d8 Make sure to release a statmenet in case of an exception 2016-06-29 15:08:53 -03:00
Brian J. Cardiff b2da4f3f6e allow scalar to return custom types 2016-06-23 22:19:53 -03:00
Brian J. Cardiff 76e3a35d59 allow exec to receive any object arguments 2016-06-21 10:55:44 -03:00
Brian J. Cardiff ee21fcfea6 update docs 2016-02-25 22:27:42 -03:00
Brian J. Cardiff 3598dddb65 split perform_query and perform_exec
add DB::ExecResult to have a concurrency safety exec result
remove connection string from abstract DB::Connection
2016-02-25 22:25:55 -03:00
Brian J. Cardiff 67fe5c9aae leave a single scalar value returns DB::Any 2016-02-25 22:25:55 -03:00
Brian J. Cardiff d01da912f7 code review notes
close / do_close in result_set
avoid closing statements
remove named arguments
refactor positioned arguments query
2016-02-25 22:25:55 -03:00
Brian J. Cardiff fd804dd592 switch to 0-pased positional arguments
add docs, many docs
2016-02-25 22:25:55 -03:00
Brian J. Cardiff 8c0313a306 add Connection#last_inserted_id
extract QueryMethods modules and use it in Database and Connection
"add" finalize methods, but they cause GC warnings
2016-02-25 22:25:55 -03:00