NAME
rdbic.pl - Instant CRUD webapp for your database using RapidApp/Catalyst/DBIx::Class
SYNOPSIS
rdbic.pl DSN[,USER,PW] [options]
rdbic.pl --dsn DSN[,USER,PW] [options]
rdbic.pl SQLITE_DB [options]
Options:
--help Display this help screen and exit
--dsn Valid DBI dsn connect string (+ ,user,pw) - REQUIRED
--schema-class DBIC schema class name (blank/non-existant to auto-generate with Schema::Loader)
--port Local TCP port to use for the test server (defaults to 3500)
--tmpdir To use a different dir than is returned by File::Spec->tmpdir()
--no-cleanup To leave auto-generated files on-disk after exit (in tmpdir)
--app-class Name to use for the generated app (defaults to 'rDbicServer')
--run-webapi EXPERIMENTAL: Run WebAPI::DBIC w/ HAL Browser instead of RapidApp
--metakeys EXPERIMENTAL: Path to a RapidApp::Util::MetaKeys data file
--loader-option DBIC::SL name=value opt(s), can be used more than once (same as -o in dbicdump)
--connect-option name=value opt(s) to add to connect_info %extra_attributes
--limit-tables-re Regex limits included table names (see also 'exclude' loader-option)
--limit-schemas-re Regex limits RDBMS 'schema' names (see also 'db_schema' loader-option)
--exclude-tables-re Regex string excludes table names
--exclude-schemas-re Regex string excludes RDBMS 'schema' names
--total-counts-off Initialize grids with total counts off (useful for very large tables)
--crud-profile One of five choices to broadly control CRUD interface behavior (see below)
-I Specifies Perl library include paths, like "perl"'s -I option. You
may add multiple paths by using this option multiple times.
CRUD Profiles:
* editable Full CRUD is enabled with 'persist_immediately' turned off globally which
means the user has to click "Save" to apply queued-up changes (DEFAULT)
* edit-instant Full CRUD is enabled with 'persist_immediately' turned on. Changes are
applied as soon as the cell is blurred after making a change
* edit-gridadd Same as 'editable' except new rows are added directly to the grid
instead of displaying an add record form
* ed-inst-gridadd Same as 'edit-instant' except new rows are added directly to the grid;
"Save" must still be clicked before the row is actually inserted
* read-only No create/update/delete interfaces at all (rapidapp.pl default)
Examples:
rdbic.pl dbi:mysql:dbname,root,''
rdbic.pl to/any/sqlite_db_file
rdbic.pl dbi:mysql:somedb,someusr,smepass --port 5005 --tmpdir /foo --no-cleanup
rdbic.pl --dsn dbi:mysql:database=somedb,root,''
rdbic.pl --port 4001 --dsn dbi:SQLite:/path/to/sqlt.db
rdbic.pl --dsn dbi:SQLite:/path/to/sqlt.db --tmpdir . --no-cleanup
rdbic.pl my_sqlt.db --crud-profile=edit-gridadd
rdbic.pl dbi:Pg:dbname=foo,usr,1234 --crud-profile=edit-instant
rdbic.pl dbi:mysql:foo,root,'' --run-webapi
rdbic.pl my_sqlt.db -Ilib --schema-class My::Existing::Schema
rdbic.pl --dsn \
'dbi:ODBC:Driver=TDS;TDS_Version=7.0;Server=10.1.2.3;Port=1433;Database=Blah',sa,topsecret \
--loader-option db_schema='{ Blah => "%" }' --loader-option use_moose=0
DESCRIPTION
rdbic.pl
is a handy utility which fires up a fully-functional RapidDbic/RapidApp application for a given database/DSN on-the-fly with a single shell command. This avoids having to bootstrap a real application with a name, config, directory, etc with rapidapp.pl or catalyst. All that needs to be supplied to rdbic.pl
is a DSN, although additional options are also available.
rdbic.pl
can be used to replace tools like Navicat or PhpMyAdmin for a general-purpose database client.
Internally, rdbic.pl
simply bootstraps a new application using RapidApp::Helper in the same manner as rapidapp.pl, but the new app is generated in a temporary directory and immediately launched using the standard Catalyst test server, all in one swoop.
The generated/temporary files are automatically cleaned up on exit unless the --no-cleanup
option is supplied.
You can also specify the location of the temporary directory with the --tmpdir
option (defaults to /tmp
or whatever is returned by File::Spec->tmpdir). If you combine with --no-cleanup
you can easily get the full working Catalyst/RapidApp app which was generated, for later use. For instance, these options will create and leave the generated app files within the current directory:
--tmpdir . --no-cleanup
A shorthand first argument syntax is also supported. If the first argument looks like a dsn (starts with 'dbi:') then it will be used as the dsn without having to supply --dsn
first. Additionally, if the first argument is a path to an existing regular file it is assumed to be an SQLite database file, and the appropriate dsn (i.e. "dbi:SQLite:$ARGV[0]") is used automatically.
rdbic.pl
is a wrapper around Plack::App::RapidApp::rDbic which can be used directly in Plack-based setups and provides additional options and functionality not exposed in this script.
See Plack::App::RapidApp::rDbic for more information.
The rdbic.pl
script and rDbic Plack App were also featured in the 2014 Catalyst Advent Calendar:
Day 16 - "Instant database admin tool with RapidApp and rdbic.pl"
Day 17 - "The Plack::App::RapidApp::rDbic interface to RapidApp"
SEE ALSO
RapidApp, rapidapp.pl, Plack::App::RapidApp::rDbic
SUPPORT
IRC:
Join #rapidapp on irc.perl.org.
AUTHOR
Henry Van Styn <vanstyn@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by IntelliTree Solutions llc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.