Merge pull request #43 from crystal-lang/crystal/v0.30.0

Upgrade to Crystal v0.30.0
This commit is contained in:
Brian J. Cardiff 2019-08-02 12:25:30 -03:00 committed by GitHub
commit 611eec5aed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View File

@ -4,7 +4,7 @@ version: 0.12.0
dependencies: dependencies:
db: db:
github: crystal-lang/crystal-db github: crystal-lang/crystal-db
version: ~> 0.5.0 version: ~> 0.6.0
authors: authors:
- Ary Borenszweig <aborenszweig@manas.tech> - Ary Borenszweig <aborenszweig@manas.tech>

View File

@ -9,14 +9,18 @@ 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)
{% else %}
URI.unescape((uri.host || "") + uri.path) URI.unescape((uri.host || "") + uri.path)
{% end %}
end end
def build_prepared_statement(query) def build_prepared_statement(query) : Statement
Statement.new(self, query) Statement.new(self, query)
end end
def build_unprepared_statement(query) def build_unprepared_statement(query) : Statement
# sqlite3 does not support unprepared statement. # sqlite3 does not support unprepared statement.
# All statements once prepared should be released # All statements once prepared should be released
# when unneeded. Unprepared statement are not aim # when unneeded. Unprepared statement are not aim

View File

@ -1,5 +1,5 @@
class SQLite3::Driver < DB::Driver class SQLite3::Driver < DB::Driver
def build_connection(context : DB::ConnectionContext) def build_connection(context : DB::ConnectionContext) : SQLite3::Connection
SQLite3::Connection.new(context) SQLite3::Connection.new(context)
end end
end end

View File

@ -9,7 +9,7 @@ class SQLite3::ResultSet < DB::ResultSet
# Advances to the next row. Returns `true` if there's a next row, # Advances to the next row. Returns `true` if there's a next row,
# `false` otherwise. Must be called at least once to advance to the first # `false` otherwise. Must be called at least once to advance to the first
# row. # row.
def move_next def move_next : Bool
@column_index = 0 @column_index = 0
case step case step
@ -79,11 +79,11 @@ class SQLite3::ResultSet < DB::ResultSet
read(Int64?).try &.!=(0) read(Int64?).try &.!=(0)
end end
def column_count def column_count : Int32
LibSQLite3.column_count(self) LibSQLite3.column_count(self)
end end
def column_name(index) def column_name(index) : String
String.new LibSQLite3.column_name(self, index) String.new LibSQLite3.column_name(self, index)
end end