### Home Classes Methods

### In Files

- lib/sequel/adapters/shared/sqlite.rb

### Methods

- #alter_table_sql
- #apply_alter_table
- #auto_vacuum
- #auto_vacuum=
- #backup_table_name
- #case_sensitive_like
- #case_sensitive_like=
- #column_definition_default_sql
- #connection_pragmas
- #database_type
- #defined_columns_for
- #duplicate_table
- #foreign_keys
- #foreign_keys=
- #identifier_input_method_default
- #identifier_output_method_default
- #indexes
- #on_delete_sql_to_sym
- #parse_pragma
- #pragma_get
- #pragma_set
- #schema_autoincrementing_primary_key?
- #schema_parse_table
- #set_integer_booleans
- #sqlite_version
- #supports_create_table_if_not_exists?
- #supports_savepoints?
- #synchronous
- #synchronous=
- #tables
- #tables_and_views
- #temp_store
- #temp_store=
- #type_literal_generic_bignum
- #use_timestamp_timezones?
- #views

### Files

- CHANGELOG
- MIT-LICENSE
- README.rdoc
- active_record.rdoc
- advanced_associations.rdoc
- association_basics.rdoc
- cheat_sheet.rdoc
- dataset_basics.rdoc
- dataset_filtering.rdoc
- mass_assignment.rdoc
- migration.rdoc
- model_hooks.rdoc
- opening_databases.rdoc
- prepared_statements.rdoc
- querying.rdoc
- reflection.rdoc
- 1.0.txt
- 1.1.txt
- 1.3.txt
- 1.4.0.txt
- 1.5.0.txt
- 2.0.0.txt
- 2.1.0.txt
- 2.10.0.txt
- 2.11.0.txt
- 2.12.0.txt
- 2.2.0.txt
- 2.3.0.txt
- 2.4.0.txt
- 2.5.0.txt
- 2.6.0.txt
- 2.7.0.txt
- 2.8.0.txt
- 2.9.0.txt
- 3.0.0.txt
- 3.1.0.txt
- 3.10.0.txt
- 3.11.0.txt
- 3.12.0.txt
- 3.13.0.txt
- 3.14.0.txt
- 3.15.0.txt
- 3.16.0.txt
- 3.17.0.txt
- 3.18.0.txt
- 3.19.0.txt
- 3.2.0.txt
- 3.20.0.txt
- 3.21.0.txt
- 3.22.0.txt
- 3.23.0.txt
- 3.24.0.txt
- 3.25.0.txt
- 3.26.0.txt
- 3.27.0.txt
- 3.28.0.txt
- 3.29.0.txt
- 3.3.0.txt
- 3.30.0.txt
- 3.31.0.txt
- 3.32.0.txt
- 3.33.0.txt
- 3.4.0.txt
- 3.5.0.txt
- 3.6.0.txt
- 3.7.0.txt
- 3.8.0.txt
- 3.9.0.txt
- schema_modification.rdoc
- sharding.rdoc
- sql.rdoc
- testing.rdoc
- transactions.rdoc
- validations.rdoc
- virtual_rows.rdoc

### Class Index

Quicksearch

- Sequel
- Sequel::ADO
- Sequel::ADO::Database
- Sequel::ADO::Dataset
- Sequel::ADO::MSSQL
- Sequel::ADO::MSSQL::DatabaseMethods
- Sequel::ADO::MSSQL::Dataset
- Sequel::ASTTransformer
- Sequel::Access
- Sequel::Access::DatabaseMethods
- Sequel::Access::DatasetMethods
- Sequel::Adapter
- Sequel::AdapterNotFound
- Sequel::AdapterNotFound
- Sequel::Amalgalite
- Sequel::Amalgalite::Database
- Sequel::Amalgalite::Dataset
- Sequel::Amalgalite::SequelTypeMap
- Sequel::ArbitraryServers
- Sequel::BasicObject
- Sequel::ColumnsIntrospection
- Sequel::ConnectionPool
- Sequel::ConnectionPool::ClassMethods
- Sequel::DB2
- Sequel::DB2::DB2Error
- Sequel::DB2::Database
- Sequel::DB2::DatabaseMethods
- Sequel::DB2::Dataset
- Sequel::DB2::DatasetMethods
- Sequel::DBI
- Sequel::DBI::Database
- Sequel::DBI::Dataset
- Sequel::DataObjects
- Sequel::DataObjects::Database
- Sequel::DataObjects::Dataset
- Sequel::DataObjects::MySQL
- Sequel::DataObjects::MySQL::DatabaseMethods
- Sequel::DataObjects::MySQL::Dataset
- Sequel::DataObjects::Postgres
- Sequel::DataObjects::Postgres::AdapterMethods
- Sequel::DataObjects::Postgres::DatabaseMethods
- Sequel::DataObjects::Postgres::Dataset
- Sequel::DataObjects::SQLite
- Sequel::DataObjects::SQLite::DatabaseMethods
- Sequel::DataObjects::SQLite::Dataset
- Sequel::Database
- Sequel::DatabaseConnectionError
- Sequel::DatabaseDisconnectError
- Sequel::DatabaseError
- Sequel::Dataset
- Sequel::Dataset
- Sequel::Dataset::ArgumentMapper
- Sequel::Dataset::BindArgumentMethods
- Sequel::Dataset::Pagination
- Sequel::Dataset::PreparedStatementMethods
- Sequel::Dataset::QueryBlockCopy
- Sequel::Dataset::StoredProcedureMethods
- Sequel::Dataset::StoredProcedures
- Sequel::Dataset::TYPE_TRANSLATOR
- Sequel::Dataset::UnnumberedArgumentMapper
- Sequel::EmulateOffsetWithRowNumber
- Sequel::Error
- Sequel::Firebird
- Sequel::Firebird::Database
- Sequel::Firebird::DatabaseMethods
- Sequel::Firebird::Dataset
- Sequel::Firebird::DatasetMethods
- Sequel::HookFailed
- Sequel::HookFailed
- Sequel::IBMDB
- Sequel::IBMDB::Connection
- Sequel::IBMDB::Connection::Error
- Sequel::IBMDB::Database
- Sequel::IBMDB::Dataset
- Sequel::IBMDB::Dataset::CallableStatementMethods
- Sequel::IBMDB::Dataset::PreparedStatementMethods
- Sequel::IBMDB::Statement
- Sequel::Inflections
- Sequel::Informix
- Sequel::Informix::Database
- Sequel::Informix::DatabaseMethods
- Sequel::Informix::Dataset
- Sequel::Informix::DatasetMethods
- Sequel::IntegerMigrator
- Sequel::InvalidOperation
- Sequel::InvalidOperation
- Sequel::InvalidValue
- Sequel::InvalidValue
- Sequel::JDBC
- Sequel::JDBC::AS400
- Sequel::JDBC::AS400::DatabaseMethods
- Sequel::JDBC::AS400::Dataset
- Sequel::JDBC::DB2
- Sequel::JDBC::DB2::DatabaseMethods
- Sequel::JDBC::DB2::Dataset
- Sequel::JDBC::Database
- Sequel::JDBC::Derby
- Sequel::JDBC::Derby::DatabaseMethods
- Sequel::JDBC::Derby::Dataset
- Sequel::JDBC::Firebird
- Sequel::JDBC::Firebird::DatabaseMethods
- Sequel::JDBC::Firebird::Dataset
- Sequel::JDBC::H2
- Sequel::JDBC::H2::DatabaseMethods
- Sequel::JDBC::H2::Dataset
- Sequel::JDBC::HSQLDB
- Sequel::JDBC::HSQLDB::DatabaseMethods
- Sequel::JDBC::HSQLDB::Dataset
- Sequel::JDBC::Informix
- Sequel::JDBC::Informix::DatabaseMethods
- Sequel::JDBC::Informix::Dataset
- Sequel::JDBC::JTDS
- Sequel::JDBC::JTDS::DatabaseMethods
- Sequel::JDBC::JTDS::Dataset
- Sequel::JDBC::JavaLang
- Sequel::JDBC::JavaSQL
- Sequel::JDBC::JavaxNaming
- Sequel::JDBC::MSSQL
- Sequel::JDBC::MSSQL::DatabaseMethods
- Sequel::JDBC::MySQL
- Sequel::JDBC::MySQL::DatabaseMethods
- Sequel::JDBC::MySQL::Dataset
- Sequel::JDBC::Oracle
- Sequel::JDBC::Oracle::DatabaseMethods
- Sequel::JDBC::Oracle::Dataset
- Sequel::JDBC::Postgres
- Sequel::JDBC::Postgres::AdapterMethods
- Sequel::JDBC::Postgres::DatabaseMethods
- Sequel::JDBC::Postgres::Dataset
- Sequel::JDBC::SQLServer
- Sequel::JDBC::SQLServer::DatabaseMethods
- Sequel::JDBC::SQLServer::DatabaseMethods::MetadataDatasetMethods
- Sequel::JDBC::SQLServer::Dataset
- Sequel::JDBC::SQLite
- Sequel::JDBC::SQLite::DatabaseMethods
- Sequel::JDBC::SQLite::Dataset
- Sequel::JDBC::Transactions
- Sequel::LiteralString
- Sequel::LooserTypecasting
- Sequel::MSSQL
- Sequel::MSSQL::DatabaseMethods
- Sequel::MSSQL::DatasetMethods
- Sequel::Metaprogramming
- Sequel::Migration
- Sequel::MigrationAlterTableReverser
- Sequel::MigrationDSL
- Sequel::MigrationReverser
- Sequel::Migrator
- Sequel::Migrator::Error
- Sequel::Mock
- Sequel::Mock::Connection
- Sequel::Mock::Database
- Sequel::Mock::Dataset
- Sequel::Model
- Sequel::Model::Associations
- Sequel::Model::Associations::AssociationDatasetMethods
- Sequel::Model::Associations::AssociationReflection
- Sequel::Model::Associations::ClassMethods
- Sequel::Model::Associations::DatasetMethods
- Sequel::Model::Associations::EagerGraphLoader
- Sequel::Model::Associations::InstanceMethods
- Sequel::Model::Associations::ManyToManyAssociationReflection
- Sequel::Model::Associations::ManyToOneAssociationReflection
- Sequel::Model::Associations::OneToManyAssociationReflection
- Sequel::Model::Associations::OneToOneAssociationReflection
- Sequel::Model::ClassMethods
- Sequel::Model::DatasetMethods
- Sequel::Model::Errors
- Sequel::Model::InstanceMethods
- Sequel::MySQL
- Sequel::MySQL::DatabaseMethods
- Sequel::MySQL::DatasetMethods
- Sequel::MySQL::DatasetMethods::CallableStatementMethods
- Sequel::MySQL::DatasetMethods::PreparedStatementMethods
- Sequel::MySQL::DatasetMethods::StoredProcedureMethods
- Sequel::MySQL::PreparedStatements
- Sequel::MySQL::PreparedStatements::DatabaseMethods
- Sequel::Mysql2
- Sequel::Mysql2::Database
- Sequel::Mysql2::Dataset
- Sequel::NamedTimezones
- Sequel::NoExistingObject
- Sequel::NoExistingObject
- Sequel::NotImplemented
- Sequel::ODBC
- Sequel::ODBC::DB2
- Sequel::ODBC::DB2::DatabaseMethods
- Sequel::ODBC::DB2::Dataset
- Sequel::ODBC::Database
- Sequel::ODBC::Dataset
- Sequel::ODBC::MSSQL
- Sequel::ODBC::MSSQL::DatabaseMethods
- Sequel::ODBC::MSSQL::Dataset
- Sequel::OpenBase
- Sequel::OpenBase::Database
- Sequel::OpenBase::Dataset
- Sequel::Oracle
- Sequel::Oracle::Database
- Sequel::Oracle::DatabaseMethods
- Sequel::Oracle::DatasetMethods
- Sequel::Plugins
- Sequel::Plugins::ActiveModel
- Sequel::Plugins::ActiveModel::ClassMethods
- Sequel::Plugins::ActiveModel::InstanceMethods
- Sequel::Plugins::AssociationAutoreloading
- Sequel::Plugins::AssociationAutoreloading::ClassMethods
- Sequel::Plugins::AssociationDependencies
- Sequel::Plugins::AssociationDependencies::ClassMethods
- Sequel::Plugins::AssociationDependencies::InstanceMethods
- Sequel::Plugins::AssociationPks
- Sequel::Plugins::AssociationPks::ClassMethods
- Sequel::Plugins::AssociationPks::InstanceMethods
- Sequel::Plugins::AssociationProxies
- Sequel::Plugins::AssociationProxies::AssociationProxy
- Sequel::Plugins::AssociationProxies::ClassMethods
- Sequel::Plugins::BooleanReaders
- Sequel::Plugins::BooleanReaders::ClassMethods
- Sequel::Plugins::Caching
- Sequel::Plugins::Caching::ClassMethods
- Sequel::Plugins::Caching::InstanceMethods
- Sequel::Plugins::ClassTableInheritance
- Sequel::Plugins::ClassTableInheritance::ClassMethods
- Sequel::Plugins::ClassTableInheritance::InstanceMethods
- Sequel::Plugins::Composition
- Sequel::Plugins::Composition::ClassMethods
- Sequel::Plugins::Composition::InstanceMethods
- Sequel::Plugins::DatasetAssociations
- Sequel::Plugins::DatasetAssociations::ClassMethods
- Sequel::Plugins::DatasetAssociations::DatasetMethods
- Sequel::Plugins::DefaultsSetter
- Sequel::Plugins::DefaultsSetter::ClassMethods
- Sequel::Plugins::DefaultsSetter::InstanceMethods
- Sequel::Plugins::ForceEncoding
- Sequel::Plugins::ForceEncoding::ClassMethods
- Sequel::Plugins::ForceEncoding::InstanceMethods
- Sequel::Plugins::HookClassMethods
- Sequel::Plugins::HookClassMethods::ClassMethods
- Sequel::Plugins::HookClassMethods::InstanceMethods
- Sequel::Plugins::IdentityMap
- Sequel::Plugins::IdentityMap::ClassMethods
- Sequel::Plugins::IdentityMap::InstanceMethods
- Sequel::Plugins::InstanceFilters
- Sequel::Plugins::InstanceFilters::InstanceMethods
- Sequel::Plugins::InstanceHooks
- Sequel::Plugins::InstanceHooks::InstanceMethods
- Sequel::Plugins::JsonSerializer
- Sequel::Plugins::JsonSerializer::ClassMethods
- Sequel::Plugins::JsonSerializer::DatasetMethods
- Sequel::Plugins::JsonSerializer::InstanceMethods
- Sequel::Plugins::JsonSerializer::Literal
- Sequel::Plugins::LazyAttributes
- Sequel::Plugins::LazyAttributes::ClassMethods
- Sequel::Plugins::LazyAttributes::InstanceMethods
- Sequel::Plugins::List
- Sequel::Plugins::List::ClassMethods
- Sequel::Plugins::List::InstanceMethods
- Sequel::Plugins::ManyThroughMany
- Sequel::Plugins::ManyThroughMany::ClassMethods
- Sequel::Plugins::ManyThroughMany::DatasetMethods
- Sequel::Plugins::ManyThroughMany::ManyThroughManyAssociationReflection
- Sequel::Plugins::NestedAttributes
- Sequel::Plugins::NestedAttributes::ClassMethods
- Sequel::Plugins::NestedAttributes::InstanceMethods
- Sequel::Plugins::OptimisticLocking
- Sequel::Plugins::OptimisticLocking::ClassMethods
- Sequel::Plugins::OptimisticLocking::InstanceMethods
- Sequel::Plugins::PreparedStatements
- Sequel::Plugins::PreparedStatements::ClassMethods
- Sequel::Plugins::PreparedStatements::InstanceMethods
- Sequel::Plugins::PreparedStatementsAssociations
- Sequel::Plugins::PreparedStatementsAssociations::ClassMethods
- Sequel::Plugins::PreparedStatementsAssociations::InstanceMethods
- Sequel::Plugins::PreparedStatementsSafe
- Sequel::Plugins::PreparedStatementsSafe::ClassMethods
- Sequel::Plugins::PreparedStatementsSafe::InstanceMethods
- Sequel::Plugins::PreparedStatementsWithPk
- Sequel::Plugins::PreparedStatementsWithPk::ClassMethods
- Sequel::Plugins::PreparedStatementsWithPk::DatasetMethods
- Sequel::Plugins::RcteTree
- Sequel::Plugins::Schema
- Sequel::Plugins::Schema::ClassMethods
- Sequel::Plugins::Serialization
- Sequel::Plugins::Serialization::ClassMethods
- Sequel::Plugins::Serialization::InstanceMethods
- Sequel::Plugins::SerializationModificationDetection
- Sequel::Plugins::SerializationModificationDetection::InstanceMethods
- Sequel::Plugins::Sharding
- Sequel::Plugins::Sharding::ClassMethods
- Sequel::Plugins::Sharding::DatasetMethods
- Sequel::Plugins::Sharding::InstanceMethods
- Sequel::Plugins::SingleTableInheritance
- Sequel::Plugins::SingleTableInheritance::ClassMethods
- Sequel::Plugins::SingleTableInheritance::InstanceMethods
- Sequel::Plugins::SkipCreateRefresh
- Sequel::Plugins::SkipCreateRefresh::InstanceMethods
- Sequel::Plugins::StringStripper
- Sequel::Plugins::StringStripper::InstanceMethods
- Sequel::Plugins::Subclasses
- Sequel::Plugins::Subclasses::ClassMethods
- Sequel::Plugins::TacticalEagerLoading
- Sequel::Plugins::TacticalEagerLoading::DatasetMethods
- Sequel::Plugins::TacticalEagerLoading::InstanceMethods
- Sequel::Plugins::Timestamps
- Sequel::Plugins::Timestamps::ClassMethods
- Sequel::Plugins::Timestamps::InstanceMethods
- Sequel::Plugins::Touch
- Sequel::Plugins::Touch::ClassMethods
- Sequel::Plugins::Touch::InstanceMethods
- Sequel::Plugins::Tree
- Sequel::Plugins::Tree::ClassMethods
- Sequel::Plugins::Tree::InstanceMethods
- Sequel::Plugins::Tree::SingleRoot
- Sequel::Plugins::Tree::SingleRoot::ClassMethods
- Sequel::Plugins::Tree::SingleRoot::InstanceMethods
- Sequel::Plugins::Tree::TreeMultipleRootError
- Sequel::Plugins::TypecastOnLoad
- Sequel::Plugins::TypecastOnLoad::ClassMethods
- Sequel::Plugins::TypecastOnLoad::InstanceMethods
- Sequel::Plugins::UpdatePrimaryKey
- Sequel::Plugins::UpdatePrimaryKey::ClassMethods
- Sequel::Plugins::UpdatePrimaryKey::InstanceMethods
- Sequel::Plugins::ValidationClassMethods
- Sequel::Plugins::ValidationClassMethods::ClassMethods
- Sequel::Plugins::ValidationClassMethods::ClassMethods::Generator
- Sequel::Plugins::ValidationClassMethods::InstanceMethods
- Sequel::Plugins::ValidationHelpers
- Sequel::Plugins::ValidationHelpers::InstanceMethods
- Sequel::Plugins::XmlSerializer
- Sequel::Plugins::XmlSerializer::ClassMethods
- Sequel::Plugins::XmlSerializer::DatasetMethods
- Sequel::Plugins::XmlSerializer::InstanceMethods
- Sequel::PoolTimeout
- Sequel::PoolTimeout
- Sequel::Postgres
- Sequel::Postgres::AdapterMethods
- Sequel::Postgres::DatabaseMethods
- Sequel::Postgres::DatasetMethods
- Sequel::Postgres::DatasetMethods::PreparedStatementMethods
- Sequel::PrettyTable
- Sequel::Progress
- Sequel::Progress::DatabaseMethods
- Sequel::Progress::DatasetMethods
- Sequel::Qualifier
- Sequel::Rollback
- Sequel::Rollback
- Sequel::SQL
- Sequel::SQL::AliasMethods
- Sequel::SQL::AliasedExpression
- Sequel::SQL::BitwiseMethods
- Sequel::SQL::Blob
- Sequel::SQL::BooleanConstant
- Sequel::SQL::BooleanExpression
- Sequel::SQL::BooleanMethods
- Sequel::SQL::CaseExpression
- Sequel::SQL::Cast
- Sequel::SQL::CastMethods
- Sequel::SQL::ColumnAll
- Sequel::SQL::ComplexExpression
- Sequel::SQL::ComplexExpressionMethods
- Sequel::SQL::Constant
- Sequel::SQL::Constants
- Sequel::SQL::Expression
- Sequel::SQL::Function
- Sequel::SQL::GenericComplexExpression
- Sequel::SQL::GenericExpression
- Sequel::SQL::Identifier
- Sequel::SQL::IdentifierMethods
- Sequel::SQL::InequalityMethods
- Sequel::SQL::JoinClause
- Sequel::SQL::JoinOnClause
- Sequel::SQL::JoinUsingClause
- Sequel::SQL::NegativeBooleanConstant
- Sequel::SQL::NoBooleanInputMethods
- Sequel::SQL::NumericExpression
- Sequel::SQL::NumericMethods
- Sequel::SQL::OrderMethods
- Sequel::SQL::OrderedExpression
- Sequel::SQL::PlaceholderLiteralString
- Sequel::SQL::QualifiedIdentifier
- Sequel::SQL::QualifyingMethods
- Sequel::SQL::StringConcatenationMethods
- Sequel::SQL::StringExpression
- Sequel::SQL::StringMethods
- Sequel::SQL::Subscript
- Sequel::SQL::SubscriptMethods
- Sequel::SQL::ValueList
- Sequel::SQL::ValueList
- Sequel::SQL::VirtualRow
- Sequel::SQL::Window
- Sequel::SQL::WindowFunction
- Sequel::SQLTime
- Sequel::SQLite
- Sequel::SQLite::DatabaseMethods
- Sequel::SQLite::DatasetMethods
- Sequel::Schema
- Sequel::Schema::AlterTableGenerator
- Sequel::Schema::Generator
- Sequel::ServerBlock
- Sequel::ShardedSingleConnectionPool
- Sequel::ShardedThreadedConnectionPool
- Sequel::SimpleMigration
- Sequel::SingleConnectionPool
- Sequel::Swift
- Sequel::Swift::Database
- Sequel::Swift::Dataset
- Sequel::Swift::MySQL
- Sequel::Swift::MySQL::DatabaseMethods
- Sequel::Swift::MySQL::Dataset
- Sequel::Swift::Postgres
- Sequel::Swift::Postgres::AdapterMethods
- Sequel::Swift::Postgres::DatabaseMethods
- Sequel::Swift::Postgres::Dataset
- Sequel::Swift::SQLite
- Sequel::Swift::SQLite::DatabaseMethods
- Sequel::Swift::SQLite::Dataset
- Sequel::ThreadLocalTimezones
- Sequel::ThreadedConnectionPool
- Sequel::ThreadedServerBlock
- Sequel::TimestampMigrator
- Sequel::Timezones
- Sequel::TinyTDS
- Sequel::TinyTDS::Database
- Sequel::TinyTDS::Dataset
- Sequel::TinyTDS::Dataset::ArgumentMapper
- Sequel::TinyTDS::Dataset::PreparedStatementMethods
- Sequel::ToDot
- Sequel::UnbindDuplicate
- Sequel::Unbinder
- Sequel::UndefinedAssociation
- Sequel::UnthreadedServerBlock
- Sequel::ValidationFailed
- Dataset
- Dataset::ArgumentMapper
- Dataset::BindArgumentMethods
- Dataset::PreparedStatementMethods
- String
- String::Inflections
- Array
- FalseClass
- Hash
- NilClass
- Numeric
- Object
- PGconn
- PGresult
- Proc
- Symbol
- TrueClass

No matching classes.

# Sequel::SQLite::DatabaseMethods

No matter how you connect to SQLite, the following Database options can be used to set PRAGMAs on connections in a thread-safe manner: :auto_vacuum, :foreign_keys, :synchronous, and :temp_store.

### Constants

AUTO_VACUUM
PRIMARY_KEY_INDEX_RE
SYNCHRONOUS
TABLES_FILTER
TEMP_STORE
VIEWS_FILTER

### Attributes

integer_booleans[RW]

Whether to use integers for booleans in the database. SQLite recommends booleans be stored as integers, but historically Sequel has used ‘t’/’f’.

use_timestamp_timezones[W]

Override the default setting for whether to use timezones in timestamps. For backwards compatibility, it is set to `true` by default. Anyone wanting to use SQLite’s datetime functions should set it to `false` using this method. It’s possible that the default will change in a future version, so anyone relying on timezones in timestamps should set this to `true`.

### Public Instance Methods

auto_vacuum() click to toggle source

A symbol signifying the value of the auto_vacuum PRAGMA.

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

auto_vacuum=(value) click to toggle source

Set the auto_vacuum PRAGMA using the given symbol (:none, :full, or :incremental). See pragma_set. Consider using the :auto_vacuum Database option instead.

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

case_sensitive_like() click to toggle source

Boolean signifying the value of the case_sensitive_likePRAGMA, or nil if not using SQLite 3.2.3+.

        # File lib/sequel/adapters/shared/sqlite.rb, line 33
    33:       def case_sensitive_like
    34:         pragma_get(:case_sensitive_like).to_i == 1 if sqlite_version >= 30203
    35:       end

case_sensitive_like=(value) click to toggle source

Set the case_sensitive_like PRAGMA using the given boolean value, if using SQLite 3.2.3+. If not using 3.2.3+, no error is raised. See pragma_set. Consider using the :case_sensitive_like Database option instead.

        # File lib/sequel/adapters/shared/sqlite.rb, line 40
    40:       def case_sensitive_like=(value)
    41:         pragma_set(:case_sensitive_like, !!value ? 'on' : 'off') if sqlite_version >= 30203
    42:       end

database_type() click to toggle source

SQLite uses the :sqlite database type.

        # File lib/sequel/adapters/shared/sqlite.rb, line 45
    45:       def database_type
    46:         :sqlite
    47:       end

foreign_keys() click to toggle source

Boolean signifying the value of the foreign_keys PRAGMA, or nil if not using SQLite 3.6.19+.

        # File lib/sequel/adapters/shared/sqlite.rb, line 51
    51:       def foreign_keys
    52:         pragma_get(:foreign_keys).to_i == 1 if sqlite_version >= 30619
    53:       end

foreign_keys=(value) click to toggle source

Set the foreign_keys PRAGMA using the given boolean value, if using SQLite 3.6.19+. If not using 3.6.19+, no error is raised. See pragma_set. Consider using the :foreign_keys Database option instead.

        # File lib/sequel/adapters/shared/sqlite.rb, line 58
    58:       def foreign_keys=(value)
    59:         pragma_set(:foreign_keys, !!value ? 'on' : 'off') if sqlite_version >= 30619
    60:       end

indexes(table, opts={}) click to toggle source

Use the index_list and index_info PRAGMAs to determine the indexes on the table.

        # File lib/sequel/adapters/shared/sqlite.rb, line 63
    63:       def indexes(table, opts={})
    64:         m = output_identifier_meth
    65:         im = input_identifier_meth
    66:         indexes = {}
    67:         begin
    68:           metadata_dataset.with_sql("PRAGMA index_list(?)", im.call(table)).each do |r|
    69:             next if r[:name] =~ PRIMARY_KEY_INDEX_RE
    70:             indexes[m.call(r[:name])] = {:unique=>r[:unique].to_i==1}
    71:           end
    72:         rescue Sequel::DatabaseError
    73:           nil
    74:         else
    75:           indexes.each do |k, v|
    76:             v[:columns] = metadata_dataset.with_sql("PRAGMA index_info(?)", im.call(k)).map(:name).map{|x| m.call(x)}
    77:           end
    78:         end
    79:         indexes
    80:       end

pragma_get(name) click to toggle source

Get the value of the given PRAGMA.

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

pragma_set(name, value) click to toggle source

Set the value of the given PRAGMA to value.

This method is not thread safe, and will not work correctly if there are multiple connections in the Database’s connection pool. PRAGMA modifications should be done when the connection is created, using an option provided when creating the Database object.

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

set_integer_booleans() click to toggle source

Set the integer_booleans option using the passed in :integer_boolean option.

         # File lib/sequel/adapters/shared/sqlite.rb, line 98
     98:       def set_integer_booleans
     99:         @integer_booleans = typecast_value_boolean(@opts[:integer_booleans])
    100:       end

sqlite_version() click to toggle source

The version of the server as an integer, where 3.6.19 = 30619. If the server version can’t be determined, 0 is used.

         # File lib/sequel/adapters/shared/sqlite.rb, line 104
    104:       def sqlite_version
    105:         return @sqlite_version if defined?(@sqlite_version)
    106:         @sqlite_version = begin
    107:           v = get{sqlite_version{}}
    108:           [10000, 100, 1].zip(v.split('.')).inject(0){|a, m| a + m[0] * Integer(m[1])}
    109:         rescue
    110:           0
    111:         end
    112:       end

supports_create_table_if_not_exists?() click to toggle source

SQLite supports CREATE TABLE IF NOT EXISTS syntax since 3.3.0.

         # File lib/sequel/adapters/shared/sqlite.rb, line 115
    115:       def supports_create_table_if_not_exists?
    116:         sqlite_version >= 30300
    117:       end

supports_savepoints?() click to toggle source

SQLite 3.6.8+ supports savepoints.

         # File lib/sequel/adapters/shared/sqlite.rb, line 120
    120:       def supports_savepoints?
    121:         sqlite_version >= 30608
    122:       end

synchronous() click to toggle source

A symbol signifying the value of the synchronous PRAGMA.

         # File lib/sequel/adapters/shared/sqlite.rb, line 138
    138:       def synchronous
    139:         SYNCHRONOUS[pragma_get(:synchronous).to_i]
    140:       end

synchronous=(value) click to toggle source

Set the synchronous PRAGMA using the given symbol (:off, :normal, or :full). See pragma_set. Consider using the :synchronous Database option instead.

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

tables(opts={}) click to toggle source

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

Options:

- :server - Set the server to use.

         # File lib/sequel/adapters/shared/sqlite.rb, line 153
    153:       def tables(opts={})
    154:         tables_and_views(TABLES_FILTER, opts)
    155:       end

temp_store() click to toggle source

A symbol signifying the value of the temp_store PRAGMA.

         # File lib/sequel/adapters/shared/sqlite.rb, line 158
    158:       def temp_store
    159:         TEMP_STORE[pragma_get(:temp_store).to_i]
    160:       end

temp_store=(value) click to toggle source

Set the temp_store PRAGMA using the given symbol (:default, :file, or :memory). See pragma_set. Consider using the :temp_store Database option instead.

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

use_timestamp_timezones?() click to toggle source

SQLite supports timezones in timestamps, since it just stores them as strings, but it breaks the usage of SQLite’s datetime functions.

         # File lib/sequel/adapters/shared/sqlite.rb, line 133
    133:       def use_timestamp_timezones?
    134:         defined?(@use_timestamp_timezones) ? @use_timestamp_timezones : (@use_timestamp_timezones = true)
    135:       end

views(opts={}) click to toggle source

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

Options:

- :server - Set the server to use.

         # File lib/sequel/adapters/shared/sqlite.rb, line 173
    173:       def views(opts={})
    174:         tables_and_views(VIEWS_FILTER, opts)
    175:       end

### Private Instance Methods

alter_table_sql(table, op) click to toggle source

SQLite supports limited table modification. You can add a column or an index. Dropping columns is supported by copying the table into a temporary table, dropping the table, and creating a new table without the column inside of a transaction.

         # File lib/sequel/adapters/shared/sqlite.rb, line 202
    202:       def alter_table_sql(table, op)
    203:         case op[:op]
    204:         when :add_index, :drop_index
    205:           super
    206:         when :add_column
    207:           if op[:unique] || op[:primary_key]
    208:             duplicate_table(table){|columns| columns.push(op)}
    209:           else
    210:             super
    211:           end
    212:         when :drop_column
    213:           ocp = lambda{|oc| oc.delete_if{|c| c.to_s == op[:name].to_s}}
    214:           duplicate_table(table, :old_columns_proc=>ocp){|columns| columns.delete_if{|s| s[:name].to_s == op[:name].to_s}}
    215:         when :rename_column
    216:           ncp = lambda{|nc| nc.map!{|c| c.to_s == op[:name].to_s ? op[:new_name] : c}}
    217:           duplicate_table(table, :new_columns_proc=>ncp){|columns| columns.each{|s| s[:name] = op[:new_name] if s[:name].to_s == op[:name].to_s}}
    218:         when :set_column_default
    219:           duplicate_table(table){|columns| columns.each{|s| s[:default] = op[:default] if s[:name].to_s == op[:name].to_s}}
    220:         when :set_column_null
    221:           duplicate_table(table){|columns| columns.each{|s| s[:null] = op[:null] if s[:name].to_s == op[:name].to_s}}
    222:         when :set_column_type
    223:           duplicate_table(table){|columns| columns.each{|s| s.merge!(op) if s[:name].to_s == op[:name].to_s}}
    224:         when :drop_constraint
    225:           case op[:type]
    226:           when :primary_key
    227:             duplicate_table(table){|columns| columns.each{|s| s[:primary_key] = nil}}
    228:           when :foreign_key
    229:             duplicate_table(table){|columns| columns.each{|s| s[:table] = nil}}
    230:           when :unique
    231:             duplicate_table(table)
    232:           else
    233:             raise Error, "Unsupported :type option for drop_constraint: #{op[:type].inspect}"
    234:           end
    235:         when :add_constraint
    236:           duplicate_table(table, :constraints=>[op])
    237:         when :add_constraints
    238:           duplicate_table(table, :constraints=>op[:ops])
    239:         else
    240:           raise Error, "Unsupported ALTER TABLE operation: #{op[:op].inspect}"
    241:         end
    242:       end

apply_alter_table(table, ops) click to toggle source

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

         # File lib/sequel/adapters/shared/sqlite.rb, line 181
    181:       def apply_alter_table(table, ops)
    182:         fks = foreign_keys
    183:         self.foreign_keys = false if fks
    184:         transaction do
    185:           if ops.length > 1 && ops.all?{|op| op[:op] == :add_constraint}
    186:             # If you are just doing constraints, apply all of them at the same time,
    187:             # as otherwise all but the last one get lost.
    188:             alter_table_sql_list(table, [{:op=>:add_constraints, :ops=>ops}]).flatten.each{|sql| execute_ddl(sql)}
    189:           else
    190:             # Run each operation separately, as later operations may depend on the
    191:             # results of earlier operations.
    192:             ops.each{|op| alter_table_sql_list(table, [op]).flatten.each{|sql| execute_ddl(sql)}}
    193:           end
    194:         end
    195:         self.foreign_keys = true if fks
    196:       end

backup_table_name(table, opts={}) click to toggle source

The array of column symbols in the table, except for ones given in opts[:except]

         # File lib/sequel/adapters/shared/sqlite.rb, line 245
    245:       def backup_table_name(table, opts={})
    246:         table = table.gsub('`', '')
    247:         (opts[:times]||1000).times do |i|
    248:           table_name = "#{table}_backup#{i}"
    249:           return table_name unless table_exists?(table_name)
    250:         end
    251:       end

column_definition_default_sql(sql, column) click to toggle source

Surround default with parens to appease SQLite

         # File lib/sequel/adapters/shared/sqlite.rb, line 254
    254:       def column_definition_default_sql(sql, column)
    255:         sql << " DEFAULT (#{literal(column[:default])})" if column.include?(:default)
    256:       end

connection_pragmas() click to toggle source

Array of PRAGMA SQL statements based on the Database options that should be applied to new connections.

         # File lib/sequel/adapters/shared/sqlite.rb, line 260
    260:       def connection_pragmas
    261:         ps = []
    262:         v = typecast_value_boolean(opts.fetch(:foreign_keys, 1))
    263:         ps << "PRAGMA foreign_keys = #{v ? 1 : 0}"
    264:         v = typecast_value_boolean(opts.fetch(:case_sensitive_like, 1))
    265:         ps << "PRAGMA case_sensitive_like = #{v ? 1 : 0}"
    266:         [[:auto_vacuum, AUTO_VACUUM], [:synchronous, SYNCHRONOUS], [:temp_store, TEMP_STORE]].each do |prag, con|
    267:           if v = opts[prag]
    268:             raise(Error, "Value for PRAGMA #{prag} not supported, should be one of #{con.join(', ')}") unless v = con.index(v.to_sym)
    269:             ps << "PRAGMA #{prag} = #{v}"
    270:           end
    271:         end
    272:         ps
    273:       end

defined_columns_for(table, opts={}) click to toggle source

The array of column schema hashes, except for the ones given in opts[:except]

         # File lib/sequel/adapters/shared/sqlite.rb, line 276
    276:       def defined_columns_for(table, opts={})
    277:         cols = parse_pragma(table, {})
    278:         cols.each do |c|
    279:           c[:default] = LiteralString.new(c[:default]) if c[:default]
    280:           c[:type] = c[:db_type]
    281:         end
    282:         if opts[:except]
    283:           nono= Array(opts[:except]).compact.map{|n| n.to_s}
    284:           cols.reject!{|c| nono.include? c[:name] }
    285:         end
    286:
    287:         begin
    288:           metadata_dataset.with_sql("PRAGMA foreign_key_list(?)", input_identifier_meth.call(table)).each do |row|
    289:             c = cols.find {|co| co[:name] == row[:from] } or next
    290:             c[:table] = row[:table]
    291:             c[:key] = row[:to]
    292:             c[:on_update] = on_delete_sql_to_sym(row[:on_update])
    293:             c[:on_delete] = on_delete_sql_to_sym(row[:on_delete])
    294:             # is there any way to get deferrable status?
    295:           end
    296:         rescue Sequel::DatabaseError
    297:           # Doesn't work correctly on some versions of JDBC SQLite,
    298:           # giving a "query does not return ResultSet" error.
    299:         end
    300:         cols
    301:       end

duplicate_table(table, opts={}) click to toggle source

Duplicate an existing table by creating a new table, copying all records from the existing table into the new table, deleting the existing table and renaming the new table to the existing table’s name.

         # File lib/sequel/adapters/shared/sqlite.rb, line 306
    306:       def duplicate_table(table, opts={})
    307:         remove_cached_schema(table)
    308:         def_columns = defined_columns_for(table)
    309:         old_columns = def_columns.map{|c| c[:name]}
    310:         opts[:old_columns_proc].call(old_columns) if opts[:old_columns_proc]
    311:
    312:         yield def_columns if block_given?
    313:
    314:         constraints = (opts[:constraints] || []).dup
    315:         pks = []
    316:         def_columns.each{|c| pks << c[:name] if c[:primary_key]}
    317:         if pks.length > 1
    318:           constraints << {:type=>:primary_key, :columns=>pks}
    319:           def_columns.each{|c| c[:primary_key] = false if c[:primary_key]}
    320:         end
    321:
    322:         def_columns_str = (def_columns.map{|c| column_definition_sql(c)} + constraints.map{|c| constraint_definition_sql(c)}).join(', ')
    323:         new_columns = old_columns.dup
    324:         opts[:new_columns_proc].call(new_columns) if opts[:new_columns_proc]
    325:
    326:         qt = quote_schema_table(table)
    327:         bt = quote_identifier(backup_table_name(qt))
    328:         a = [
    329:            "ALTER TABLE #{qt} RENAME TO #{bt}",
    330:            "CREATE TABLE #{qt}(#{def_columns_str})",
    331:            "INSERT INTO #{qt}(#{dataset.send(:identifier_list, new_columns)}) SELECT #{dataset.send(:identifier_list, old_columns)} FROM #{bt}",
    332:            "DROP TABLE #{bt}"
    333:         ]
    334:         indexes(table).each do |name, h|
    335:           if (h[:columns].map{|x| x.to_s} - new_columns).empty?
    336:             a << alter_table_sql(table, h.merge(:op=>:add_index, :name=>name))
    337:           end
    338:         end
    339:         a
    340:       end

identifier_input_method_default() click to toggle source

SQLite folds unquoted identifiers to lowercase, so it shouldn’t need to upcase identifiers on input.

         # File lib/sequel/adapters/shared/sqlite.rb, line 343
    343:       def identifier_input_method_default
    344:         nil
    345:       end

identifier_output_method_default() click to toggle source

SQLite folds unquoted identifiers to lowercase, so it shouldn’t need to upcase identifiers on output.

         # File lib/sequel/adapters/shared/sqlite.rb, line 348
    348:       def identifier_output_method_default
    349:         nil
    350:       end

on_delete_sql_to_sym(str) click to toggle source

Does the reverse of on_delete_clause, eg. converts strings like +’SET NULL’+ to symbols `:set_null`.

         # File lib/sequel/adapters/shared/sqlite.rb, line 354
    354:       def on_delete_sql_to_sym str
    355:         case str
    356:         when 'RESTRICT'
    357:           :restrict
    358:         when 'CASCADE'
    359:           :cascade
    360:         when 'SET NULL'
    361:           :set_null
    362:         when 'SET DEFAULT'
    363:           :set_default
    364:         when 'NO ACTION'
    365:           :no_action
    366:         end
    367:       end

parse_pragma(table_name, opts) click to toggle source

Parse the output of the table_info pragma

         # File lib/sequel/adapters/shared/sqlite.rb, line 370
    370:       def parse_pragma(table_name, opts)
    371:         metadata_dataset.with_sql("PRAGMA table_info(?)", input_identifier_meth(opts[:dataset]).call(table_name)).map do |row|
    372:           row.delete(:cid)
    373:           row[:allow_null] = row.delete(:notnull).to_i == 0
    374:           row[:default] = row.delete(:dflt_value)
    375:           row[:primary_key] = row.delete(:pk).to_i == 1
    376:           row[:default] = nil if blank_object?(row[:default]) || row[:default] == 'NULL'
    377:           row[:db_type] = row.delete(:type)
    378:           row[:type] = schema_column_type(row[:db_type])
    379:           row
    380:         end
    381:       end

schema_autoincrementing_primary_key?(schema) click to toggle source

SQLite treats integer primary keys as autoincrementing (alias of rowid).

         # File lib/sequel/adapters/shared/sqlite.rb, line 384
    384:       def schema_autoincrementing_primary_key?(schema)
    385:         super and schema[:db_type].downcase == 'integer'
    386:       end

schema_parse_table(table_name, opts) click to toggle source

SQLite supports schema parsing using the table_info PRAGMA, so parse the output of that into the format Sequel expects.

         # File lib/sequel/adapters/shared/sqlite.rb, line 390
    390:       def schema_parse_table(table_name, opts)
    391:         m = output_identifier_meth(opts[:dataset])
    392:         parse_pragma(table_name, opts).map do |row|
    393:           [m.call(row.delete(:name)), row]
    394:         end
    395:       end

tables_and_views(filter, opts) click to toggle source

Backbone of the tables and views support.

         # File lib/sequel/adapters/shared/sqlite.rb, line 398
    398:       def tables_and_views(filter, opts)
    399:         m = output_identifier_meth
    400:         metadata_dataset.from(:sqlite_master).server(opts[:server]).filter(filter).map{|r| m.call(r[:name])}
    401:       end

type_literal_generic_bignum(column) click to toggle source

SQLite uses the integer data type even for bignums. This is because they are both stored internally as text, and converted when returned from the database. Using an integer type instead of bigint makes it more likely that software will automatically return the column as an integer.

         # File lib/sequel/adapters/shared/sqlite.rb, line 407
    407:       def type_literal_generic_bignum(column)
    408:         :integer
    409:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.