Skip to content

Commit 9e87ec0

Browse files
authored
Merge pull request #511 from sparklemotion/flavorjones-remove-deprecated-signatures
remove deprecated method signatures (bind params)
2 parents 2f7d019 + d851a10 commit 9e87ec0

File tree

4 files changed

+6
-103
lines changed

4 files changed

+6
-103
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ This release drops support for Ruby 2.7. [#453] @flavorjones
3838

3939
### Removed
4040

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

100+
- Removed methods `SQLite3::Database::FunctionProxy#count` and `#set_error`. [#164, #509, #510] @alexcwatt @flavorjones
101+
- Removed support for non-Array bind parameters to methods `Database#execute`, `#execute_batch`, and `#query`.
102+
103+
101104
## 1.7.2 / 2024-01-30
102105

103106
### Dependencies

lib/sqlite3/database.rb

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,6 @@ def filename db_name = "main"
195195
# See also #execute2, #query, and #execute_batch for additional ways of
196196
# executing statements.
197197
def execute sql, bind_vars = [], *args, &block
198-
if bind_vars.nil? || !args.empty?
199-
bind_vars = if args.empty?
200-
[]
201-
else
202-
[bind_vars] + args
203-
end
204-
205-
warn(<<~EOWARN) if $VERBOSE
206-
#{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.
207-
EOWARN
208-
end
209-
210198
prepare(sql) do |stmt|
211199
stmt.bind_params(bind_vars)
212200
stmt = build_result_set stmt
@@ -257,27 +245,6 @@ def execute2(sql, *bind_vars)
257245
# See also #execute_batch2 for additional ways of
258246
# executing statements.
259247
def execute_batch(sql, bind_vars = [], *args)
260-
# FIXME: remove this stuff later
261-
unless [Array, Hash].include?(bind_vars.class)
262-
bind_vars = [bind_vars]
263-
warn(<<~EOWARN) if $VERBOSE
264-
#{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.
265-
EOWARN
266-
end
267-
268-
# FIXME: remove this stuff later
269-
if bind_vars.nil? || !args.empty?
270-
bind_vars = if args.empty?
271-
[]
272-
else
273-
[nil] + args
274-
end
275-
276-
warn(<<~EOWARN) if $VERBOSE
277-
#{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.
278-
EOWARN
279-
end
280-
281248
sql = sql.strip
282249
until sql.empty?
283250
prepare(sql) do |stmt|
@@ -332,18 +299,6 @@ def execute_batch2(sql, &block)
332299
# with a block, +close+ will be invoked implicitly when the block
333300
# terminates.
334301
def query(sql, bind_vars = [], *args)
335-
if bind_vars.nil? || !args.empty?
336-
bind_vars = if args.empty?
337-
[]
338-
else
339-
[bind_vars] + args
340-
end
341-
342-
warn(<<~EOWARN) if $VERBOSE
343-
#{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.
344-
EOWARN
345-
end
346-
347302
result = prepare(sql).execute(bind_vars)
348303
if block_given?
349304
begin

lib/sqlite3/pragmas.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,6 @@ def table_info table
532532
stmt.each do |row|
533533
new_row = columns.zip(row).to_h
534534

535-
# FIXME: This should be removed but is required for older versions
536-
# of rails
537-
if Object.const_defined?(:ActiveRecord)
538-
new_row["notnull"] = new_row["notnull"].to_s
539-
end
540-
541535
tweak_default(new_row) if needs_tweak_default
542536

543537
# Ensure the type value is downcased. On Mac and Windows

test/test_deprecated.rb

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)