Skip to content

Commit 6a1a2fe

Browse files
authored
Merge pull request #403 from sparklemotion/flavorjones-cleanup-20230909
some general cleanup
2 parents 77e902d + 9869a5d commit 6a1a2fe

16 files changed

+57
-56
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
- package-ecosystem: "bundler"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.github/workflows/sqlite3-ruby.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
steps:
8787
- run: |
8888
dnf group install -y "C Development Tools and Libraries"
89-
dnf install -y ruby ruby-devel
89+
dnf install -y ruby ruby-devel libyaml-devel
9090
- uses: actions/checkout@v3
9191
- run: bundle install
9292
- run: bundle exec rake compile -- --disable-system-libraries

CONTRIBUTING.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ A quick checklist:
2727

2828
- [ ] make sure CI is green!
2929
- [ ] update `CHANGELOG.md` and `lib/sqlite3/version.rb` including `VersionProxy::{MINOR,TINY}`
30-
- [ ] create a git tag using a format that matches the pattern `v\d+\.\d+\.\d+`, e.g. `v1.3.13`
3130
- [ ] run `bin/build-gems` and make sure it completes and all the tests pass
31+
- [ ] create a git tag using a format that matches the pattern `v\d+\.\d+\.\d+`, e.g. `v1.3.13`
32+
- [ ] `git push && git push --tags`
3233
- [ ] `for g in gems/*.gem ; do gem push $g ; done`
3334
- [ ] create a release at https://github.com/sparklemotion/sqlite3-ruby/releases and include sha2 checksums

Gemfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ source "https://rubygems.org"
22

33
gemspec
44

5-
gem("minitest", "~> 5.15")
6-
gem("rake-compiler", "~> 1.2.0")
5+
gem("minitest", "5.20.0")
6+
gem("rake-compiler", "1.2.5")
77
gem("rake-compiler-dock", "1.3.0")
8-
gem("rdoc", ">= 4.0", "< 7")
9-
gem("psych", "~> 4.0") # psych 5 doesn't build on some CI platforms yet
8+
gem("rdoc", "6.5.0")
9+
gem("psych", "5.1.0")
1010

11-
gem("ruby_memcheck") if Gem::Platform.local.os == "linux"
11+
gem("ruby_memcheck", "2.1.2") if Gem::Platform.local.os == "linux"

bin/build-gems

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ bundle exec rake compile test
1919

2020
# package the gems, including precompiled native
2121
bundle exec rake clean clobber
22-
bundle exec rake gem:all
22+
bundle exec rake -m gem:all
2323
cp -v pkg/sqlite3*.gem gems
2424

2525
# test those gem files!

ext/sqlite3/database.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static VALUE total_changes(VALUE self)
127127
Data_Get_Struct(self, sqlite3Ruby, ctx);
128128
REQUIRE_OPEN_DB(ctx);
129129

130-
return INT2NUM((long)sqlite3_total_changes(ctx->db));
130+
return INT2NUM(sqlite3_total_changes(ctx->db));
131131
}
132132

133133
static void tracefunc(void * data, const char *sql)
@@ -168,7 +168,7 @@ static int rb_sqlite3_busy_handler(void * ctx, int count)
168168
{
169169
VALUE self = (VALUE)(ctx);
170170
VALUE handle = rb_iv_get(self, "@busy_handler");
171-
VALUE result = rb_funcall(handle, rb_intern("call"), 1, INT2NUM((long)count));
171+
VALUE result = rb_funcall(handle, rb_intern("call"), 1, INT2NUM(count));
172172

173173
if(Qfalse == result) return 0;
174174

@@ -413,7 +413,7 @@ static VALUE errcode_(VALUE self)
413413
Data_Get_Struct(self, sqlite3Ruby, ctx);
414414
REQUIRE_OPEN_DB(ctx);
415415

416-
return INT2NUM((long)sqlite3_errcode(ctx->db));
416+
return INT2NUM(sqlite3_errcode(ctx->db));
417417
}
418418

419419
/* call-seq: complete?(sql)

ext/sqlite3/statement.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static VALUE column_count(VALUE self)
348348
Data_Get_Struct(self, sqlite3StmtRuby, ctx);
349349
REQUIRE_OPEN_STMT(ctx);
350350

351-
return INT2NUM((long)sqlite3_column_count(ctx->st));
351+
return INT2NUM(sqlite3_column_count(ctx->st));
352352
}
353353

354354
/* call-seq: stmt.column_name(index)
@@ -397,7 +397,7 @@ static VALUE bind_parameter_count(VALUE self)
397397
Data_Get_Struct(self, sqlite3StmtRuby, ctx);
398398
REQUIRE_OPEN_STMT(ctx);
399399

400-
return INT2NUM((long)sqlite3_bind_parameter_count(ctx->st));
400+
return INT2NUM(sqlite3_bind_parameter_count(ctx->st));
401401
}
402402

403403
#ifdef HAVE_SQLITE3_COLUMN_DATABASE_NAME

lib/sqlite3/database.rb

+5-15
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ def initialize file, options = {}, zvfs = nil
116116

117117
def type_translation= value # :nodoc:
118118
warn(<<-eowarn) if $VERBOSE
119-
#{caller[0]} is calling SQLite3::Database#type_translation=
120-
SQLite3::Database#type_translation= is deprecated and will be removed
121-
in version 2.0.0.
119+
#{caller[0]} is calling `SQLite3::Database#type_translation=` which is deprecated and will be removed in version 2.0.0.
122120
eowarn
123121
@type_translator = make_type_translator value
124122
@type_translation = value
@@ -189,9 +187,7 @@ def execute sql, bind_vars = [], *args, &block
189187
end
190188

191189
warn(<<-eowarn) if $VERBOSE
192-
#{caller[0]} is calling SQLite3::Database#execute with nil or multiple bind params
193-
without using an array. Please switch to passing bind parameters as an array.
194-
Support for bind parameters as *args will be removed in 2.0.0.
190+
#{caller[0]} is calling `SQLite3::Database#execute` with nil or multiple bind params without using an array. Please switch to passing bind parameters as an array. Support for bind parameters as *args will be removed in 2.0.0.
195191
eowarn
196192
end
197193

@@ -248,9 +244,7 @@ def execute_batch( sql, bind_vars = [], *args )
248244
unless [Array, Hash].include?(bind_vars.class)
249245
bind_vars = [bind_vars]
250246
warn(<<-eowarn) if $VERBOSE
251-
#{caller[0]} is calling SQLite3::Database#execute_batch with bind parameters
252-
that are not a list of a hash. Please switch to passing bind parameters as an
253-
array or hash. Support for this behavior will be removed in version 2.0.0.
247+
#{caller[0]} is calling `SQLite3::Database#execute_batch` with bind parameters that are not a list of a hash. Please switch to passing bind parameters as an array or hash. Support for this behavior will be removed in version 2.0.0.
254248
eowarn
255249
end
256250

@@ -263,9 +257,7 @@ def execute_batch( sql, bind_vars = [], *args )
263257
end
264258

265259
warn(<<-eowarn) if $VERBOSE
266-
#{caller[0]} is calling SQLite3::Database#execute_batch with nil or multiple bind params
267-
without using an array. Please switch to passing bind parameters as an array.
268-
Support for this behavior will be removed in version 2.0.0.
260+
#{caller[0]} is calling `SQLite3::Database#execute_batch` with nil or multiple bind params without using an array. Please switch to passing bind parameters as an array. Support for this behavior will be removed in version 2.0.0.
269261
eowarn
270262
end
271263

@@ -332,9 +324,7 @@ def query( sql, bind_vars = [], *args )
332324
end
333325

334326
warn(<<-eowarn) if $VERBOSE
335-
#{caller[0]} is calling SQLite3::Database#query with nil or multiple bind params
336-
without using an array. Please switch to passing bind parameters as an array.
337-
Support for this will be removed in version 2.0.0.
327+
#{caller[0]} is calling `SQLite3::Database#query` with nil or multiple bind params without using an array. Please switch to passing bind parameters as an array. Support for this will be removed in version 2.0.0.
338328
eowarn
339329
end
340330

lib/sqlite3/resultset.rb

+4-12
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,14 @@ class ArrayWithTypesAndFields < Array # :nodoc:
2020

2121
def types
2222
warn(<<-eowarn) if $VERBOSE
23-
#{caller[0]} is calling #{self.class}#types. This method will be removed in
24-
sqlite3 version 2.0.0, please call the `types` method on the SQLite3::ResultSet
25-
object that created this object
23+
#{caller[0]} is calling `#{self.class}#types` which is deprecated and will be removed in sqlite3 version 2.0.0. Please call the `types` method on the SQLite3::ResultSet object that created this object.
2624
eowarn
2725
@types
2826
end
2927

3028
def fields
3129
warn(<<-eowarn) if $VERBOSE
32-
#{caller[0]} is calling #{self.class}#fields. This method will be removed in
33-
sqlite3 version 2.0.0, please call the `columns` method on the SQLite3::ResultSet
34-
object that created this object
30+
#{caller[0]} is calling `#{self.class}#fields` which is deprecated and will be removed in sqlite3 version 2.0.0. Please call the `columns` method on the SQLite3::ResultSet object that created this object.
3531
eowarn
3632
@fields
3733
end
@@ -45,18 +41,14 @@ class HashWithTypesAndFields < Hash # :nodoc:
4541

4642
def types
4743
warn(<<-eowarn) if $VERBOSE
48-
#{caller[0]} is calling #{self.class}#types. This method will be removed in
49-
sqlite3 version 2.0.0, please call the `types` method on the SQLite3::ResultSet
50-
object that created this object
44+
#{caller[0]} is calling `#{self.class}#types` which is deprecated and will be removed in sqlite3 version 2.0.0. Please call the `types` method on the SQLite3::ResultSet object that created this object.
5145
eowarn
5246
@types
5347
end
5448

5549
def fields
5650
warn(<<-eowarn) if $VERBOSE
57-
#{caller[0]} is calling #{self.class}#fields. This method will be removed in
58-
sqlite3 version 2.0.0, please call the `columns` method on the SQLite3::ResultSet
59-
object that created this object
51+
#{caller[0]} is calling `#{self.class}#fields` which is deprecated and will be removed in sqlite3 version 2.0.0. Please call the `columns` method on the SQLite3::ResultSet object that created this object.
6052
eowarn
6153
@fields
6254
end

lib/sqlite3/translator.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ def initialize
3636
# The block should return the translated value.
3737
def add_translator( type, &block ) # :yields: type, value
3838
warn(<<-eowarn) if $VERBOSE
39-
#{caller[0]} is calling `add_translator`.
40-
Built in translators are deprecated and will be removed in version 2.0.0
39+
#{caller[0]} is calling `SQLite3::Translator#add_translator`. Built-in translators are deprecated and will be removed in version 2.0.0.
4140
eowarn
4241
@translators[ type_name( type ) ] = block
4342
end

lib/sqlite3/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module VersionProxy
1616
def self.const_missing(name)
1717
return super unless name == :Version
1818
warn(<<-eowarn) if $VERBOSE
19-
#{caller[0]}: SQLite::Version will be removed in sqlite3-ruby version 2.0.0
19+
#{caller[0]}: `SQLite::Version` will be removed in sqlite3-ruby version 2.0.0
2020
eowarn
2121
VersionProxy
2222
end

rakelib/test.rake

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Rake::TestTask.new(:test, &test_config)
1010
begin
1111
require "ruby_memcheck"
1212

13-
RubyMemcheck.config(binary_name: "sqlite3_native")
14-
1513
namespace :test do
1614
RubyMemcheck::TestTask.new(:valgrind, &test_config)
1715
end

sqlite3.gemspec

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ Gem::Specification.new do |s|
1010
s.name = "sqlite3"
1111
s.version = defined?(SQLite3::VERSION) ? SQLite3::VERSION : "0.0.0"
1212

13-
s.summary = "This module allows Ruby programs to interface with the SQLite3 database engine (http://www.sqlite.org)"
14-
s.description = "This module allows Ruby programs to interface with the SQLite3\ndatabase engine (http://www.sqlite.org). You must have the\nSQLite engine installed in order to build this module.\n\nNote that this module is only compatible with SQLite 3.6.16 or newer."
13+
s.summary = "Ruby library to interface with the SQLite3 database engine (http://www.sqlite.org)."
14+
s.description = <<~TEXT
15+
Ruby library to interface with the SQLite3 database engine (http://www.sqlite.org). Precompiled
16+
binaries are available for common platforms for recent versions of Ruby.
17+
TEXT
1518

16-
s.authors = ["Jamis Buck", "Luis Lavena", "Aaron Patterson"]
19+
s.authors = ["Jamis Buck", "Luis Lavena", "Aaron Patterson", "Mike Dalessio"]
1720

1821
s.licenses = ["BSD-3-Clause"]
1922

test/test_database.rb

+10-5
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,20 @@ def test_get_first_row
101101

102102
def test_get_first_row_with_type_translation_and_hash_results
103103
@db.results_as_hash = true
104-
@db.type_translation = true
105-
assert_equal({"1"=>1}, @db.get_first_row('SELECT 1'))
104+
capture_io do # hush translation deprecation warnings
105+
@db.type_translation = true
106+
assert_equal({"1"=>1}, @db.get_first_row('SELECT 1'))
107+
end
106108
end
107109

108110
def test_execute_with_type_translation_and_hash
109-
@db.results_as_hash = true
110-
@db.type_translation = true
111111
rows = []
112-
@db.execute('SELECT 1') { |row| rows << row }
112+
@db.results_as_hash = true
113+
114+
capture_io do # hush translation deprecation warnings
115+
@db.type_translation = true
116+
@db.execute('SELECT 1') { |row| rows << row }
117+
end
113118

114119
assert_equal({"1"=>1}, rows.first)
115120
end

test/test_integration_resultset.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ def test_next_results_as_hash
101101
hash = @result.next
102102
assert_equal( { "a" => 1, "b" => "foo" },
103103
hash )
104-
assert_equal hash[0], 1
105-
assert_equal hash[1], "foo"
104+
assert_equal hash[@result.columns[0]], 1
105+
assert_equal hash[@result.columns[1]], "foo"
106106
end
107107

108108
def test_each

test/test_statement.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ def test_bind_blob
140140
stmt.close
141141

142142
assert_equal ['hello'], row.first
143-
assert_equal ['blob'], row.first.types
143+
capture_io do # hush deprecation warning
144+
assert_equal ['blob'], row.first.types
145+
end
144146
end
145147

146148
def test_bind_64

0 commit comments

Comments
 (0)