module Ronin::SQL::Functions
Methods for creating common SQL
{Function Functions}.
@api public
Public Instance Methods
The ‘ABS` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 138 def abs(x) Function.new(:ABS,x) end
The ‘ACOS` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 148 def acos(x) Function.new(:ACOS,x) end
The ‘ASCII` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 494 def ascii(string) Function.new(:ASCII,string) end
The ‘ASIN` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 158 def asin(x) Function.new(:ASIN,x) end
The ‘ATAN` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 168 def atan(x) Function.new(:ATAN,x) end
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
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
The ‘BIN` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 504 def bin(n) Function.new(:BIN,n) end
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
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
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
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
The ‘CEIL` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 218 def ceil(x) Function.new(:CEIL,x) end
The ‘CEILING` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 228 def ceiling(x) Function.new(:CEILING,x) end
The ‘CHAR` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 524 def char(*bytes) Function.new(:CHAR,*bytes) end
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
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
The ‘CONCAT` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 554 def concat(*strings) Function.new(:CONCAT,*strings) end
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
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
The ‘COS` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 238 def cos(x) Function.new(:COS,x) end
The ‘COT` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 248 def cot(x) Function.new(:COT,x) end
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
The ‘DEGREES` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 258 def degrees(x) Function.new(:DEGREES,x) end
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
The ‘EXP` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 268 def exp(x) Function.new(:EXP,x) end
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
The ‘FIELD` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 610 def field(*strings) Function.new(:FIELD,*strings) end
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
The ‘FLOOR` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 278 def floor(x) Function.new(:FLOOR,x) end
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
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
The ‘GREATEST` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 298 def greatest(*values) Function.new(:GREATEST,*values) end
The ‘HEX` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 640 def hex(value) Function.new(:HEX,value) end
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
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
The ‘INTERVAL` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 308 def interval(*values) Function.new(:INTERVAL,*values) end
The ‘LCASE` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 670 def lcase(string) Function.new(:LCASE,string) end
The ‘LEAST` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 318 def least(*values) Function.new(:LEAST,*values) end
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
The ‘LENGTH` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 690 def length(string) Function.new(:LENGTH,string) end
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
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
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
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
The ‘LOG10` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 338 def log10(x) Function.new(:LOG10,x) end
The ‘LOWER` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 734 def lower(string) Function.new(:LOWER,string) end
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
The ‘LTRIM` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 754 def ltrim(string) Function.new(:LTRIM,string) end
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
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
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
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
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
The ‘OCT` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 784 def oct(n) Function.new(:OCT,n) end
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
The ‘ORD` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 804 def ord(string) Function.new(:ORD,string) end
The ‘PI` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 358 def pi Function.new(:PI) end
The ‘POSITION` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 814 def position(expr) Function.new(:POSITION,expr) end
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
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
The ‘QUOTE` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 824 def quote(string) Function.new(:QUOTE,string) end
The ‘RADIANS` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 388 def radians(x) Function.new(:RADIANS,x) end
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
The ‘RANDOM` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 398 def random Function.new(:RANDOM) end
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
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
The ‘REVERSE` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 854 def reverse(string) Function.new(:REVERSE,string) end
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
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
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
The ‘RTRIM` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 884 def rtrim(string) Function.new(:RTRIM,string) end
The ‘SIGN` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 420 def sign(x) Function.new(:SIGN,x) end
The ‘SIN` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 430 def sin(x) Function.new(:SIN,x) end
The ‘SOUNDEX` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 894 def soundex(string) Function.new(:SOUNDEX,string) end
The ‘SPACE` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 904 def space(n) Function.new(:SPACE,n) end
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
The ‘STD` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 450 def std(field) Function.new(:STD,field) end
The ‘STDDEV` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 460 def stddev(field) Function.new(:STDDEV,field) end
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
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
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
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
The ‘TAN` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 470 def tan(x) Function.new(:TAN,x) end
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
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
The ‘UCASE` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 966 def ucase(string) Function.new(:UCASE,string) end
The ‘UNHEX` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 976 def unhex(string) Function.new(:UNHEX,string) end
The ‘UPPER` function.
@return [Function]
The new function.
# File lib/ronin/sql/functions.rb, line 986 def upper(string) Function.new(:UPPER,string) end