Included Modules

Class Index [+]

Quicksearch

Dataset

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

Constants

DatasetClass
PREPARED_ARG_PLACEHOLDER

Public Instance Methods

call(type, bind_vars={}, *values, &block) click to toggle source

Execute the given type of statement with the hash of values.

     # File lib/sequel/adapters/sqlite.rb, line 342
342:       def call(type, bind_vars={}, *values, &block)
343:         ps = to_prepared_statement(type, values)
344:         ps.extend(BindArgumentMethods)
345:         ps.call(bind_vars, &block)
346:       end
fetch_rows(sql) click to toggle source

Yield a hash for each row in the dataset.

     # File lib/sequel/adapters/sqlite.rb, line 349
349:       def fetch_rows(sql)
350:         execute(sql) do |result|
351:           i = 1
352:           cps = db.conversion_procs
353:           type_procs = result.types.map{|t| cps[base_type_name(t)]}
354:           cols = result.columns.map{|c| i+=1; [output_identifier(c), i, type_procs[i]]}
355:           @columns = cols.map{|c| c.first}
356:           result.each do |values|
357:             row = {}
358:             cols.each do |name,i,type_proc|
359:               v = values[i]
360:               if type_proc && v
361:                 v = type_proc.call(v)
362:               end
363:               row[name] = v
364:             end
365:             yield row
366:           end
367:         end
368:       end
prepare(type, name=nil, *values) click to toggle source

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 373
373:       def prepare(type, name=nil, *values)
374:         ps = to_prepared_statement(type, values)
375:         ps.extend(PreparedStatementMethods)
376:         if name
377:           ps.prepared_statement_name = name
378:           db.set_prepared_statement(name, ps)
379:         end
380:         ps
381:       end

Private Instance Methods

base_type_name(t) click to toggle source

The base type name for a given type, without any parenthetical part.

     # File lib/sequel/adapters/sqlite.rb, line 386
386:       def base_type_name(t)
387:         (t =~ /^(.*?)\(/ ? $1 : t).downcase if t
388:       end
literal_string_append(sql, v) click to toggle source

Quote the string using the adapter class method.

     # File lib/sequel/adapters/sqlite.rb, line 391
391:       def literal_string_append(sql, v)
392:         sql << "'" << ::SQLite3::Database.quote(v) << "'"
393:       end
prepared_arg_placeholder() click to toggle source

SQLite uses a : before the name of the argument as a placeholder.

     # File lib/sequel/adapters/sqlite.rb, line 396
396:       def prepared_arg_placeholder
397:         PREPARED_ARG_PLACEHOLDER
398:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.