NAME

DBIO::MySQL::Introspect::Util - Shared helpers for the MySQL/MariaDB introspect submodules

VERSION

version 0.900000

DESCRIPTION

Leaf module holding the pure-data helpers shared by the per-section information_schema readers (DBIO::MySQL::Introspect::Columns, DBIO::MySQL::Introspect::Indexes, DBIO::MySQL::Introspect::ForeignKeys). None of these subs talk to the database or hold state; they are class methods that take scalars / hashrefs and return scalars / hashrefs, so they are trivially unit-testable in isolation.

The reader submodules all scope their information_schema rows to the current DATABASE(), then drop any row whose table did not survive DBIO::MySQL::Introspect::Tables (views are kept, but the $tables hash is still the single authority for "which objects exist"). That filter predicate and the column_type size parser were the real duplication when these readers lived in one file; they live here so the per-section layout mandated by core ADR 0018 carries no copy-paste.

METHODS

keep_table

next unless DBIO::MySQL::Introspect::Util->keep_table($tables, $name);

True when $name is present in the $tables hashref produced by DBIO::MySQL::Introspect::Tables. This is the shared $tables filter the per-table readers apply so they never emit columns / indexes / foreign keys for an object that DBIO::MySQL::Introspect::Tables did not surface.

column_size

my $size = DBIO::MySQL::Introspect::Util->column_size($column_type);

Parse the size component out of a MySQL column_type string. size is the canonical companion to data_type: DBIO::Introspect::Base relies on it to size the columns it builds.

varchar(100)        -> 100
int(11) unsigned    -> 11
decimal(10,2)       -> 10
enum('a','b')       -> undef  (set/enum lengths are not portable)
text, json, int     -> undef

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.