mirror of
https://gitea.invidious.io/iv-org/shard-crystal-sqlite3.git
synced 2024-08-15 00:53:26 +00:00
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:
parent
5f6055f4bd
commit
8586182fd8
4 changed files with 7 additions and 11 deletions
|
@ -8,7 +8,7 @@ DB.open "sqlite3://%3Amemory%3A" do |db|
|
||||||
args = [] of DB::Any
|
args = [] of DB::Any
|
||||||
args << "Sarah"
|
args << "Sarah"
|
||||||
args << 33
|
args << 33
|
||||||
db.exec "insert into contacts values (?, ?)", args
|
db.exec "insert into contacts values (?, ?)", args: args
|
||||||
|
|
||||||
puts "max age:"
|
puts "max age:"
|
||||||
puts db.scalar "select max(age) from contacts" # => 33
|
puts db.scalar "select max(age) from contacts" # => 33
|
||||||
|
|
|
@ -4,12 +4,12 @@ version: 0.16.0
|
||||||
dependencies:
|
dependencies:
|
||||||
db:
|
db:
|
||||||
github: crystal-lang/crystal-db
|
github: crystal-lang/crystal-db
|
||||||
version: ~> 0.9.0
|
version: ~> 0.10.0
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- Ary Borenszweig <aborenszweig@manas.tech>
|
- Ary Borenszweig <aborenszweig@manas.tech>
|
||||||
- Brian J. Cardiff <bcardiff@manas.tech>
|
- Brian J. Cardiff <bcardiff@manas.tech>
|
||||||
|
|
||||||
crystal: 0.28.0
|
crystal: 0.35.0
|
||||||
|
|
||||||
license: MIT
|
license: MIT
|
||||||
|
|
|
@ -9,11 +9,7 @@ class SQLite3::Connection < DB::Connection
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.filename(uri : URI)
|
def self.filename(uri : URI)
|
||||||
{% if compare_versions(Crystal::VERSION, "0.30.0-0") >= 0 %}
|
URI.decode_www_form((uri.host || "") + uri.path)
|
||||||
URI.decode_www_form((uri.host || "") + uri.path)
|
|
||||||
{% else %}
|
|
||||||
URI.unescape((uri.host || "") + uri.path)
|
|
||||||
{% end %}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_prepared_statement(query) : Statement
|
def build_prepared_statement(query) : Statement
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class SQLite3::Statement < DB::Statement
|
class SQLite3::Statement < DB::Statement
|
||||||
def initialize(connection, sql)
|
def initialize(connection, command)
|
||||||
super(connection)
|
super(connection, command)
|
||||||
check LibSQLite3.prepare_v2(sqlite3_connection, sql, sql.bytesize + 1, out @stmt, nil)
|
check LibSQLite3.prepare_v2(sqlite3_connection, command, command.bytesize + 1, out @stmt, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected def perform_query(args : Enumerable) : DB::ResultSet
|
protected def perform_query(args : Enumerable) : DB::ResultSet
|
||||||
|
|
Loading…
Reference in a new issue