NAME
DBIx::QuickORM::Dialect::MySQL - MySQL dialect, and base for MariaDB.
DESCRIPTION
MySQL through DBD::MariaDB, the only supported driver for the MySQL family. Backtick quoting, no RETURNING, native error codes, and async queries through the driver. The namespace is DATABASE().
Which dialect a handle gets is a server fact: a server whose version names MariaDB gets DBIx::QuickORM::Dialect::MariaDB. Any other server (MySQL Community, Percona) gets this one.
SYNOPSIS
# this class or MariaDB for DBD::MariaDB
my $dialect = DBIx::QuickORM::Dialect->for_dbh($dbh);
PUBLIC METHODS
- $char = $dialect->quote_char
-
A backtick.
- $bool = $dialect->supports_returning_insert
- $bool = $dialect->supports_returning_update
- $bool = $dialect->supports_returning_delete
-
All false: MySQL has no
RETURNING. - $bool = $dialect->supports_isolation
-
True.
- @sql = $dialect->begin_sql($level)
-
SET TRANSACTION ISOLATION LEVEL $levelthenBEGINwhen given a level, otherwiseBEGIN. WithoutSESSION, the level applies to the next transaction only. - $bool = $dialect->having_uses_alias
-
True: the server resolves the alias in
HAVINGand computes the column once, but it computes a repeated expression a second time. - $n = $dialect->bind_limit
-
65535, the most placeholders a prepared statement may hold.
- ($parser, $formatter, \%instants) = $dialect->datetime_format
-
DateTime::Format::MySQL for both.
TIMESTAMPstores an instant: the server converts it from and to the session time zone.DATETIMEdoes not. - $bool = $dialect->supports_async
-
True.
- $attrs = $dialect->async_prepare_attrs
-
{mariadb_async => 1}. - $bool = $dialect->async_ready($dbh, $sth)
- $dialect->async_result($dbh, $sth)
-
mariadb_async_readyandmariadb_async_resulton the statement. Themariadb_prefix names the driver, but they work against every server of the family. - $dialect->cancel_async($dbh, $sth)
-
Waits for the result and discards it: the driver cannot cancel a query on its own connection.
- $class = $dialect->dialect_for_dbh($dbh)
-
DBIx::QuickORM::Dialect::MariaDB when
SELECT version()names MariaDB, otherwise this class.
- \%kinds = $dialect->native_error_kinds
-
The native codes, since MySQL reports a generic SQLSTATE for most errors:
1205 lock_timeout (lock wait timeout) 1213 deadlock 1062, 1169, 1586 unique_violation (duplicate key) 1216, 1217, 1451, 1452 foreign_key_violation (missing or still-referenced parent row) 1048, 1364 not_null_violation (NULL, or no value and no default) 3819 check_violation (failed CHECK)
- $key = $dialect->scan_cache_key($dbh, $namespace)
-
The base key, plus what else decides what the scan sees: the server's host name, port, and socket (connection attributes outside the DSN can pick the server), the account the session resolved to, its
sql_select_limit(which truncates the catalog queries), its active roles where the server has roles (they can change which tables the catalog shows), and, on MySQL 8.0.30 and later, whether the catalog shows generated invisible primary keys.
- @sql = $dialect->_scan_key_columns
-
The server-specific session values
scan_cache_keyadds:CURRENT_ROLE()from MySQL 8.0, and the generated invisible primary key setting from 8.0.30.
- $dialect->init_session($dbh, $time_zone)
-
SET NAMES utf8mb4, thenSET time_zone. Also records the pid that owns the handle, forrelease_inherited.UTCis sent as+00:00, which works without the server's time zone tables. Any other zone name needs them.
- $dialect->release_inherited($dbh)
-
Points the child's copy of the handle's socket at /dev/null, then disconnects, so the parent's session is untouched. Does nothing for an inactive handle.
DBD::MariaDB closes every handle it holds when a process exits,
InactiveDestroyor not, so a forked child that exits normally would otherwise end the parent's session. At exit this runs for every still-active handle whose recorded pid is not this process.
- $sql = $dialect->tables_sql
- $sql = $dialect->fields_sql
- $sql = $dialect->pk_sql
- $sql = $dialect->unique_sql
- $sql = $dialect->fk_sql
-
The scan queries (see
scan), overinformation_schemafor base tables inDATABASE().Field types are
COLUMN_TYPE.A column the database fills is auto-increment, generated, or has a default. Generated columns refuse values.
MariaDB reports the default of a nullable column without one as the text
NULL, which is not a default. On MySQL that text is also how a string default'NULL'appears, so such a nullable column missesdb_fills. Key columns are never nullable.A unique index over a column prefix or an expression is left out.
- \%field = $dialect->field_facts($db_type)
-
As inherited, but a type whose name ends in
inthas nosize:int(11)is a display width.
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.