blib/lib/DBIx/QuickORM/Dialect/MariaDB.pm

filter: Statementstmt 94.7% 18 / 19 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 3 / 3 totaltotal 87.1% 27 / 31 CC 2 SCAR 8.1
CC
2
Cov
86%
_scan_key_columns
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« blib/lib/DBIx/QuickORM/Type/DateTime/Lazy.pm ↑ Summary blib/lib/DBIx/QuickORM/Type/JSON.pm »
1 package DBIx::QuickORM::Dialect::MariaDB;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 our $VERSION = '0.000032';
6  
7 3 ▶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 \%kinds = $dialect->native_error_kinds
43  
44 MySQL's codes, with MariaDB's code for a failed C<CHECK> (4025) in place of
45 MySQL's.
46  
47 =back
48  
49 =cut
50  
51 1 ▶sub supports_returning_insert { 1 }
Subroutine supports_returning_insert: called CC=1 SCAR=0.0
Pod documented
52 1 ▶sub supports_returning_delete { 1 }
Subroutine supports_returning_delete: called CC=1 SCAR=0.0
Pod documented
53  
54 # supports_returning_update stays false (inherited from MySQL). MariaDB 13.0.1+ has UPDATE ... RETURNING, but
55 # https://jira.mariadb.org/browse/MDEV-41113 (open as of 2026-11-28, fix version 13.1 rolling, still present in
56 # 13.1.2): it leaves matched but unchanged rows out of the result and reports 0 affected rows, ignoring
57 # CLIENT_FOUND_ROWS, so a no-op update cannot be told from no match. SQLAlchemy's #13575 is blocked on it too.
58 # Once a release fixes it, make supports_returning_update true for server versions with UPDATE RETURNING and
59 # the fix (a version check on server_version, no fallback), and update this POD, Manual/Dialects, and tests.
60  
61 3 my %NATIVE_KIND = %{DBIx::QuickORM::Dialect::MySQL->native_error_kinds};
62 3 delete $NATIVE_KIND{3819};
63 3 $NATIVE_KIND{4025} = 'check_violation';
64  
65 3 ▶sub native_error_kinds { \%NATIVE_KIND }
Subroutine native_error_kinds: called CC=1 SCAR=0.0
Pod documented
66  
67 =pod
68  
69 =over 4
70  
71 =item @sql = $dialect->_scan_key_columns
72  
73 C<CURRENT_ROLE()> from MariaDB 10.0.5, which has roles but not MySQL's
74 generated invisible primary keys.
75  
76 =back
77  
78 =cut
79  
80 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
BranchTrueFalseTotal
$_[0]->server_version >= 10000005 ? : 0 0 0
81  
82 3 1;
83  
84 __END__
« blib/lib/DBIx/QuickORM/Type/DateTime/Lazy.pm ↑ Summary blib/lib/DBIx/QuickORM/Type/JSON.pm »