# frozen_string_literal: true module Arel # :nodoc: all module Nodes class BoundSqlLiteral < NodeExpression attr_reader :sql_with_placeholders, :positional_binds, :named_binds def initialize(sql_with_placeholders, positional_binds, named_binds) if !positional_binds.empty? && !named_binds.empty? raise BindError.new("cannot mix positional and named binds", sql_with_placeholders) elsif !positional_binds.empty? if positional_binds.size != (expected = sql_with_placeholders.count("?")) raise BindError.new("wrong number of bind variables (#{positional_binds.size} for #{expected})", sql_with_placeholders) end elsif !named_binds.empty? tokens_in_string = sql_with_placeholders.scan(/:(?" end end end end