DBIx::C...:Writing(3)
π¦ DBIx::Class::Schema::Loader::DBI::Writing(3) π¦
okay so bestie, this is the DBIx::Class::Schema::Loader::DBI::Writing page from the User Contributed Perl Documentation β it's the loader subclass writing guide for DBI, and we're making it make sense together π
β¨
β¨ NAME β¨
DBIx::Class::Schema::Loader::DBI::Writing β Loader subclass writing guide for DBI π«Ά
πΈ SYNOPSIS πΈ
okay so here's the starter template β not me being obsessed with a template, but it's literally there to get you started, no cap:
package DBIx::Class::Schema::Loader::DBI::Foo;
# THIS IS JUST A TEMPLATE TO GET YOU STARTED.
use strict;
use warnings;
use base 'DBIx::Class::Schema::Loader::DBI';
use mro 'c3';
sub _table_uniq_info {
my ($self, $table) = @_;
# ... get UNIQUE info for $table somehow
# and return a data structure that looks like this:
return [
[ 'keyname' => [ 'colname' ] ],
[ 'keyname2' => [ 'col1name', 'col2name' ] ],
[ 'keyname3' => [ 'colname' ] ],
];
# Where the "keyname"'s are just unique identifiers, such as the
# name of the unique constraint, or the names of the columns involved
# concatenated if you wish.
}
sub _table_comment {
my ( $self, $table ) = @_;
return 'Comment';
}
sub _column_comment {
my ( $self, $table, $column_number ) = @_;
return 'Col. comment';
}
1;
π¦ DETAILS π¦
the way that _table_uniq_info is the only required method for new subclasses? lowkey iconic. bestie, there is not (yet) any standardized, DBD-agnostic way to get this info from DBI, so that's the whole reason π
the base DBI Loader has generic methods that should work for everything else in theory β main character energy β although in practice some DBDs need to override one or more of the other methods. the other methods you might likely wanna override are: _table_pk_info, _table_fk_info, _tables_list and _extra_column_info. see the included DBD drivers for examples of these, they ate that π
to import comments from the database you need to implement _table_comment, _column_comment β yes both, bestie, don't skip one π
π AUTHORS π
see "AUTHORS" in DBIx::Class::Schema::Loader π«Ά go give the icons their credit π
π LICENSE π
legal cutie moment: This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. periodt, fr fr π
π cute sign-off: this page is fromperl v5.42.0, dated2025-07-25, and it's theDBIx::Class::Schema::Loader::DBI::Writing(3)manual. bye bestie, go write that subclass π β¨
π¦ where this page comes from
- fedora 43: perl-DBIx-Class-Schema-Loader 0.07053-2.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms