Method: PLSQL::Connection#select_all

Defined in:
lib/plsql/connection.rb

#select_all(sql, *bindvars, &block) ⇒ Object

:nodoc:



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/plsql/connection.rb', line 115

def select_all(sql, *bindvars, &block) #:nodoc:
  cursor = cursor_from_query(sql, bindvars)
  results = []
  row_count = 0
  while row = cursor.fetch
    if block_given?
      yield(row)
      row_count += 1
    else
      results << row
    end
  end
  block_given? ? row_count : results
ensure
  cursor.close rescue nil
end