Update for crystal 0.25.0

This commit is contained in:
Anton Maminov 2018-06-17 00:15:43 +03:00
parent 13916070e0
commit 524d4e0108
2 changed files with 6 additions and 4 deletions

View file

@ -33,8 +33,8 @@ DB::DriverSpecs(DB::Any).run do
sample_value "hello", "text", "'hello'"
sample_value 1.5_f32, "float", "1.5", type_safe_value: false
sample_value 1.5, "float", "1.5"
sample_value Time.new(2016, 2, 15), "text", "'2016-02-15 00:00:00.000'", type_safe_value: false
sample_value Time.new(2016, 2, 15, 10, 15, 30), "text", "'2016-02-15 10:15:30.000'", type_safe_value: false
sample_value Time.utc(2016, 2, 15), "text", "'2016-02-15 00:00:00.000'", type_safe_value: false
sample_value Time.utc(2016, 2, 15, 10, 15, 30), "text", "'2016-02-15 10:15:30.000'", type_safe_value: false
ary = UInt8[0x53, 0x51, 0x4C, 0x69, 0x74, 0x65]
sample_value Bytes.new(ary.to_unsafe, ary.size), "blob", "X'53514C697465'" # , type_safe_value: false

View file

@ -64,11 +64,13 @@ class SQLite3::ResultSet < DB::ResultSet
end
def read(t : Time.class) : Time
Time.parse read(String), SQLite3::DATE_FORMAT
Time.parse(read(String), SQLite3::DATE_FORMAT, Time::Location::UTC)
end
def read(t : Time?.class) : Time?
read(String?).try { |v| Time.parse(v, SQLite3::DATE_FORMAT) }
read(String?).try do |v|
Time.parse(v, SQLite3::DATE_FORMAT, Time::Location::UTC)
end
end
def read(t : Bool.class) : Bool