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 192
192:       def call(type, hash, values=nil, &block)
193:         prepare(type, nil, values).call(hash, &block)
194:       end

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

[Source]

     # File lib/sequel/adapters/sqlite.rb, line 198
198:       def explain
199:         res = []
200:         @db.result_set(EXPLAIN % select_sql(opts), nil) {|r| res << r}
201:         res
202:       end

Yield a hash for each row in the dataset.

[Source]

     # File lib/sequel/adapters/sqlite.rb, line 205
205:       def fetch_rows(sql)
206:         execute(sql) do |result|
207:           @columns = result.columns.map{|c| output_identifier(c)}
208:           column_count = @columns.size
209:           result.each do |values|
210:             row = {}
211:             column_count.times {|i| row[@columns[i]] = values[i]}
212:             yield row
213:           end
214:         end
215:       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 220
220:       def prepare(type, name=nil, values=nil)
221:         ps = to_prepared_statement(type, values)
222:         ps.extend(PreparedStatementMethods)
223:         db.prepared_statements[name] = ps if name
224:         ps
225:       end

[Validate]