Module: Blouson::SensitiveQueryFilter::StatementInvalidErrorFilter
- Defined in:
- lib/blouson/sensitive_query_filter.rb
Instance Method Summary collapse
- #initialize(message = nil, sql: nil, binds: nil, connection_pool: nil) ⇒ Object
- #set_query(sql, binds) ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#initialize(message = nil, sql: nil, binds: nil, connection_pool: nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/blouson/sensitive_query_filter.rb', line 18 def initialize( = nil, sql: nil, binds: nil, connection_pool: nil) if SensitiveQueryFilter.contain_sensitive_query?() || SensitiveQueryFilter.contain_sensitive_query?(sql) = SensitiveQueryFilter.filter_sensitive_words() if sql = SensitiveQueryFilter.filter_sensitive_words(sql) if sql if defined?(Mysql2::Error) if $!.is_a?(Mysql2::Error) $!.extend(Mysql2Filter) end end end if connection_pool # Rails >= 7.1 # # - https://github.com/rails/rails/pull/48295 super(, sql: sql, binds: binds, connection_pool: connection_pool) else # Rails >= 6.0 # # - https://github.com/rails/rails/pull/34468 super(, sql: sql, binds: binds) end end |
#set_query(sql, binds) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/blouson/sensitive_query_filter.rb', line 42 def set_query(sql, binds) if SensitiveQueryFilter.contain_sensitive_query?(sql) super(SensitiveQueryFilter.filter_sensitive_words(sql), binds) else super(sql, binds) end end |
#to_s ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/blouson/sensitive_query_filter.rb', line 50 def to_s if SensitiveQueryFilter.contain_sensitive_query?(sql) SensitiveQueryFilter.filter_sensitive_words(super) else super end end |