NAME

DBIO::SQLite::Extension - The extension class of a SQLite extension without rules, and the driver's table of the family's classes

VERSION

version 0.900007

SYNOPSIS

# A schema declares the extensions its database has; nothing else is written.
__PACKAGE__->sqlite_extensions('fts5', 'rtree');

# a loadable library, loaded into every connection
__PACKAGE__->sqlite_extensions(vec0 => { library => '/opt/sqlite/vec0.so' });

# an extension outside the family names its class
__PACKAGE__->sqlite_extensions(spellfix1 => { class => 'MyApp::DB::Extension::Spellfix' });

DESCRIPTION

The extension classes of "sqlite_extensions" in DBIO::SQLite (ADR 0066 of DBIO core). This class is the plain one: it has no rules for the model, so an extension declared with it is kept and nothing is done for it beyond the one thing a SQLite extension needs, its activation. It derives from DBIO::Extension, whose defaults do nothing, and states only the interface version and the driver it belongs to. Its name is undef on purpose: one class serves every name the table and the declaration do not know, and the name of the list's entry stands ("name" in DBIO::Extension).

An extension of SQLite lives in the process, not in the file: nothing in the database records that a library was loaded, and the library has to be loaded again by every connection. So the one rule of the plain class is "activation", and the extension's state is not read from a catalog but by a probe of the extension's own ("inspect" in DBIO::SQLite::Extension::FTS5). See "EXTENSIONS" in DBIO::SQLite::Deploy for what the deploy does with a list.

The table of the family

name    class                             distribution
fts5    DBIO::SQLite::Extension::FTS5     DBIO-SQLite
rtree   DBIO::SQLite::Extension::RTree    DBIO-SQLite

Both are modules compiled into libsqlite, with shadow tables in the user's schema, which the classes claim. SpatiaLite is not in the table. Its metadata tables (geometry_columns, spatial_ref_sys, ...) would be claims the same way, and the library a library option, but mod_spatialite could not be loaded on the host this was written on, so there is no class that was measured against the real thing. It is a gap, not a decision: declare spatialite => { library => 'mod_spatialite' } and the connection loads it, but no rule knows its tables, and the deploy sees them as model tables.

METHODS

extension_interface

The interface version of DBIO::Extension, 1.

driver

DBIO::SQLite, the assertion that is checked once the DSN has decided the driver ("check_driver" in DBIO::Extension::List).

activation

{ load => { $name => $library } } when the declaration gave a library, nothing otherwise. The library is what $dbh->sqlite_load_extension gets ("_activate_extensions" in DBIO::SQLite::Storage); SQLite adds the platform's suffix and derives the entry point from the file name when it is not found as given.

family_class

my ($class, $distribution) = DBIO::SQLite::Extension->family_class('fts5');

The table of the family: the class and the distribution that ships it for a name the family has a class for, the empty list for any other name. This is the class_table "resolve_list" in DBIO::SQLite::Extension hands to DBIO::Extension::List.

resolve_list

my $list = DBIO::SQLite::Extension->resolve_list($schema);
my $list = DBIO::SQLite::Extension->resolve_list($schema, check_driver => 0);

The one place that turns the declaration of a schema (class or instance; "sqlite_extensions" in DBIO::SQLite, sqlite_extension_options) into a DBIO::Extension::List: the family table, the option class, the plain class. Classes are loaded and their interface version is checked. Returns undef for a schema that declares none.

Unless check_driver is false the driver assertion of every class is checked as well ("check_driver" in DBIO::Extension::List); that is for a caller that runs after the driver is resolved -- the deploy, a new connection. Only the registration of the storage layers at connection passes false: the layer is chosen before the DSN has decided anything, and the assertion waits for the first use.

driver_helpers

The helpers every extension gets as $ctx->{driver}, see "Addresses" in DBIO::SQLite::Deploy: quote_ident and the address constructors table and column.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.