Skip to content

tsucchi/p5-Otogiri-Plugin-TableInfo

Repository files navigation

Build Status Coverage Status

NAME

Otogiri::Plugin::TableInfo - retrieve table information from database

SYNOPSIS

use Otogiri::Plugin::TableInfo;
my $db = Otogiri->new( connect_info => [ ... ] );
$db->load_plugin('TableInfo');
my @table_names = $db->show_tables();

DESCRIPTION

Otogiri::Plugin::TableInfo is Otogiri plugin to fetch table information from database.

METHODS

my @table_names = $self->show_tables([$like_regex]);

returns table names in database.

parameter $like_regex is optional. If it is passed, table name is filtered by regex like MySQL's SHOW TABLES LIKE ... statement.

my @table_names = $db->show_tables(qr/^user_/); # return table names that starts with 'user_'

If $like_regex is not passed, all table_names in current database are returned.

my @view_names = $self->show_views([$like_regex]);

returns view names in database.

my $create_table_ddl = $self->desc($table_name);

my $create_table_ddl = $self->show_create_table($table_name);

returns create table statement like MySQL's 'show create table'.

my $create_view_sql = $self->show_create_view($view_name);

returns create view SQL like MySQL's 'show create view'.

LICENSE

Copyright (C) Takuya Tsuchida.

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

AUTHOR

Takuya Tsuchida tsucchi@cpan.org

About

retrieve table information from database

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages