Module Sequel::SQLite::DatabaseMethods
In: lib/sequel/adapters/shared/sqlite.rb

Methods

Constants

AUTO_VACUUM = [:none, :full, :incremental].freeze
SYNCHRONOUS = [:off, :normal, :full].freeze
TABLES_FILTER = "type = 'table' AND NOT name = 'sqlite_sequence'"
TEMP_STORE = [:default, :file, :memory].freeze
TYPES = Sequel::Database::TYPES.merge(Bignum=>'integer')

Public Instance methods

Run all alter_table commands in a transaction. This is technically only needed for drop column.

[Source]

    # File lib/sequel/adapters/shared/sqlite.rb, line 14
14:       def alter_table(name, generator=nil, &block)
15:         transaction{super}
16:       end

A symbol signifying the value of the auto_vacuum PRAGMA.

[Source]

    # File lib/sequel/adapters/shared/sqlite.rb, line 19
19:       def auto_vacuum
20:         AUTO_VACUUM[pragma_get(:auto_vacuum).to_i]
21:       end

Set the auto_vacuum PRAGMA using the given symbol (:none, :full, or :incremental).

[Source]

    # File lib/sequel/adapters/shared/sqlite.rb, line 25
25:       def auto_vacuum=(value)
26:         value = AUTO_VACUUM.index(value) || (raise Error, "Invalid value for auto_vacuum option. Please specify one of :none, :full, :incremental.")
27:         pragma_set(:auto_vacuum, value)
28:       end

Get the value of the given PRAGMA.

[Source]

    # File lib/sequel/adapters/shared/sqlite.rb, line 31
31:       def pragma_get(name)
32:         self["PRAGMA #{name}"].single_value
33:       end

Set the value of the given PRAGMA to value.

[Source]

    # File lib/sequel/adapters/shared/sqlite.rb, line 36
36:       def pragma_set(name, value)
37:         execute_ddl("PRAGMA #{name} = #{value}")
38:       end

A symbol signifying the value of the synchronous PRAGMA.

[Source]

    # File lib/sequel/adapters/shared/sqlite.rb, line 41
41:       def synchronous
42:         SYNCHRONOUS[pragma_get(:synchronous).to_i]
43:       end

Set the synchronous PRAGMA using the given symbol (:off, :normal, or :full).

[Source]

    # File lib/sequel/adapters/shared/sqlite.rb, line 46
46:       def synchronous=(value)
47:         value = SYNCHRONOUS.index(value) || (raise Error, "Invalid value for synchronous option. Please specify one of :off, :normal, :full.")
48:         pragma_set(:synchronous, value)
49:       end

Array of symbols specifying the table names in the current database.

Options:

  • :server - Set the server to use.

[Source]

    # File lib/sequel/adapters/shared/sqlite.rb, line 55
55:       def tables(opts={})
56:         ds = self[:sqlite_master].server(opts[:server]).filter(TABLES_FILTER)
57:         ds.identifier_output_method = nil
58:         ds.identifier_input_method = nil
59:         ds2 = dataset
60:         ds.map{|r| ds2.send(:output_identifier, r[:name])}
61:       end

A symbol signifying the value of the temp_store PRAGMA.

[Source]

    # File lib/sequel/adapters/shared/sqlite.rb, line 64
64:       def temp_store
65:         TEMP_STORE[pragma_get(:temp_store).to_i]
66:       end

Set the temp_store PRAGMA using the given symbol (:default, :file, or :memory).

[Source]

    # File lib/sequel/adapters/shared/sqlite.rb, line 69
69:       def temp_store=(value)
70:         value = TEMP_STORE.index(value) || (raise Error, "Invalid value for temp_store option. Please specify one of :default, :file, :memory.")
71:         pragma_set(:temp_store, value)
72:       end

[Validate]