NAME

DBIx::QuickORM::Dialect::MySQL - MySQL-family dialect for DBIx::QuickORM.

DESCRIPTION

Dialect implementation for the MySQL family of databases, covering both the DBD::mysql and DBD::MariaDB drivers. It provides async query support, transaction and savepoint control, and live schema introspection from information_schema.

At init time a generic instance promotes itself to a vendor-specific subclass (MariaDB, Percona, or Community) when the running server's vendor can be detected, falling back to this class with a warning otherwise.

SYNOPSIS

my $dialect = DBIx::QuickORM::Dialect::MySQL->new(dbh => $dbh, db_name => $name);

ATTRIBUTES

dbi_driver

The DBD::* driver class backing the connection (DBD::mysql or DBD::MariaDB), resolved lazily from the live handle.

PUBLIC METHODS

$bool = $dialect->async_supported
$bool = $dialect->async_cancel_supported

Feature flags for async query support.

%args = $dialect->async_prepare_args(%params)
$bool = $dialect->async_ready(sth => $sth)
$res = $dialect->async_result(sth => $sth)
$dialect->async_cancel

Driver-appropriate async query helpers. async_cancel always croaks: the MySQL family cannot cancel an in-flight async query.

$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. Each accepts an optional dbh parameter, defaulting to the dialect's own handle; savepoint methods take a savepoint name.

$name = $dialect->dialect_name

Returns 'MySQL'.

PUBLIC METHODS (continued)

$driver = $dialect->dbi_driver
$driver = DBIx::QuickORM::Dialect::MySQL->dbi_driver

The DBD::* driver class. As a class method returns the installed default; as an instance method resolves and caches it from the live handle.

$val = $dialect->quote_binary_data

Driver-appropriate bind type for binary data: undef for DBD::mysql, DBI::SQL_BINARY for DBD::MariaDB.

$dialect->init

Validates the connection and, for a generic instance, promotes it to a vendor-specific subclass when the server vendor can be detected.

$field = $dialect->dsn_socket_field($driver)

DSN field name used to specify a unix socket for the given driver.

$version = $dialect->db_version

Server version string from SELECT version().

$vendor = $dialect->db_vendor

Detects the server vendor (MariaDB, Percona, or Community) from the version strings, or undef when it cannot be determined.

$sql = $dialect->upsert_statement($pk)

Returns the MySQL upsert clause ON DUPLICATE KEY UPDATE.

SCHEMA INTROSPECTION METHODS

$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)

Introspect tables, keys, columns, and indexes for the connected database from information_schema, invoking the autofill hooks supplied in %params as each piece of metadata is built.

PRIVATE METHODS

$bool = $dialect->_col_field_to_bool($val)

Interprets an information_schema string field as a boolean, treating no/undef/never and empty/undefined values as false.

SOURCE

The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

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.

See https://dev.perl.org/licenses/