Skip to content

Commit

Permalink
Merge pull request #43 from crystal-lang/crystal/v0.30.0
Browse files Browse the repository at this point in the history
Upgrade to Crystal v0.30.0
  • Loading branch information
Brian J. Cardiff authored Aug 2, 2019
2 parents 54089ef + c363665 commit 611eec5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Expand Down
10 changes: 7 additions & 3 deletions src/sqlite3/connection.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sqlite3/driver.cr
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/sqlite3/result_set.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 611eec5

Please sign in to comment.