Skip to content

Commit

Permalink
Merge pull request #511 from sparklemotion/flavorjones-remove-depreca…
Browse files Browse the repository at this point in the history
…ted-signatures

remove deprecated method signatures (bind params)
  • Loading branch information
flavorjones authored Mar 1, 2024
2 parents 2f7d019 + d851a10 commit 9e87ec0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 103 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ This release drops support for Ruby 2.7. [#453] @flavorjones

### Removed

- Remove methods `SQLite3::Database::FunctionProxy#count` and `#set_error`. [#164, #509, #510] @alexcwatt @flavorjones
- Remove class `SQLite3::VersionProxy` which has been deprecated since v1.3.2. [#453] @flavorjones
- Remove class `SQLite3::Translator` and all related type translation methods.
- Removed class `SQLite3::VersionProxy` which has been deprecated since v1.3.2. [#453] @flavorjones
- Removed class `SQLite3::Translator` and all related type translation methods.
If you need to do type translation on values returned from the statement object,
please wrap it with a delegate object. Here is an example of using a delegate
class to implement type translation:
Expand Down Expand Up @@ -98,6 +97,10 @@ assert_equal ["blob"], row.first.types
end
```

- Removed methods `SQLite3::Database::FunctionProxy#count` and `#set_error`. [#164, #509, #510] @alexcwatt @flavorjones
- Removed support for non-Array bind parameters to methods `Database#execute`, `#execute_batch`, and `#query`.


## 1.7.2 / 2024-01-30

### Dependencies
Expand Down
45 changes: 0 additions & 45 deletions lib/sqlite3/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,6 @@ def filename db_name = "main"
# See also #execute2, #query, and #execute_batch for additional ways of
# executing statements.
def execute sql, bind_vars = [], *args, &block
if bind_vars.nil? || !args.empty?
bind_vars = if args.empty?
[]
else
[bind_vars] + args
end

warn(<<~EOWARN) if $VERBOSE
#{caller(1..1).first} 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.
EOWARN
end

prepare(sql) do |stmt|
stmt.bind_params(bind_vars)
stmt = build_result_set stmt
Expand Down Expand Up @@ -257,27 +245,6 @@ def execute2(sql, *bind_vars)
# See also #execute_batch2 for additional ways of
# executing statements.
def execute_batch(sql, bind_vars = [], *args)
# FIXME: remove this stuff later
unless [Array, Hash].include?(bind_vars.class)
bind_vars = [bind_vars]
warn(<<~EOWARN) if $VERBOSE
#{caller(1..1).first} 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.
EOWARN
end

# FIXME: remove this stuff later
if bind_vars.nil? || !args.empty?
bind_vars = if args.empty?
[]
else
[nil] + args
end

warn(<<~EOWARN) if $VERBOSE
#{caller(1..1).first} 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.
EOWARN
end

sql = sql.strip
until sql.empty?
prepare(sql) do |stmt|
Expand Down Expand Up @@ -332,18 +299,6 @@ def execute_batch2(sql, &block)
# with a block, +close+ will be invoked implicitly when the block
# terminates.
def query(sql, bind_vars = [], *args)
if bind_vars.nil? || !args.empty?
bind_vars = if args.empty?
[]
else
[bind_vars] + args
end

warn(<<~EOWARN) if $VERBOSE
#{caller(1..1).first} 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.
EOWARN
end

result = prepare(sql).execute(bind_vars)
if block_given?
begin
Expand Down
6 changes: 0 additions & 6 deletions lib/sqlite3/pragmas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,6 @@ def table_info table
stmt.each do |row|
new_row = columns.zip(row).to_h

# FIXME: This should be removed but is required for older versions
# of rails
if Object.const_defined?(:ActiveRecord)
new_row["notnull"] = new_row["notnull"].to_s
end

tweak_default(new_row) if needs_tweak_default

# Ensure the type value is downcased. On Mac and Windows
Expand Down
49 changes: 0 additions & 49 deletions test/test_deprecated.rb

This file was deleted.

0 comments on commit 9e87ec0

Please sign in to comment.