Update crystal-db ~> 0.10.0 and Crystal 0.35.0 for logging support (#58)

* Update crystal-db for logging support

* Update sample

* Update to crystal-db ~> 0.10.0
This commit is contained in:
Brian J. Cardiff 2020-09-30 11:34:25 -03:00 committed by GitHub
parent 5f6055f4bd
commit 8586182fd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 11 deletions

View file

@ -8,7 +8,7 @@ DB.open "sqlite3://%3Amemory%3A" do |db|
args = [] of DB::Any
args << "Sarah"
args << 33
db.exec "insert into contacts values (?, ?)", args
db.exec "insert into contacts values (?, ?)", args: args
puts "max age:"
puts db.scalar "select max(age) from contacts" # => 33

View file

@ -4,12 +4,12 @@ version: 0.16.0
dependencies:
db:
github: crystal-lang/crystal-db
version: ~> 0.9.0
version: ~> 0.10.0
authors:
- Ary Borenszweig <aborenszweig@manas.tech>
- Brian J. Cardiff <bcardiff@manas.tech>
crystal: 0.28.0
crystal: 0.35.0
license: MIT

View file

@ -9,11 +9,7 @@ class SQLite3::Connection < DB::Connection
end
def self.filename(uri : URI)
{% if compare_versions(Crystal::VERSION, "0.30.0-0") >= 0 %}
URI.decode_www_form((uri.host || "") + uri.path)
{% else %}
URI.unescape((uri.host || "") + uri.path)
{% end %}
URI.decode_www_form((uri.host || "") + uri.path)
end
def build_prepared_statement(query) : Statement

View file

@ -1,7 +1,7 @@
class SQLite3::Statement < DB::Statement
def initialize(connection, sql)
super(connection)
check LibSQLite3.prepare_v2(sqlite3_connection, sql, sql.bytesize + 1, out @stmt, nil)
def initialize(connection, command)
super(connection, command)
check LibSQLite3.prepare_v2(sqlite3_connection, command, command.bytesize + 1, out @stmt, nil)
end
protected def perform_query(args : Enumerable) : DB::ResultSet