module Sequel::LitRequireFrozen::DatasetMethods

Public Instance Methods

placeholder_literal_string_sql_append(sql, pls) click to toggle source

Check that placeholder string is frozen (or all entries in placeholder array are frozen).

Calls superclass method
    # File lib/sequel/extensions/lit_require_frozen.rb
101 def placeholder_literal_string_sql_append(sql, pls)
102   str = pls.str
103 
104   if str.is_a?(Array)
105     str.each do |s|
106       _check_unfrozen_literal_string(s)
107     end
108   else
109     _check_unfrozen_literal_string(str)
110   end
111 
112   super
113 end
with_sql(sql, *args) click to toggle source

Check given SQL is not an unfrozen string.

Calls superclass method
   # File lib/sequel/extensions/lit_require_frozen.rb
94 def with_sql(sql, *args)
95   _check_unfrozen_literal_string(sql)
96   super
97 end

Private Instance Methods

_check_unfrozen_literal_string(str) click to toggle source

Base method that other methods used to check for whether a string should be allowed as literal SQL. Allows non-strings as well as frozen strings.

    # File lib/sequel/extensions/lit_require_frozen.rb
119 def _check_unfrozen_literal_string(str)
120   return if !str.is_a?(String) || str.frozen?
121 
122   if str.is_a?(LiteralString) && str == str.source
123     _check_unfrozen_literal_string(str.source)
124   else
125     raise Error, "cannot treat unfrozen string as literal SQL: #{str.inspect}"
126   end
127 end
literal_literal_string_append(sql, v) click to toggle source

Check literal strings appended to SQL.

Calls superclass method
    # File lib/sequel/extensions/lit_require_frozen.rb
130 def literal_literal_string_append(sql, v)
131   _check_unfrozen_literal_string(v)
132   super
133 end
static_sql(sql) click to toggle source

Check static SQL is not frozen.

Calls superclass method
    # File lib/sequel/extensions/lit_require_frozen.rb
136 def static_sql(sql)
137   _check_unfrozen_literal_string(sql)
138   super
139 end