mirror of
https://gitea.invidious.io/iv-org/shard-crystal-sqlite3.git
synced 2024-08-15 00:53:26 +00:00
Merge pull request #40 from crystal-lang/crystal/0.29.0
Upgrade to Crystal 0.29.0
This commit is contained in:
commit
57cef3acd3
5 changed files with 6 additions and 23 deletions
|
@ -10,4 +10,6 @@ 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
|
||||||
|
|
||||||
license: MIT
|
license: MIT
|
||||||
|
|
|
@ -35,7 +35,7 @@ DB::DriverSpecs(DB::Any).run do
|
||||||
sample_value 1.5, "float", "1.5"
|
sample_value 1.5, "float", "1.5"
|
||||||
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), "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
|
sample_value Time.utc(2016, 2, 15, 10, 15, 30), "text", "'2016-02-15 10:15:30.000'", type_safe_value: false
|
||||||
sample_value Time.new(2016, 2, 15, 7, 15, 30, location: Time::Location.fixed("fixed", -3*3600)), "text", "'2016-02-15 10:15:30.000'", type_safe_value: false
|
sample_value Time.local(2016, 2, 15, 7, 15, 30, location: Time::Location.fixed("fixed", -3*3600)), "text", "'2016-02-15 10:15:30.000'", type_safe_value: false
|
||||||
|
|
||||||
ary = UInt8[0x53, 0x51, 0x4C, 0x69, 0x74, 0x65]
|
ary = UInt8[0x53, 0x51, 0x4C, 0x69, 0x74, 0x65]
|
||||||
sample_value Bytes.new(ary.to_unsafe, ary.size), "blob", "X'53514C697465'" # , type_safe_value: false
|
sample_value Bytes.new(ary.to_unsafe, ary.size), "blob", "X'53514C697465'" # , type_safe_value: false
|
||||||
|
|
|
@ -19,13 +19,7 @@ describe Driver do
|
||||||
assert_filename("sqlite3:/path/to/file.db", "/path/to/file.db")
|
assert_filename("sqlite3:/path/to/file.db", "/path/to/file.db")
|
||||||
assert_filename("sqlite3:///path/to/file.db", "/path/to/file.db")
|
assert_filename("sqlite3:///path/to/file.db", "/path/to/file.db")
|
||||||
|
|
||||||
{% if compare_versions(Crystal::VERSION, "0.28.0") >= 0 %}
|
assert_filename("sqlite3:./file.db?max_pool_size=5", "./file.db")
|
||||||
# Before 0.28.0 the filename had the query string in this case
|
|
||||||
# but it didn't bother when deleting the file in pool_spec.cr.
|
|
||||||
# After 0.28.0 the behavior is changed, but can't be fixed prior that
|
|
||||||
# due to the use of URI#opaque.
|
|
||||||
assert_filename("sqlite3:./file.db?max_pool_size=5", "./file.db")
|
|
||||||
{% end %}
|
|
||||||
assert_filename("sqlite3:/path/to/file.db?max_pool_size=5", "/path/to/file.db")
|
assert_filename("sqlite3:/path/to/file.db?max_pool_size=5", "/path/to/file.db")
|
||||||
assert_filename("sqlite3://./file.db?max_pool_size=5", "./file.db")
|
assert_filename("sqlite3://./file.db?max_pool_size=5", "./file.db")
|
||||||
assert_filename("sqlite3:///path/to/file.db?max_pool_size=5", "/path/to/file.db")
|
assert_filename("sqlite3:///path/to/file.db?max_pool_size=5", "/path/to/file.db")
|
||||||
|
|
|
@ -21,12 +21,7 @@ describe DB::Pool do
|
||||||
fibers.times { channel.receive }
|
fibers.times { channel.receive }
|
||||||
|
|
||||||
# all numbers were inserted
|
# all numbers were inserted
|
||||||
s : Int32
|
s = fibers * max_n * (max_n + 1) // 2
|
||||||
{% if compare_versions(Crystal::VERSION, "0.28.0") >= 0 %}
|
|
||||||
s = fibers * max_n * (max_n + 1) // 2
|
|
||||||
{% else %}
|
|
||||||
s = fibers * max_n * (max_n + 1) / 2
|
|
||||||
{% end %}
|
|
||||||
db.scalar("select sum(n) from numbers").should eq(s)
|
db.scalar("select sum(n) from numbers").should eq(s)
|
||||||
|
|
||||||
# numbers were not inserted one fiber at a time
|
# numbers were not inserted one fiber at a time
|
||||||
|
|
|
@ -9,15 +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.28.0") >= 0 %}
|
URI.unescape((uri.host || "") + uri.path)
|
||||||
URI.unescape((uri.host || "") + uri.path)
|
|
||||||
{% else %}
|
|
||||||
URI.unescape (if path = uri.path
|
|
||||||
(uri.host || "") + path
|
|
||||||
else
|
|
||||||
uri.opaque.not_nil!
|
|
||||||
end)
|
|
||||||
{% end %}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_prepared_statement(query)
|
def build_prepared_statement(query)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue