Commit graph

206 commits

Author SHA1 Message Date
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
Ary Borenszweig
2fc3f66a00 Make sure to return the connection to the pool in case of an exception preparing a query 2016-06-29 15:01:26 -03:00
Brian J. Cardiff
22a5a41534 update readme 2016-06-27 14:11:54 -03:00
Brian J. Cardiff
61c4b03252 update README.md due to transfer to crystal-lang 2016-06-24 17:27:06 -03:00
Brian J. Cardiff
56f5bffe31 Update README.md 2016-06-24 10:59:33 -03:00
Brian J. Cardiff
6838784f7b fix #1. avoid marking as closed if do_close raise exception 2016-06-24 10:54:30 -03:00
Brian J. Cardiff
933014c1aa fix bug related to Slice(T).new(0). It was messing with the data in the stack 2016-06-23 22:36:34 -03:00
Brian J. Cardiff
b2da4f3f6e allow scalar to return custom types 2016-06-23 22:19:53 -03:00
Brian J. Cardiff
34ae9d5775 avoid messing with finalize cycle in Disposable.
ensure statements are closed when connection is closed
2016-06-23 22:07:59 -03:00
Brian J. Cardiff
f836bbfccb add Database#using_connection to get a connection from the pool and return it when work is done. 2016-06-23 17:27:30 -03:00
Brian J. Cardiff
22db7d1043 fixes #5. Merge branch 'feature/5-type-extensibility' 2016-06-23 15:12:20 -03:00
Brian J. Cardiff
8025ecaa13 update Slice(UInt8) to Bytes 2016-06-22 14:10:09 -03:00
Brian J. Cardiff
11e24e1c65 #5 Make sure queries (insert and query) work with any type 2016-06-22 00:44:16 -03:00
Brian J. Cardiff
c5d7778a0d update DB::ExecResult#rows_affected to Int64 2016-06-21 18:31:13 -03:00
Brian J. Cardiff
9f3f0a9836 #5 remove read_object. allow read / read? to receive any type 2016-06-21 12:10:09 -03:00
Brian J. Cardiff
0daa1c18d7 DRY DB::TYPES and DB::Any 2016-06-21 12:08:51 -03:00
Brian J. Cardiff
76e3a35d59 allow exec to receive any object arguments 2016-06-21 10:55:44 -03:00
Brian J. Cardiff
d4b2046a65 refactor and add specs for query without blocks 2016-06-21 10:55:44 -03:00
Brian J. Cardiff
3464a1d1cc allow query to receive any object arguments 2016-06-21 10:55:41 -03:00
Brian J. Cardiff
5b23114095 add ResultSet#read_object 2016-06-21 10:54:58 -03:00
Brian J. Cardiff
312609b722 allow specs to use multiple drivers 2016-06-21 10:54:56 -03:00
Brian J. Cardiff
d69555b372 make Nil a proper column type 2016-06-21 10:53:34 -03:00
Ary Borenszweig
f834b0f8a6 Updated to Crystal 0.17.4 2016-06-16 12:16:39 -03:00
Brian J. Cardiff
6ee8c90ba7 forward declarations for docrystal.org (?) 2016-02-26 00:13:29 -03:00
Brian J. Cardiff
71629f2a6f travis badge
fix roadmap list
2016-02-26 00:06:37 -03:00
Brian J. Cardiff
c6e2a51482 add readme and version 2016-02-25 23:53:23 -03:00
Brian J. Cardiff
44559f6f95 move spec and src files to a shardy way 2016-02-25 22:37:10 -03:00
Brian J. Cardiff
928c1517dc update to 0.12 features
clarify expected protocol with ResultSet in docs
minor refactors suggested
2016-02-25 22:27:42 -03:00
Brian J. Cardiff
2cb37d374c ensure db is closed after block
avoid GC Warning
2016-02-25 22:27:42 -03:00
Brian J. Cardiff
ee21fcfea6 update docs 2016-02-25 22:27:42 -03:00
Brian J. Cardiff
0cb7adabdb full type name in restriction 2016-02-25 22:27:42 -03:00
Brian J. Cardiff
4ed7f28fe6 ensure exec and scalar release connection
ensure exec, query can be executed with Enumerable(Any)
update db doc sample
2016-02-25 22:27:42 -03:00
Brian J. Cardiff
d45427dfdd expose database in connection
get/return from pool while result set is been used. still single connection pool
2016-02-25 22:27:42 -03:00
Brian J. Cardiff
fa111fd698 add statement cache in connection.
hide methods from api
2016-02-25 22:27:42 -03:00
Brian J. Cardiff
562d5076bf use URI as connection string 2016-02-25 22:27:42 -03:00
Brian J. Cardiff
b92d08bf74 refactor db disposables 2016-02-25 22:27:42 -03:00
Brian J. Cardiff
782a2ee0e2 hide #prepare from api. 2016-02-25 22:27:42 -03:00
Brian J. Cardiff
6a5b2a8758 assert connection is closed after db is used.
tidy up close methods
2016-02-25 22:27:35 -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
a96776e336 use connection_string as database configuration instead of a hash 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
Brian J. Cardiff
1fb0b8a82b add ResultSet#exec to ensure the query is performed. By default generates a move_next. 2016-02-25 22:25:54 -03:00
Brian J. Cardiff
683e6bdfa7 major db refactor for a better api.
`#query`, `#exec`, `#scalar`, `#scalar?` as main query methods from `Database`
blocks overrides that ensure statements are closed.
2016-02-25 22:25:54 -03:00
Brian J. Cardiff
caf2676aad column_count and column_names
close result_set and statements
main entry points for exec_non_query and exec_query closing them when ready
2016-02-25 22:25:54 -03:00
Brian J. Cardiff
e50cc4ec73 add specs for statement arguments
add support for blobs (i.e. Slice(UInt8) )
2016-02-25 22:25:54 -03:00