Class: Baza::Commands::Select
- Inherits:
-
Object
- Object
- Baza::Commands::Select
- Defined in:
- lib/baza/commands/select.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(args) ⇒ Select
constructor
A new instance of Select.
Constructor Details
#initialize(args) ⇒ Select
Returns a new instance of Select.
2 3 4 5 6 7 8 9 |
# File 'lib/baza/commands/select.rb', line 2 def initialize(args) @args = args.fetch(:args) @block = args.fetch(:block) @db = args.fetch(:db) @sql = "" @table_name = args.fetch(:table_name) @terms = args.fetch(:terms) end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/baza/commands/select.rb', line 11 def execute # Give 'cloned_ubuf' argument to 'q'-method. if @args @args_q = {cloned_ubuf: true} if @args[:cloned_ubuf] @args_q = {unbuffered: true} if @args[:unbuffered] end add_select_sql add_terms_sql add_order_sql add_limit_sql unless @db.mssql? result = execute_query # Return result if a block wasnt given. if @block nil else result end end |