Module: Ronin::Code::SQL::Literals

Included in:
Clause, Injection, InjectionExpr, Statement
Defined in:
lib/ronin/code/sql/literals.rb

Overview

Methods for creating SQL Literal.

Instance Method Summary collapse

Instance Method Details

#float(value) ⇒ Literal<Float>

Creates an Float literal.

Parameters:

  • value (String, Numeric)

    The value to convert to a Float.

Returns:

  • (Literal<Float>)

    The Float literal.



64
65
66
# File 'lib/ronin/code/sql/literals.rb', line 64

def float(value)
  Literal.new(value.to_f)
end

#int(value) ⇒ Literal<Integer>

Creates an Integer literal.

Parameters:

  • value (String, Numeric)

    The value to convert to an Integer.

Returns:

  • (Literal<Integer>)

    The Integer literal.



51
52
53
# File 'lib/ronin/code/sql/literals.rb', line 51

def int(value)
  Literal.new(value.to_i)
end

#nullLiteral

Creates a NULL literal.

Returns:



38
39
40
# File 'lib/ronin/code/sql/literals.rb', line 38

def null
  Literal.new(:NULL)
end

#string(value) ⇒ Literal<String>

Creates an String literal.

Parameters:

  • value (String, Numeric)

    The value to convert to a String.

Returns:

  • (Literal<String>)

    The String literal.



77
78
79
# File 'lib/ronin/code/sql/literals.rb', line 77

def string(value)
  Literal.new(value.to_s)
end