NAME
DBIO::SQLite::Result - SQLite-specific Result component for DBIO
VERSION
version 0.900007
DESCRIPTION
DBIO::SQLite::Result is a DBIO Result component that adds SQLite-native metadata to a result class: custom indexes (including partial and expression indexes). It is the counterpart to DBIO::PostgreSQL::Result / DBIO::MySQL::Result and is read by DBIO::SQLite::DDL when generating install DDL.
Load it with:
package MyApp::DB::Result::User;
use base 'DBIO::Core';
__PACKAGE__->load_components('SQLite::Result');
__PACKAGE__->table('users');
__PACKAGE__->sqlite_index('idx_users_active' => {
columns => ['role'],
where => "role != 'suspended'", # partial index
});
__PACKAGE__->sqlite_index('idx_users_name_lower' => {
expression => 'lower(name)', # expression index
});
sqlite_index is one way to declare an index, not the only one. The index declaration of the result source is canonical (ADR 0061 in core): idx of DBIO::Cake and indices write it, and DBIO::SQLite::DDL reads it next to sqlite_index. Its own driver => { sqlite => { where, expression } } block is read; an entry that carries only another driver's block, or an unknown key in the sqlite block, is refused. Where both declare the same name, the canonical declaration wins.
METHODS
sqlite_index
__PACKAGE__->sqlite_index('idx_users_tags' => {
columns => ['tags'],
});
__PACKAGE__->sqlite_index('idx_users_active' => {
columns => ['role'],
where => "role != 'suspended'",
});
Get or set the definition for a named SQLite index. The definition hashref accepts:
columns- ArrayRef of column namesunique- set to true for a UNIQUE indexwhere- partial index predicate (SQL expression string)expression- expression index expression (replacescolumns)
sqlite_indexes
my $all = $class->sqlite_indexes; # hashref of name => def
Returns a copy of all index definitions registered on this result class.
SEE ALSO
DBIO::SQLite::DDL - consumes
sqlite_indexesand the canonical index declarations when generating DDLDBIO::PostgreSQL::Result - the PostgreSQL counterpart
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.