NAME

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

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', dsn => $dsn, prefix => 'dbviewer2';

  # Route
  my $bridge = $app->route->under(sub {...});
  plugin 'DBViewer', dsn => $dsn, 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

  • Execute simple select statement

  • 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;

charset

  charset => 'euc-jp'

Database charset, default is UTF-8.

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
  footer_text => 'Web DB Viewer'

Footer text.

  footer_link => 'https://github.com/yuki-kimoto/webdbviewer'

Footer link

join

  join => {
    book => [
      'left join author on book.author_id = author.id',
      'left join title on book.title_id = title.id'
    ]
  }

Join clause. If you set join clause, you can use join mode in select page.

option

  option => $option
  

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

route

  route => $route

Router for bridge, default to $app-routes>.

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

user

  user => 'kimoto'

site_title

  site_title => 'Your DB Viewer';

Site title.

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.