module Ronin::SQL::Functions

Methods for creating common SQL {Function Functions}.

@api public

Public Instance Methods

abs(x) click to toggle source

The ‘ABS` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 138
def abs(x)
  Function.new(:ABS,x)
end
acos(x) click to toggle source

The ‘ACOS` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 148
def acos(x)
  Function.new(:ACOS,x)
end
ascii(string) click to toggle source

The ‘ASCII` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 494
def ascii(string)
  Function.new(:ASCII,string)
end
asin(x) click to toggle source

The ‘ASIN` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 158
def asin(x)
  Function.new(:ASIN,x)
end
atan(x) click to toggle source

The ‘ATAN` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 168
def atan(x)
  Function.new(:ATAN,x)
end
atan2(y,x) click to toggle source

The ‘ATAN2` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 178
def atan2(y,x)
  Function.new(:ATAN2,y,x)
end
avg(field) click to toggle source

The ‘AVG` function.

@param [Field, Symbol] field

The field to aggregate.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 85
def avg(field)
  Function.new(:AVG,field)
end
bin(n) click to toggle source

The ‘BIN` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 504
def bin(n)
  Function.new(:BIN,n)
end
bit_and(x) click to toggle source

The ‘BIT_AND` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 188
def bit_and(x)
  Function.new(:BIT_AND,x)
end
bit_count(x) click to toggle source

The ‘BIT_COUNT` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 198
def bit_count(x)
  Function.new(:BIT_COUNT,x)
end
bit_length(string) click to toggle source

The ‘BIT_LENGTH` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 514
def bit_length(string)
  Function.new(:BIT_LENGTH,string)
end
bit_or(x) click to toggle source

The ‘BIT_OR` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 208
def bit_or(x)
  Function.new(:BIT_OR,x)
end
ceil(x) click to toggle source

The ‘CEIL` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 218
def ceil(x)
  Function.new(:CEIL,x)
end
ceiling(x) click to toggle source

The ‘CEILING` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 228
def ceiling(x)
  Function.new(:CEILING,x)
end
char(*bytes) click to toggle source

The ‘CHAR` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 524
def char(*bytes)
  Function.new(:CHAR,*bytes)
end
char_length(string) click to toggle source

The ‘CHAR_LENGTH` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 534
def char_length(string)
  Function.new(:CHAR_LENGTH,string)
end
character_length(string) click to toggle source

The ‘CHARACTER_LENGTH` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 544
def character_length(string)
  Function.new(:CHARACTER_LENGTH,string)
end
concat(*strings) click to toggle source

The ‘CONCAT` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 554
def concat(*strings)
  Function.new(:CONCAT,*strings)
end
concat_ws(separator,*strings) click to toggle source

The ‘CONCAT_WS` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 564
def concat_ws(separator,*strings)
  Function.new(:CONCAT_WS,separator,*strings)
end
conv(n,from_base,to_base) click to toggle source

The ‘CONV` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 574
def conv(n,from_base,to_base)
  Function.new(:CONV,n,from_base,to_base)
end
cos(x) click to toggle source

The ‘COS` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 238
def cos(x)
  Function.new(:COS,x)
end
cot(x) click to toggle source

The ‘COT` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 248
def cot(x)
  Function.new(:COT,x)
end
count(field=:*) click to toggle source

The ‘COUNT` function.

@param [Field, Symbol] field

The field to aggregate.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 46
def count(field=:*)
  Function.new(:COUNT,field)
end
degrees(x) click to toggle source

The ‘DEGREES` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 258
def degrees(x)
  Function.new(:DEGREES,x)
end
elt(n,*strings) click to toggle source

The ‘ELT` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 584
def elt(n,*strings)
  Function.new(:ELT,n,*strings)
end
exp(x) click to toggle source

The ‘EXP` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 268
def exp(x)
  Function.new(:EXP,x)
end
export_set(bits,on,off,separator=nil,number_of_bits=nil) click to toggle source

The ‘EXPORT_SET` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 594
def export_set(bits,on,off,separator=nil,number_of_bits=nil)
  if (separator && number_of_bits)
    Function.new(:EXPORT_SET,bits,on,off,separator,number_of_bits)
  elsif separator
    Function.new(:EXPORT_SET,bits,on,off,separator)
  else
    Function.new(:EXPORT_SET,bits,on,off)
  end
end
field(*strings) click to toggle source

The ‘FIELD` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 610
def field(*strings)
  Function.new(:FIELD,*strings)
end
find_in_set(string,*set) click to toggle source

The ‘FIND_IN_SET` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 620
def find_in_set(string,*set)
  Function.new(:FIND_IN_SET,string,*set)
end
floor(x) click to toggle source

The ‘FLOOR` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 278
def floor(x)
  Function.new(:FLOOR,x)
end
format(x,d) click to toggle source

The ‘FORMAT` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 288
def format(x,d)
  Function.new(:FORMAT,x,d)
end
glob(x,y) click to toggle source

The ‘GLOB` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 630
def glob(x,y)
  Function.new(:GLOB,x,y)
end
greatest(*values) click to toggle source

The ‘GREATEST` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 298
def greatest(*values)
  Function.new(:GREATEST,*values)
end
hex(value) click to toggle source

The ‘HEX` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 640
def hex(value)
  Function.new(:HEX,value)
end
insert(string,position,length,new_string) click to toggle source

The ‘INSERT` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 650
def insert(string,position,length,new_string)
  Function.new(:INSERT,string,position,length,new_string)
end
instr(string,sub_string) click to toggle source

The ‘INSTR` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 660
def instr(string,sub_string)
  Function.new(:INSTR,string,sub_string)
end
interval(*values) click to toggle source

The ‘INTERVAL` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 308
def interval(*values)
  Function.new(:INTERVAL,*values)
end
lcase(string) click to toggle source

The ‘LCASE` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 670
def lcase(string)
  Function.new(:LCASE,string)
end
least(*values) click to toggle source

The ‘LEAST` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 318
def least(*values)
  Function.new(:LEAST,*values)
end
left(string,length) click to toggle source

The ‘LEFT` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 680
def left(string,length)
  Function.new(:LEFT,string,length)
end
length(string) click to toggle source

The ‘LENGTH` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 690
def length(string)
  Function.new(:LENGTH,string)
end
like(x,y,options=nil) click to toggle source

The ‘LIKE` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 700
def like(x,y,options=nil)
  if options then Function.new(:LIKE,x,y,options)
  else            Function.new(:LIKE,x,y)
  end
end
load_file(file_name) click to toggle source

The ‘LOAD_FILE` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 712
def load_file(file_name)
  Function.new(:LOAD_FILE,file_name)
end
locate(sub_string,string,pos=nil) click to toggle source

The ‘LOCATE` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 722
def locate(sub_string,string,pos=nil)
  if pos then Function.new(:LOCATE,sub_string,string,pos)
  else        Function.new(:LOCATE,sub_string,string)
  end
end
log(*b,x) click to toggle source

The ‘LOG` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 328
def log(*b,x)
  Function.new(:LOG,*b,x)
end
log10(x) click to toggle source

The ‘LOG10` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 338
def log10(x)
  Function.new(:LOG10,x)
end
lower(string) click to toggle source

The ‘LOWER` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 734
def lower(string)
  Function.new(:LOWER,string)
end
lpad(string,length,pad_string) click to toggle source

The ‘LPAD` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 744
def lpad(string,length,pad_string)
  Function.new(:LPAD,string,length,pad_string)
end
ltrim(string) click to toggle source

The ‘LTRIM` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 754
def ltrim(string)
  Function.new(:LTRIM,string)
end
make_set(bits,*strings) click to toggle source

The ‘MAKE_SET` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 764
def make_set(bits,*strings)
  Function.new(:MAKE_SET,bits,*strings)
end
max(field) click to toggle source

The ‘MAX` function.

@param [Field, Symbol] field

The field to aggregate.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 59
def max(field)
  Function.new(:MAX,field)
end
mid(string,position,length) click to toggle source

The ‘MID` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 774
def mid(string,position,length)
  Function.new(:MID,string,position,length)
end
min(field) click to toggle source

The ‘MIN` function.

@param [Field, Symbol] field

The field to aggregate.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 72
def min(field)
  Function.new(:MIN,field)
end
mod(n,m) click to toggle source

The ‘MOD` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 348
def mod(n,m)
  Function.new(:MOD,n,m)
end
oct(n) click to toggle source

The ‘OCT` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 784
def oct(n)
  Function.new(:OCT,n)
end
octet_length(string) click to toggle source

The ‘OCTET_LENGTH` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 794
def octet_length(string)
  Function.new(:OCTET_LENGTH,string)
end
ord(string) click to toggle source

The ‘ORD` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 804
def ord(string)
  Function.new(:ORD,string)
end
pi() click to toggle source

The ‘PI` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 358
def pi
  Function.new(:PI)
end
position(expr) click to toggle source

The ‘POSITION` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 814
def position(expr)
  Function.new(:POSITION,expr)
end
pow(x,y) click to toggle source

The ‘POW` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 368
def pow(x,y)
  Function.new(:POW,x,y)
end
power(x,y) click to toggle source

The ‘POWER` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 378
def power(x,y)
  Function.new(:POWER,x,y)
end
quote(string) click to toggle source

The ‘QUOTE` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 824
def quote(string)
  Function.new(:QUOTE,string)
end
radians(x) click to toggle source

The ‘RADIANS` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 388
def radians(x)
  Function.new(:RADIANS,x)
end
rand(field) click to toggle source

The ‘RAND` function.

@param [Field, Symbol] field

The field to aggregate.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 124
def rand(field)
  Function.new(:RAND,field)
end
random() click to toggle source

The ‘RANDOM` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 398
def random
  Function.new(:RANDOM)
end
repeat(string,count) click to toggle source

The ‘REPEAT` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 834
def repeat(string,count)
  Function.new(:REPEAT,string,count)
end
replace(string,from_string,to_string) click to toggle source

The ‘REPLACE` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 844
def replace(string,from_string,to_string)
  Function.new(:REPLACE,string,from_string,to_string)
end
reverse(string) click to toggle source

The ‘REVERSE` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 854
def reverse(string)
  Function.new(:REVERSE,string)
end
right(string,length) click to toggle source

The ‘RIGHT` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 864
def right(string,length)
  Function.new(:RIGHT,string,length)
end
round(x,d=nil) click to toggle source

The ‘ROUND` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 408
def round(x,d=nil)
  if d then Function.new(:ROUND,x,d)
  else      Function.new(:ROUND,x)
  end
end
rpad(string,length,pad_string) click to toggle source

The ‘RPAD` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 874
def rpad(string,length,pad_string)
  Function.new(:RPAD,string,length,pad_string)
end
rtrim(string) click to toggle source

The ‘RTRIM` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 884
def rtrim(string)
  Function.new(:RTRIM,string)
end
sign(x) click to toggle source

The ‘SIGN` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 420
def sign(x)
  Function.new(:SIGN,x)
end
sin(x) click to toggle source

The ‘SIN` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 430
def sin(x)
  Function.new(:SIN,x)
end
soundex(string) click to toggle source

The ‘SOUNDEX` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 894
def soundex(string)
  Function.new(:SOUNDEX,string)
end
space(n) click to toggle source

The ‘SPACE` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 904
def space(n)
  Function.new(:SPACE,n)
end
sqrt(field) click to toggle source

The ‘SQRT` function.

@param [Field, Symbol] field

The field to aggregate.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 111
def sqrt(field)
  Function.new(:SQRT,field)
end
std(field) click to toggle source

The ‘STD` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 450
def std(field)
  Function.new(:STD,field)
end
stddev(field) click to toggle source

The ‘STDDEV` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 460
def stddev(field)
  Function.new(:STDDEV,field)
end
strcmp(string1,string2) click to toggle source

The ‘STRCMP` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 914
def strcmp(string1,string2)
  Function.new(:STRCMP,string1,string2)
end
substring(string,position,length=nil) click to toggle source

The ‘SUBSTRING` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 924
def substring(string,position,length=nil)
  if length then Function.new(:SUBSTRING,string,position,length)
  else           Function.new(:SUBSTRING,string,position)
  end
end
substring_index(string,deliminator,count) click to toggle source

The ‘SUBSTRING_INDEX` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 936
def substring_index(string,deliminator,count)
  Function.new(:SUBSTRING_INDEX,string,deliminator,count)
end
sum(field) click to toggle source

The ‘SUM` function.

@param [Field, Symbol] field

The field to aggregate.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 98
def sum(field)
  Function.new(:SUM,field)
end
tan(x) click to toggle source

The ‘TAN` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 470
def tan(x)
  Function.new(:TAN,x)
end
trim(string_or_options) click to toggle source

The ‘TRIM` function.

@param [String, Hash] string_or_options

@option string_or_options [String] :both

@option string_or_options [String] :leading

@option string_or_options [String] :trailing

@option string_or_options [String] :from

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 956
def trim(string_or_options)
  Function.new(:TRIM,string_or_options)
end
truncate(x,d) click to toggle source

The ‘TRUNCATE` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 480
def truncate(x,d)
  Function.new(:TRUNCATE,x,d)
end
ucase(string) click to toggle source

The ‘UCASE` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 966
def ucase(string)
  Function.new(:UCASE,string)
end
unhex(string) click to toggle source

The ‘UNHEX` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 976
def unhex(string)
  Function.new(:UNHEX,string)
end
upper(string) click to toggle source

The ‘UPPER` function.

@return [Function]

The new function.
# File lib/ronin/sql/functions.rb, line 986
def upper(string)
  Function.new(:UPPER,string)
end