Class: Ronin::SQL::InjectionExpr Private
- Inherits:
-
Object
- Object
- Ronin::SQL::InjectionExpr
- Includes:
- Emittable, Fields, Functions, Literals, Statements
- Defined in:
- lib/ronin/sql/injection_expr.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
private
The expression that will be injected.
Instance Method Summary collapse
-
#and {|(self)| ... } ⇒ self
private
Appends an
AND
expression to the injection. -
#initialize(initial_value) ⇒ InjectionExpr
constructor
private
Initializes the new expression to inject.
-
#or {|(self)| ... } ⇒ self
private
Appends an
OR
expression to the injection. -
#to_sql(options = {}) ⇒ String
private
Emits the injection expression.
Methods included from Emittable
Methods included from Statements
#delete, #drop_table, #insert, #select, #statement, #update
Methods included from Functions
#abs, #acos, #ascii, #asin, #atan, #atan2, #avg, #bin, #bit_and, #bit_count, #bit_length, #bit_or, #ceil, #ceiling, #char, #char_length, #character_length, #concat, #concat_ws, #conv, #cos, #cot, #count, #degrees, #elt, #exp, #export_set, #field, #find_in_set, #floor, #format, #glob, #greatest, #hex, #insert, #instr, #interval, #lcase, #least, #left, #length, #like, #load_file, #locate, #log, #log10, #lower, #lpad, #ltrim, #make_set, #max, #mid, #min, #mod, #oct, #octet_length, #ord, #pi, #position, #pow, #power, #quote, #radians, #rand, #random, #repeat, #replace, #reverse, #right, #round, #rpad, #rtrim, #sign, #sin, #soundex, #space, #sqrt, #std, #stddev, #strcmp, #substring, #substring_index, #sum, #tan, #trim, #truncate, #ucase, #unhex, #upper
Methods included from Fields
#method_missing, #respond_to_missing?, #to_ary
Methods included from Literals
Constructor Details
#initialize(initial_value) ⇒ InjectionExpr
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the new expression to inject.
54 55 56 |
# File 'lib/ronin/sql/injection_expr.rb', line 54 def initialize(initial_value) @expression = initial_value end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Ronin::SQL::Fields
Instance Attribute Details
#expression ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The expression that will be injected
46 47 48 |
# File 'lib/ronin/sql/injection_expr.rb', line 46 def expression @expression end |
Instance Method Details
#and {|(self)| ... } ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Appends an AND
expression to the injection.
68 69 70 71 72 73 74 75 76 |
# File 'lib/ronin/sql/injection_expr.rb', line 68 def and(&block) value = case block.arity when 0 then instance_eval(&block) else block.call(self) end @expression = BinaryExpr.new(@expression,:AND,value) return self end |
#or {|(self)| ... } ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Appends an OR
expression to the injection.
88 89 90 91 92 93 94 95 96 |
# File 'lib/ronin/sql/injection_expr.rb', line 88 def or(&block) value = case block.arity when 0 then instance_eval(&block) else block.call(self) end @expression = BinaryExpr.new(@expression,:OR,value) return self end |
#to_sql(options = {}) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Emits the injection expression.
107 108 109 |
# File 'lib/ronin/sql/injection_expr.rb', line 107 def to_sql(={}) emitter().emit(@expression) end |