Update to crystal-db ~> 0.4.1

Replace driver_spec for db/spec.
Fix read(T?) for T = Int32, Flaot32, Time, Bool..
Fixes #19
This commit is contained in:
Brian J. Cardiff 2017-04-05 16:37:06 -03:00
parent b66dd5c337
commit 5eb85a98c6
4 changed files with 139 additions and 278 deletions

View file

@ -51,18 +51,34 @@ class SQLite3::ResultSet < DB::ResultSet
read(Int64).to_i32
end
def read(type : Int32?.class) : Int32?
read(Int64?).try &.to_i32
end
def read(t : Float32.class) : Float32
read(Float64).to_f32
end
def read(type : Float32?.class) : Float32?
read(Float64?).try &.to_f32
end
def read(t : Time.class) : Time
Time.parse read(String), SQLite3::DATE_FORMAT
end
def read(t : Time?.class) : Time?
read(String?).try { |v| Time.parse(v, SQLite3::DATE_FORMAT) }
end
def read(t : Bool.class) : Bool
read(Int64) != 0
end
def read(t : Bool?.class) : Bool?
read(Int64?).try &.!=(0)
end
def column_count
LibSQLite3.column_count(self)
end