mirror of
https://gitea.invidious.io/iv-org/shard-crystal-sqlite3.git
synced 2024-08-15 00:53:26 +00:00
fixed issue with time when used DB::ResultSet#read(Time)
This commit is contained in:
parent
b66dd5c337
commit
b0799b1d03
2 changed files with 12 additions and 1 deletions
|
@ -186,6 +186,17 @@ describe Driver do
|
|||
end
|
||||
end
|
||||
|
||||
it "insert/get value date from table using DB::ResultSet" do
|
||||
with_db do |db|
|
||||
value = Time.new(2016, 7, 22, 15, 0, 0, 0)
|
||||
db.exec "create table table1 (col1 #{sqlite_type_for(value)})"
|
||||
db.exec %(insert into table1 values (?)), value
|
||||
rs = db.query("select col1 from table1").as(DB::ResultSet)
|
||||
rs.move_next
|
||||
rs.read(Time).should eq(value)
|
||||
end
|
||||
end
|
||||
|
||||
it "raises on unsupported param types" do
|
||||
with_db do |db|
|
||||
expect_raises Exception, "SQLite3::Statement does not support NotSupportedType params" do
|
||||
|
|
|
@ -44,7 +44,7 @@ class SQLite3::ResultSet < DB::ResultSet
|
|||
raise Exception.new(sqlite3_statement.sqlite3_connection)
|
||||
end
|
||||
@column_index += 1
|
||||
value
|
||||
value.as(Float64 | Int64 | Slice(UInt8) | String | Time | Nil)
|
||||
end
|
||||
|
||||
def read(t : Int32.class) : Int32
|
||||
|
|
Loading…
Reference in a new issue