Class: Ronin::Code::SQL::InjectionExpr Private
- Inherits:
-
Object
- Object
- Ronin::Code::SQL::InjectionExpr
- Includes:
- Emittable, Fields, Functions, Literals, Statements
- Defined in:
- lib/ronin/code/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(**kwargs) ⇒ 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, #sleep, #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.
53 54 55 |
# File 'lib/ronin/code/sql/injection_expr.rb', line 53 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::Code::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
45 46 47 |
# File 'lib/ronin/code/sql/injection_expr.rb', line 45 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.
67 68 69 70 71 72 73 74 75 |
# File 'lib/ronin/code/sql/injection_expr.rb', line 67 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.
87 88 89 90 91 92 93 94 95 |
# File 'lib/ronin/code/sql/injection_expr.rb', line 87 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(**kwargs) ⇒ 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.
106 107 108 |
# File 'lib/ronin/code/sql/injection_expr.rb', line 106 def to_sql(**kwargs) emitter(**kwargs).emit(@expression) end |