class

ActiveRecord::ConnectionAdapters::SQLite3Adapter

v8.1.1 - Show latest stable - Superclass: SQLiteAdapter

Active Record SQLite3 Adapter

The SQLite3 adapter works with the sqlite3 driver.

Options

  • :database (String): Filesystem path to the database file.

  • :statement_limit (Integer): Maximum number of prepared statements to cache per database connection. (default: 1000)

  • :timeout (Integer): Timeout in milliseconds to use when waiting for a lock. (default: no wait)

  • :strict (Boolean): Enable or disable strict mode. When enabled, this will disallow double-quoted string literals in SQL statements. (default: see strict_strings_by_default)

  • :extensions (Array): (requires sqlite3 v2.4.0) Each entry specifies a sqlite extension to load for this database. The entry may be a filesystem path, or the name of a class that responds to .to_path to provide the filesystem path for the extension. See sqlite3-ruby documentation for more information.

There may be other options available specific to the SQLite3 driver. Please read the documentation for SQLite3::Database.new

Included modules

  • ActiveRecord::ConnectionAdapters::SQLite3::DatabaseStatements
  • ActiveRecord::ConnectionAdapters::SQLite3::Quoting
  • ActiveRecord::ConnectionAdapters::SQLite3::SchemaStatements

Constants

ADAPTER_NAME = "SQLite"

COLLATE_REGEX = /.*"(\\w+)".*collate\\s+"(\\w+)".*/i

DEFAULT_PRAGMAS = {\n"foreign_keys" => true,\n"journal_mode" => :wal,\n"synchronous" => :normal,\n"mmap_size" => 134217728, # 128 megabytes\n"journal_size_limit" => 67108864, # 64 megabytes\n"cache_size" => 2000\n}

DEFERRABLE_REGEX = /DEFERRABLE INITIALLY (\\w+)/

EXTENDED_TYPE_MAPS = Concurrent::Map.new

FINAL_CLOSE_PARENS_REGEX = /\\);*\\z/

FK_REGEX = /.*FOREIGN KEY\\s+\\("([^"]+)"\\)\\s+REFERENCES\\s+"(\\w+)"\\s+\\("(\\w+)"\\)/

GENERATED_ALWAYS_AS_REGEX = /.*"(\\w+)".+GENERATED ALWAYS AS \\((.+)\\) (?:STORED|VIRTUAL)/i

NATIVE_DATABASE_TYPES = {\nprimary_key: "integer PRIMARY KEY AUTOINCREMENT NOT NULL",\nstring: { name: "varchar" },\ntext: { name: "text" },\ninteger: { name: "integer" },\nfloat: { name: "float" },\ndecimal: { name: "decimal" },\ndatetime: { name: "datetime" },\ntime: { name: "time" },\ndate: { name: "date" },\nbinary: { name: "blob" },\nboolean: { name: "boolean" },\njson: { name: "json" },\n}

PRIMARY_KEY_AUTOINCREMENT_REGEX = /.*"(\\w+)".+PRIMARY KEY AUTOINCREMENT/i

TYPE_MAP = Type::TypeMap.new.tap { |m| initialize_type_map(m) }

UNQUOTED_OPEN_PARENS_REGEX = /\\((?![^'"]*['"][^'"]*$)/

VIRTUAL_TABLE_REGEX = /USING\\s+(\\w+)\\s*\\((.+)\\)/i

Files

  • activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb