NAME
DBIx::QuickORM::Dialect - Base class for database-specific dialects.
DESCRIPTION
A dialect adapts the ORM to a specific database engine. It owns the live database handle, knows how to build a DSN, introspects schema metadata from the live database, generates SQL from a schema, and brokers transactions, savepoints, and (where supported) async queries.
This class is the abstract base: most of its database-specific methods are stubs that confess/croak until overridden by a concrete subclass such as DBIx::QuickORM::Dialect::SQLite or DBIx::QuickORM::Dialect::PostgreSQL.
SYNOPSIS
my $dialect = DBIx::QuickORM::Dialect::SQLite->new(dbh => $dbh, db_name => $name);
my $schema = $dialect->build_schema_from_db(autofill => $autofill);
ATTRIBUTES
- dbh
-
The live
DBIdatabase handle. - db_name
-
Name of the database this dialect is connected to.
PUBLIC METHODS
- $field = $dialect->dsn_socket_field
-
Name of the DSN field used to specify a unix socket. Defaults to
host. - $name = $dialect->dialect_name
-
Short name of the dialect, derived from the class name.
- $value = $dialect->quote_binary_data
-
DBI bind type/attribute used to quote binary data.
- $bool = $dialect->supports_returning_update
- $bool = $dialect->supports_returning_insert
- $bool = $dialect->supports_returning_delete
-
True if the dialect supports a
RETURNINGclause on the relevant statement. - $stype = $dialect->supports_type($type)
-
Returns the database-native type name if the dialect supports the given logical type, otherwise nothing.
- $driver = $dialect->dbi_driver
-
The
DBD::*driver class for this dialect. Stub; subclasses override. - $version = $dialect->db_version
-
The server/engine version. Stub; subclasses override.
- $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. Stubs; subclasses override.
- $bool = $dialect->in_txn(%params)
-
True if a transaction is currently in progress on the handle (the
dbhparameter, or the dialect's own handle). - $dialect->init
-
Validates that
dbhanddb_namewere provided. - $dsn = $dialect->dsn($db)
-
Builds a DSN string from a database config object, loading the driver as needed.
- $sql = $dialect->upsert_statement($pk)
-
Returns the SQL fragment implementing an upsert keyed on the given primary key columns.
- $schema = $dialect->build_schema_from_db(%params)
-
Introspects the live database and returns a DBIx::QuickORM::Schema. Requires an
autofillobject. - $tables = $dialect->build_tables_from_db(%params)
- ($pk, $unique, $links) = $dialect->build_table_keys_from_db($table, %params)
- $columns = $dialect->build_columns_from_db($table, %params)
- $indexes = $dialect->build_indexes_from_db($table, %params)
-
Per-table introspection helpers. Stubs; subclasses override.
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.