mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #34436 from gmcgibbon/fix_default_max_bind_length_sqlite
Adjust bind length of SQLite to default (999)
This commit is contained in:
commit
5e9a3e7763
2 changed files with 26 additions and 0 deletions
|
@ -396,6 +396,12 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
private
|
||||
# See https://www.sqlite.org/limits.html,
|
||||
# the default value is 999 when not configured.
|
||||
def bind_params_length
|
||||
999
|
||||
end
|
||||
|
||||
def check_version
|
||||
if sqlite_version < "3.8.0"
|
||||
raise "Your version of SQLite (#{sqlite_version}) is too old. Active Record supports SQLite >= 3.8."
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "cases/helper"
|
||||
require "models/topic"
|
||||
|
||||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
class SQLite3Adapter
|
||||
class BindParameterTest < ActiveRecord::SQLite3TestCase
|
||||
def test_too_many_binds
|
||||
topics = Topic.where(id: (1..999).to_a << 2**63)
|
||||
assert_equal Topic.count, topics.count
|
||||
|
||||
topics = Topic.where.not(id: (1..999).to_a << 2**63)
|
||||
assert_equal 0, topics.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue