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:
db:
github: crystal-lang/crystal-db
version: ~> 0.5.0
version: ~> 0.6.0
authors:
- Ary Borenszweig <aborenszweig@manas.tech>

View file

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

View file

@ -1,5 +1,5 @@
class SQLite3::Driver < DB::Driver
def build_connection(context : DB::ConnectionContext)
def build_connection(context : DB::ConnectionContext) : SQLite3::Connection
SQLite3::Connection.new(context)
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,
# `false` otherwise. Must be called at least once to advance to the first
# row.
def move_next
def move_next : Bool
@column_index = 0
case step
@ -79,11 +79,11 @@ class SQLite3::ResultSet < DB::ResultSet
read(Int64?).try &.!=(0)
end
def column_count
def column_count : Int32
LibSQLite3.column_count(self)
end
def column_name(index)
def column_name(index) : String
String.new LibSQLite3.column_name(self, index)
end