module Ronin::SQL::Statements

Methods for creating common SQL {Statement Statements}.

@api public

Public Instance Methods

delete(table,&block) click to toggle source

Creates a new ‘DELETE` statement.

@param [Field, Symbol] table

The table to delete from.

@return [Statement]

The new statement.
# File lib/ronin/sql/statements.rb, line 99
def delete(table,&block)
  statement([:DELETE, :FROM],table,&block)
end
drop_table(table,&block) click to toggle source

Creates a new ‘DROP TABLE` statement.

@param [Field, Symbol] table

The table to drop.

@return [Statement]

The new statement.
# File lib/ronin/sql/statements.rb, line 112
def drop_table(table,&block)
  statement([:DROP, :TABLE],table,&block)
end
insert(&block) click to toggle source

Creates a new ‘INSERT` statement.

@return [Statement]

The new statement.
# File lib/ronin/sql/statements.rb, line 73
def insert(&block)
  statement(:INSERT,&block)
end
select(*columns,&block) click to toggle source

Creates a new ‘SELECT` statement.

@param [Array<Field, Symbol>] columns

The columns to select.

@return [Statement]

The new statement.
# File lib/ronin/sql/statements.rb, line 63
def select(*columns,&block)
  statement(:SELECT,columns,&block)
end
statement(keyword,argument=nil,&block) click to toggle source

Creates an arbitrary statement.

@param [Symbol] keyword

Name of the statement.

@param [Object] argument

Additional argument for the statement.

@yield [(statement)]

If a block is given, it will be called.

@yieldparam [Statement] statement

If the block accepts an argument, it will be passed the new statement.
Otherwise the block will be evaluated within the statement.

@return [Statement]

The new statement.
# File lib/ronin/sql/statements.rb, line 50
def statement(keyword,argument=nil,&block)
  Statement.new(keyword,argument,&block)
end
update(table,&block) click to toggle source

Creates a new ‘UPDATE` statement.

@param [Field, Symbol] table

The table to update.

@return [Statement]

The new statement.
# File lib/ronin/sql/statements.rb, line 86
def update(table,&block)
  statement(:UPDATE,table,&block)
end