Class Sequel::SQLite::Dataset
In: lib/sequel/adapters/sqlite.rb
Parent: Sequel::Dataset

Dataset class for SQLite datasets that use the ruby-sqlite3 driver.

Methods

call   explain   fetch_rows   prepare  

Included Modules

::Sequel::SQLite::DatasetMethods

Classes and Modules

Module Sequel::SQLite::Dataset::ArgumentMapper
Module Sequel::SQLite::Dataset::PreparedStatementMethods

Constants

EXPLAIN = 'EXPLAIN %s'.freeze
PREPARED_ARG_PLACEHOLDER = ':'.freeze

Public Instance methods

Prepare an unnamed statement of the given type and call it with the given values.

[Source]

     # File lib/sequel/adapters/sqlite.rb, line 177
177:       def call(type, hash, values=nil, &block)
178:         prepare(type, nil, values).call(hash, &block)
179:       end

Return an array of strings specifying a query explanation for the current dataset.

[Source]

     # 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.

[Source]

     # 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.

[Source]

     # 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

[Validate]