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

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

[Source]

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

Yield a hash for each row in the dataset.

[Source]

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

[Validate]