Skip to content

Commit 412ecf9

Browse files
committed
fixing warnings
1 parent 7831a95 commit 412ecf9

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

ext/sqlite3/statement.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ static VALUE initialize(VALUE self, VALUE db, VALUE sql)
6363

6464
rb_iv_set(self, "@connection", db);
6565
rb_iv_set(self, "@remainder", rb_str_new2(tail));
66+
rb_iv_set(self, "@columns", Qnil);
67+
rb_iv_set(self, "@types", Qnil);
6668

6769
return self;
6870
}

lib/sqlite3/database.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def execute( sql, *bind_vars )
110110
if block_given?
111111
result.each { |row| yield row }
112112
else
113-
return result.inject( [] ) { |arr,row| arr << row; arr }
113+
result.inject( [] ) { |arr,row| arr << row; arr }
114114
end
115115
end
116116
end

lib/sqlite3/statement.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def bind_params( *bind_vars )
6565
# See also #bind_params, #execute!.
6666
def execute( *bind_vars )
6767
must_be_open!
68-
reset! if active?
68+
reset! if active? || done?
6969

7070
bind_params(*bind_vars) unless bind_vars.empty?
7171
@results = ResultSet.new(@connection, self)
@@ -96,7 +96,7 @@ def execute! *bind_vars, &block
9696
# Returns true if the statement is currently active, meaning it has an
9797
# open result set.
9898
def active?
99-
not @results.nil?
99+
!done?
100100
end
101101

102102
# Return an array of the column names for this statement. Note that this
@@ -120,7 +120,7 @@ def each
120120
# makes it a (potentially) expensive operation.
121121
def types
122122
must_be_open!
123-
get_metadata unless defined?(@types)
123+
get_metadata unless @types
124124
@types
125125
end
126126

0 commit comments

Comments
 (0)