« blib/lib/DBIx/QuickORM/Manual/Values.pm
↑ Summary
blib/lib/DBIx/QuickORM/WhereBuilder/SQLAbstract.pm »
| 1 | package DBIx::QuickORM::Dialect::MariaDB; | ||||||||||
| 2 | 12 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 12 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 12 | our $VERSION = '0.000033'; | |||||||||
| 6 | |||||||||||
| 7 | 12 | ▶ | use parent 'DBIx::QuickORM::Dialect::MySQL'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | =pod | ||||||||||
| 10 | |||||||||||
| 11 | =encoding UTF-8 | ||||||||||
| 12 | |||||||||||
| 13 | =head1 NAME | ||||||||||
| 14 | |||||||||||
| 15 | DBIx::QuickORM::Dialect::MariaDB - MariaDB dialect. | ||||||||||
| 16 | |||||||||||
| 17 | =head1 DESCRIPTION | ||||||||||
| 18 | |||||||||||
| 19 | MariaDB through L<DBD::MariaDB>. It inherits everything from | ||||||||||
| 20 | L<DBIx::QuickORM::Dialect::MySQL> except C<RETURNING> on C<INSERT> and | ||||||||||
| 21 | C<DELETE>, which MariaDB has, its code for a failed C<CHECK>, and the session | ||||||||||
| 22 | values its scan cache key adds (roles, but no generated invisible primary | ||||||||||
| 23 | keys). | ||||||||||
| 24 | |||||||||||
| 25 | =head1 SYNOPSIS | ||||||||||
| 26 | |||||||||||
| 27 | my $dialect = DBIx::QuickORM::Dialect->for_dbh($dbh); # this class for a MariaDB server | ||||||||||
| 28 | |||||||||||
| 29 | =head1 PUBLIC METHODS | ||||||||||
| 30 | |||||||||||
| 31 | =over 4 | ||||||||||
| 32 | |||||||||||
| 33 | =item $bool = $dialect->supports_returning_insert | ||||||||||
| 34 | |||||||||||
| 35 | =item $bool = $dialect->supports_returning_delete | ||||||||||
| 36 | |||||||||||
| 37 | True. C<UPDATE> does not use C<RETURNING> (inherited, false). MariaDB 13.0.1 | ||||||||||
| 38 | added C<UPDATE ... RETURNING>, but it leaves out rows that matched without | ||||||||||
| 39 | changing (MDEV-41113), so an update that writes the values a row already holds | ||||||||||
| 40 | would look like one that matched nothing. | ||||||||||
| 41 | |||||||||||
| 42 | =item @keys = $dialect->db_type_keys | ||||||||||
| 43 | |||||||||||
| 44 | C<mariadb>, then C<any_mysql>, then C<any>. C<mysql> is MySQL's alone. | ||||||||||
| 45 | |||||||||||
| 46 | =item \%kinds = $dialect->native_error_kinds | ||||||||||
| 47 | |||||||||||
| 48 | MySQL's codes, with MariaDB's code for a failed C<CHECK> (4025) in place of | ||||||||||
| 49 | MySQL's. | ||||||||||
| 50 | |||||||||||
| 51 | =back | ||||||||||
| 52 | |||||||||||
| 53 | =cut | ||||||||||
| 54 | |||||||||||
| 55 | 1 | ▶ | sub supports_returning_insert { 1 } | ||||||||
|
Subroutine
supports_returning_insert: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 56 | 3 | ▶ | sub unsupported { $_[0]->_too_old(10_005_000, 'MariaDB 10.5', 'RETURNING') } | ||||||||
|
Subroutine
unsupported: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 57 | 1 | ▶ | sub supports_returning_delete { 1 } | ||||||||
|
Subroutine
supports_returning_delete: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 58 | 6 | ▶ | sub db_type_keys { ('mariadb', 'any_mysql', 'any') } | ||||||||
|
Subroutine
db_type_keys: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 59 | |||||||||||
| 60 | # supports_returning_update stays false (inherited from MySQL). MariaDB 13.0.1+ has UPDATE ... RETURNING, but | ||||||||||
| 61 | # https://jira.mariadb.org/browse/MDEV-41113 (open as of 2026-11-28, fix version 13.1 rolling, still present in | ||||||||||
| 62 | # 13.1.2): it leaves matched but unchanged rows out of the result and reports 0 affected rows, ignoring | ||||||||||
| 63 | # CLIENT_FOUND_ROWS, so a no-op update cannot be told from no match. SQLAlchemy's #13575 is blocked on it too. | ||||||||||
| 64 | # Once a release fixes it, make supports_returning_update true for server versions with UPDATE RETURNING and | ||||||||||
| 65 | # the fix (a version check on server_version, no fallback), and update this POD, Manual/Dialects, and tests. | ||||||||||
| 66 | |||||||||||
| 67 | 12 | my %NATIVE_KIND = %{DBIx::QuickORM::Dialect::MySQL->native_error_kinds}; | |||||||||
| 68 | 12 | delete $NATIVE_KIND{3819}; | |||||||||
| 69 | 12 | $NATIVE_KIND{4025} = 'check_violation'; | |||||||||
| 70 | |||||||||||
| 71 | 3 | ▶ | sub native_error_kinds { \%NATIVE_KIND } | ||||||||
|
Subroutine
native_error_kinds: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 72 | |||||||||||
| 73 | =pod | ||||||||||
| 74 | |||||||||||
| 75 | =over 4 | ||||||||||
| 76 | |||||||||||
| 77 | =item @sql = $dialect->_scan_key_columns | ||||||||||
| 78 | |||||||||||
| 79 | C<CURRENT_ROLE()> from MariaDB 10.0.5, which has roles but not MySQL's | ||||||||||
| 80 | generated invisible primary keys. | ||||||||||
| 81 | |||||||||||
| 82 | =back | ||||||||||
| 83 | |||||||||||
| 84 | =cut | ||||||||||
| 85 | |||||||||||
| 86 | 0 | ▶ | sub _scan_key_columns { $_[0]->server_version >= 10_000_005 ? ('CURRENT_ROLE()') : () } | ||||||||
|
Subroutine
_scan_key_columns: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 87 | |||||||||||
| 88 | 12 | 1; | |||||||||
| 89 | |||||||||||
| 90 | __END__ | ||||||||||