NAME
DBIx::QuickORM::Dialect::SQLite - SQLite dialect for DBIx::QuickORM.
DESCRIPTION
The SQLite-specific DBIx::QuickORM::Dialect. Introspects schema metadata from SQLite's pragma_* tables and sqlite_master, drives transactions and savepoints via the SQLite driver, and reports SQLite's feature set (RETURNING support, no async support).
SYNOPSIS
my $dialect = DBIx::QuickORM::Dialect::SQLite->new(dbh => $dbh, db_name => $name);
PUBLIC METHODS
- $driver = $dialect->dbi_driver
- $name = $dialect->dialect_name
- $bool = $dialect->supports_returning_update
- $bool = $dialect->supports_returning_insert
- $bool = $dialect->supports_returning_delete
- $bool = $dialect->async_supported
- $bool = $dialect->async_cancel_supported
-
Feature flags and constants describing the SQLite dialect. SQLite does not support async queries.
- $stype = $dialect->supports_type($type)
-
Returns SQLite's native storage type name for a supported logical type, or nothing. SQLite has no native JSON type; JSON-ish types fall back to
TEXTviasupports_type('text'). - $dialect->async_prepare_args
- $dialect->async_ready
- $dialect->async_result
- $dialect->async_cancel
-
SQLite does not support async queries; these
croak. - $version = $dialect->db_version
-
The version of the SQLite library itself (not the
DBD::SQLitemodule version). - $dialect->start_txn(%params)
- $dialect->commit_txn(%params)
- $dialect->rollback_txn(%params)
- $dialect->create_savepoint(%params)
- $dialect->commit_savepoint(%params)
- $dialect->rollback_savepoint(%params)
-
Transaction and savepoint control via the SQLite driver. Each accepts an optional
dbhparameter, defaulting to the dialect's own handle; savepoint methods take asavepointname. - $dsn = $dialect->dsn($db)
-
Builds a SQLite DSN string from a database config object.
PUBLIC METHODS
- $tables = $dialect->build_tables_from_db(%params)
-
Introspects all tables and views (including temp ones) and returns a hashref of name to schema-table object.
- ($pk, $unique, $links) = $dialect->build_table_keys_from_db($table, %params)
-
Introspects a table's primary key, unique keys, and foreign-key links.
- $bool = $dialect->table_has_autoinc($table)
-
True if the named table declares an
AUTOINCREMENTcolumn. - $columns = $dialect->build_columns_from_db($table, %params)
-
Introspects a table's columns and returns a hashref of column name to column object.
- $indexes = $dialect->build_indexes_from_db($table, %params)
-
Introspects a table's indexes and returns an arrayref of index specs.
PRIVATE METHODS (schema introspection)
- $by_table = $dialect->_fetch_all_xinfo
- $by_table = $dialect->_fetch_all_index_info
- $by_table = $dialect->_fetch_all_fks
- $by_table = $dialect->_fetch_all_ddl
-
Sweep column (
pragma_table_xinfo), index (pragma_index_list+pragma_index_info), foreign-key (pragma_foreign_key_list), and stored-DDL metadata for every table in a single statement per catalog. The pragma table functions are joined laterally againstsqlite_master/sqlite_temp_masterso one statement iterates all tables._fetch_all_xinfo,_fetch_all_index_info, and_fetch_all_fksreturn a hashref keyed by temp-flag (0 permanent, 1 temporary) then table name, so a temporary object never merges with a permanent one of the same name;_fetch_all_ddlis keyed by table name (permanent DDL wins, matching_table_ddl). - @cols = $dialect->_pk_from_xinfo($xinfo_rows)
-
The primary-key column names (ordered by key position) derived from pre-fetched
pragma_table_xinforows, without an extra query. - $col_or_undef = $dialect->_rowid_alias_from($xinfo_rows, $ddl)
-
The rowid-alias column derived from pre-fetched xinfo rows and stored DDL, without an extra query. See
_rowid_alias_columnfor the alias rule. - $rows = $dialect->_query_xinfo($table)
- $rows = $dialect->_query_index_info($table)
- $rows = $dialect->_query_fks($table)
-
Single-table fallbacks used when the per-table builders are called without pre-fetched rows.
PRIVATE METHODS
- @cols = $dialect->_primary_key($table)
-
Returns the primary-key column names for a table, ordered by key position.
- $ddl_or_undef = $dialect->_table_ddl($table)
-
The stored
CREATE TABLEstatement for the named table (permanent or temp), or undef when the table does not exist. - $sql = $dialect->_strip_sql_noise($sql)
-
Returns the SQL with string literals replaced by empty strings and comments removed, so keyword matching cannot false-positive on either.
- $col_or_undef = $dialect->_rowid_alias_column($table)
-
The name of the column that aliases SQLite's rowid, or undef if the table has none. The alias rule: a rowid table (no
WITHOUT ROWID) with a single-column primary key whose declared type is exactlyINTEGER(INT,BIGINT, etc. do not alias). Not handled: the obscurex INTEGER PRIMARY KEY DESCcolumn-definition form, which SQLite does not treat as an alias.
SOURCE
The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.
MAINTAINERS
AUTHORS
COPYRIGHT
Copyright Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.