diff --git a/shard.yml b/shard.yml index ab6137d..3dc0b45 100644 --- a/shard.yml +++ b/shard.yml @@ -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 diff --git a/src/sqlite3/connection.cr b/src/sqlite3/connection.cr index d02a875..5079c3c 100644 --- a/src/sqlite3/connection.cr +++ b/src/sqlite3/connection.cr @@ -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 diff --git a/src/sqlite3/driver.cr b/src/sqlite3/driver.cr index 1ab8430..d43a512 100644 --- a/src/sqlite3/driver.cr +++ b/src/sqlite3/driver.cr @@ -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 diff --git a/src/sqlite3/result_set.cr b/src/sqlite3/result_set.cr index ce116db..38e669f 100644 --- a/src/sqlite3/result_set.cr +++ b/src/sqlite3/result_set.cr @@ -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