NAME

Mojolicious::Plugin::DBViewer - Mojolicious plugin to display MySQL database information on browser

CAUTION

This module is alpha release. the feature will be changed without warnings.

SYNOPSYS

# Mojolicious::Lite
plugin(
  'DBViewer',
  dsn => "dbi:mysql:database=bookshop",
  user => 'ken',
  password => '!LFKD%$&'
);

# Mojolicious
$app->plugin(
  'DBViewer',
  dsn => "dbi:mysql:database=bookshop",
  user => 'ken',
  password => '!LFKD%$&'
);

# Access
http://localhost:3000/dbviewer

# Prefix change (http://localhost:3000/dbviewer2)
plugin 'DBViewer', dbh => $dbh, prefix => 'dbviewer2';

# Route
my $bridge = $app->route->under(sub {...});
plugin 'DBViewer', route => $bridge, ...;

DESCRIPTION

Mojolicious::Plugin::DBViewer is Mojolicious plugin to display Database information on your browser.

Mojolicious::Plugin::DBViewer have the following features.

  • Support MySQL and SQLite

  • Display all table names

  • Display show create table

  • Select * from TABLE

  • Display primary keys, null allowed columnes, database engines and charsets in all tables.

OPTIONS

connector_get

connector_get => \$connector

Get DBIx::Connector object internally used.

# Get database handle
my $connector;
plugin('DBViewer', ..., connector_get => \$connector);
my $dbh = $connector->dbh;

dsn

dsn => "dbi:SQLite:dbname=proj"

Datasource name.

password

password => 'secret';

Database password.

prefix

prefix => 'dbviewer2'

Application base path, default to dbviewer. You can access DB viewer by the following path.

http://somehost.com/dbviewer2

option

option => $option

DBI option (DBI connect method's fourth argument).

route

route => $route

Router, default to $app-routes>.

It is useful when under is used.

my $bridge = $r->under(sub {...});
plugin 'DBViewer', dbh => $dbh, route => $bridge;

user

user => 'kimoto'

Database user.

BACKWARDS COMPATIBILITY POLICY

If a feature is DEPRECATED, you can know it by DEPRECATED warnings. DEPRECATED feature is removed after five years, but if at least one person use the feature and tell me that thing I extend one year each time he tell me it.

DEPRECATION warnings can be suppressed by MOJOLICIOUS_PLUGIN_DBVIEWER_SUPPRESS_DEPRECATION environment variable.

EXPERIMENTAL features will be changed without warnings.

COPYRIGHT & LICENSE

Copyright 2013 Yuki Kimoto, all rights reserved.

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