Class | Sequel::SQLite::Dataset |
In: |
lib/sequel/adapters/sqlite.rb
|
Parent: | Sequel::Dataset |
EXPLAIN | = | 'EXPLAIN %s'.freeze |
PREPARED_ARG_PLACEHOLDER | = | ':'.freeze |
Return an array of strings specifying a query explanation for the current dataset.
# File lib/sequel/adapters/sqlite.rb, line 183 183: def explain 184: res = [] 185: @db.result_set(EXPLAIN % select_sql(opts), nil) {|r| res << r} 186: res 187: end
Yield a hash for each row in the dataset.
# File lib/sequel/adapters/sqlite.rb, line 190 190: def fetch_rows(sql) 191: execute(sql) do |result| 192: i = -1 193: cols = result.columns.map{|c| [output_identifier(c), i+=1]} 194: @columns = cols.map{|c| c.first} 195: result.each do |values| 196: row = {} 197: cols.each{|n,i| row[n] = values[i]} 198: yield row 199: end 200: end 201: end
Prepare the given type of query with the given name and store it in the database. Note that a new native prepared statement is created on each call to this prepared statement.
# File lib/sequel/adapters/sqlite.rb, line 206 206: def prepare(type, name=nil, values=nil) 207: ps = to_prepared_statement(type, values) 208: ps.extend(PreparedStatementMethods) 209: db.prepared_statements[name] = ps if name 210: ps 211: end