From 058c78f837136f127a4f9b8287cf790460992674 Mon Sep 17 00:00:00 2001 From: "Brian J. Cardiff" Date: Mon, 29 Jul 2019 10:25:46 -0300 Subject: [PATCH 1/3] Annotate return types of abstract methods --- src/sqlite3/connection.cr | 4 ++-- src/sqlite3/driver.cr | 2 +- src/sqlite3/result_set.cr | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sqlite3/connection.cr b/src/sqlite3/connection.cr index d02a875..756ec49 100644 --- a/src/sqlite3/connection.cr +++ b/src/sqlite3/connection.cr @@ -12,11 +12,11 @@ class SQLite3::Connection < DB::Connection URI.unescape((uri.host || "") + uri.path) 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 From 5303492839bf3ab4a9196e5159b80362e1a4c77a Mon Sep 17 00:00:00 2001 From: "Brian J. Cardiff" Date: Tue, 30 Jul 2019 19:17:06 -0300 Subject: [PATCH 2/3] Upgrade to Crystal v0.30.0 --- src/sqlite3/connection.cr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sqlite3/connection.cr b/src/sqlite3/connection.cr index 756ec49..5079c3c 100644 --- a/src/sqlite3/connection.cr +++ b/src/sqlite3/connection.cr @@ -9,7 +9,11 @@ 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) : Statement From c363665bba1f3d06dfedeccf78aeaa2aff818d45 Mon Sep 17 00:00:00 2001 From: "Brian J. Cardiff" Date: Fri, 2 Aug 2019 12:21:27 -0300 Subject: [PATCH 3/3] Update to crystal-db ~> 0.6.0 --- shard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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