Это работает.
Создать базу данных:
echo 'create table foo (bar integer primary key, quux varchar(30));' | sqlite3 foobar.sqlite
Perl-программа для печати схемы:
use 5.010;
use Data::Dumper qw(Dumper);
use DBIx::Class::Schema::Loader qw();
DBIx::Class::Schema::Loader->naming('current');
DBIx::Class::Schema::Loader->use_namespaces(1);
my $dbi_dsn = 'dbi:SQLite:dbname=foobar.sqlite';
my ($dbi_user, $dbi_pass);
my $schema = DBIx::Class::Schema::Loader->connect(
$dbi_dsn, $dbi_user, $dbi_pass, {'AutoCommit' => 1, 'RaiseError' => 1,}
);
for my $source_name ($schema->sources) {
say "*** Source: $source_name";
my $result_source = $schema->source($source_name);
for my $column_name ($result_source->columns) {
say "Column: $column_name";
say Dumper $result_source->column_info($column_name);
}
}
Выход:
*** Source: Foo
Column: bar
$VAR1 = {
'data_type' => 'integer',
'is_auto_increment' => 1,
'is_nullable' => 1
};
Column: quux
$VAR1 = {
'data_type' => 'varchar',
'is_nullable' => 1,
'size' => 30
};