view release on metacpan or search on metacpan
2.223 2019-11-16
- Update documentation.
- Coming back from a not completed "create table": keep track of sheet index.
2.222 2019-11-16
- Bugfix in 'print_filter_info'.
- Filter "Row Groups": allow to choose more then one group.
2.221 2019-11-15
- Create table: no extra confirm for the insert.
- Menu-updates for: create table, fetch data, parse data, filter data.
- Columns added with Append_col have now an empty header.
- Bugfix in empty_to_null.
- Code refactoring.
- Update documentation.
2.220 2019-10-31
- Bugfix in the empty_to_null filter.
2.219 2019-10-30
- Update required Term::Choose-Util-versions.
- Adapt code to work with the updated Term::Choose::LineFold::line_fold routine.
2.202 2019-05-09
- Update minimum version: Term::Choose, Term::Choose::Util, Term::From.
- Code refactoring.
2.201 2019-05-08
- Bugfix in reading db options.
- Union all: exclude views.
- Menu memory for plugin menu.
- Code refactoring.
2.200 2019-05-03
- New plugin API
- Perl minimum version 5.10.1;
- Enable option menu_memory by default.
- Create and drop views.
- Subqueries: no clause type distinction.
2.071 2019-04-18
- Update documentation.
0.040_02 2014-09-20
- Bugfix "print_error_message".
0.040_01 2014-09-19
- Added experimental sql features (update, delete, insert into).
- Update documentation.
0.040 2014-09-03
- Menu memory for config and SQL menus.
- Replaced "Term::ReadLine::Tiny" with "Term::ReadLine::Simple".
- Update documentation.
0.039 2014-08-16
- Perl minimum version from "5.10.1" to "5.10.0".
0.038 2014-08-16
- Improved documentation.
0.037 2014-07-28
- Update "Reset".
- Code refactoring.
- Update documentation.
0.035_02 2014-07-05
- Code refactoring.
- Fixed option "HELP".
0.035_01 2014-07-04
- New configuration file format: each database driver has now its own file.
- One option ("Menus") instead of three to set table/schema/database menu memory behavior.
- The fetching of the required data for connecting to databases has changed.
- Changed "Reset" option.
- Required minimum version of "Term::TablePrint" is now "0.013".
- Required minimum version of "Term::Choose::Util" is now "0.009".
0.035 2014-06-29
- Required minimum version of "Term::Choose::Util" is now "0.008".
- New option to set the default directories where "db-browser" searches for SQLite databases.
- Update documentation.
lib/App/DBBrowser/From/Subquery.pm
lib/App/DBBrowser/From/Union.pm
lib/App/DBBrowser/GetContent.pm
lib/App/DBBrowser/GetContent/Filter.pm
lib/App/DBBrowser/GetContent/Filter/ConvertDate.pm
lib/App/DBBrowser/GetContent/Filter/SearchAndReplace.pm
lib/App/DBBrowser/GetContent/Parse.pm
lib/App/DBBrowser/GetContent/Source.pm
lib/App/DBBrowser/Options.pm
lib/App/DBBrowser/Options/Defaults.pm
lib/App/DBBrowser/Options/Menus.pm
lib/App/DBBrowser/Options/ReadWrite.pm
lib/App/DBBrowser/Table.pm
lib/App/DBBrowser/Table/CommitWriteSQL.pm
lib/App/DBBrowser/Table/Extensions.pm
lib/App/DBBrowser/Table/Extensions/Case.pm
lib/App/DBBrowser/Table/Extensions/ColAliases.pm
lib/App/DBBrowser/Table/Extensions/Columns.pm
lib/App/DBBrowser/Table/Extensions/Maths.pm
lib/App/DBBrowser/Table/Extensions/ScalarFunctions.pm
lib/App/DBBrowser/Table/Extensions/ScalarFunctions/Date.pm
bin/db-browser view on Meta::CPAN
Before using C<db-browser>, ensure you have backed up your databases.
Search and read in SQL databases: one can interactively browse databases and their tables.
C<App::DBBrowser> provides and supports plugins for the DBI drivers C<DBD::SQLite>, C<DBD::mysql>, C<DBD::MariaDB>,
C<DBD::Pg>, C<DBD::Firebird>, C<DBD::DB2>, C<DBD::Informix>, C<DBD::Oracle> and C<DBD::ODBC>. Refer to
L<App::DBBrowser::DB> for guidance on writing a database plugin.
=head1 NAVIGATION
=head2 Menus
=over
=item *
Use the C<Arrow> keys (or C<h,j,k,l>) to move up and down and to move right or left.
=item *
Press the C<PageUp> key (or C<Ctrl-P>) to go to the previous page and the C<PageDown> key (or C<Ctrl-N>) to go to the
bin/db-browser view on Meta::CPAN
Control characters, code points of the surrogate ranges and non-characters are removed.
See also the option group L</Output>.
C<Ctrl-F> opens a prompt. A regular expression is expected as input. This enables one to display only rows where at
least one column matches the entered pattern. See option L</Search>.
=head1 MENUS
=head2 Plugins Menu
Choosing a plugin leads to the I<Databases Menu>.
(If there is only one plugin, the plugins menu is not shown, but the plugin is chosen automatically.)
=head2 Databases Menu
Choosing a database leads to the I<Schemas Menu>.
(If there is only one database, the databases menu is not shown, but the database is chosen automatically.)
=head2 Schemas Menu
Choosing a schema leads to the I<Tables Menu>.
(If there is not more than one schema, the schemas menu is not shown, but the schema is chosen automatically.)
=head2 Tables Menu
The menu entries of the tables menu:
=head3 Prompt Line
Selecting the prompt line (the database name) opens a menu with these entries:
=over
=item
bin/db-browser view on Meta::CPAN
=back
For I<Create Table>, I<Drop Table>, I<Create View> and I<Drop View>, see L</WRITE ACCESS>.
These entries are available if enabled in L</Extensions>.
I<Attach DB> is available for C<SQLite> databases. I<Attach DB> can be used to attach databases to the current database.
=head3 Tables Entries
Choosing one of the tables leads to the I<SQL Menu>.
=head3 Subquery
I<Subquery> is available if enabled in L</Extensions>.
Enter a subquery and use it as a table.
The query can be created in different ways:
=over
=item SQL Menu
Build the query with the SQL Menu.
Before returning the subquery, the result of the subquery can be displayed by selecting the prompt line of the menu.
This does not work if the subquery is a correlated subquery.
=item Readline
Write the query in the prompt.
=item Stored Queries
bin/db-browser view on Meta::CPAN
Join tables.
This entry is available if enabled in L</Extensions>.
=head3 Union
Combine the result from multiple C<SELECT> statements with C<Union>, C<Intersect> and C<Except> (C<Firebird>: Union).
This entry is available if enabled in L</Extensions>.
=head2 SQL Menu
SQL statements are created in this menu.
The SQL Menu has the following menu entries:
=head3 Prompt Line
Selecting this prompt line (I<Customize:>) opens a menu with these entries:
=over
=item
Insert
bin/db-browser view on Meta::CPAN
=head4 OFFSET
=head3 Export
Export the result of the chosen SQL statement to a C<CSV>-file. See options L</Export Data>.
=head1 WRITE ACCESS
=head2 Create/Drop Table/View
I<Create/Drop Table/View> can be accessed by selecting the prompt-line in the L</Tables Menu> if the respective option
is activated.
Selecting the prompt line of the I<Create/Drop Table/View> submenu allows you to set the parse settings described in
L</Import Data>.
=head3 Create Table
If the option I<Source Type> is set to I<menu>, selecting I<Create Table> opens a submenu where you can choose the type
of the data source. If I<Source Type> is set to I<plain> or I<file>, the set data source type is automatically used
without displaying a menu. For more information, see L</Data Input>.
bin/db-browser view on Meta::CPAN
=head3 Create View
Before creating a view, print the required select statement to make it available in the subquery menu.
=head3 Drop View
Drop a view. The entire view is shown before the user confirms dropping it.
=head2 Insert/Update/Delete
I<Insert>, I<Update> and I<Delete> can be accessed by selecting the prompt-line in the L</SQL Menu> if the respective
option is activated.
I<Delete>, I<Update>, or I<Insert> may not be available with C<Join> and C<Union>/C<Intersect>/C<Except> statements.
=head3 Insert
If the option I<Source Type> is set to I<menu>, selecting I<Insert> opens a submenu where one can choose the type of
the data source. If I<Source Type> is set to I<plain> or I<file>, the set data source type is used without showing a
menu. For more information, see L</Data Input>.
bin/db-browser view on Meta::CPAN
=back
=head1 GLOABL SETTINGS
=head2 Select plugins
Choose the required database plugins.
=head2 Gloabl settings
=head3 Menu Memory
If enabled, saves the menu position while entering a submenu.
=head3 Mouse Mode
Set the I<Mouse mode> (see L<Term::Choose/mouse>).
=head1 OPTIONS
The options menu is accessed with C<db-browser -h>.
bin/db-browser view on Meta::CPAN
=item Attributes
For the meaning of these driver-specific attributes, refer to the appropriate driver documentation.
=back
=head2 Extensions
Add menu entries to menus:
=head3 Tables Menu
=over
=item Subquery
=item CTE
=item Join
=item Union
=back
=head3 Join Menu
=over
=item Subquery
=item CTE
=back
=head3 Union Menu
=over
=item Subquery
=item CTE
=item Where
=item Parentheses
bin/db-browser view on Meta::CPAN
=head3 View Prefix
Enter a string that should be automatically placed in front of all view names.
=head3 Other
=over
=item
Subqueries created with the 'SQL Menu': Allow editing.
When enabled, subqueries created using the 'SQL Menu' can be edited before they are used.
=item
Pg: Convert to C<text> automatically when required.
If the driver is C<Pg>: Convert columns in string functions automatically to C<text> if the datatype of the column is
not a char like datatype. If the datatype is unknown and the value looks like a number, it is also converted to C<text>.
=back
lib/App/DBBrowser/From/Subquery.pm view on Meta::CPAN
}
}
sub __choose_query {
my ( $sf, $sql, $caller, $ext_info ) = @_;
my $ax = App::DBBrowser::Auxil->new( $sf->{i}, $sf->{o}, $sf->{d} );
my $tc = Term::Choose->new( $sf->{i}{tc_default} );
my ( $saved_subqueries, $subquery_history, $print_history ) = $sf->__get_history();
my $edit_sq_history_file = 'Choose:';
my ( $readline, $build_SQ ) = ( ' Readline', ' SQL Menu' );
my @pre = ( $edit_sq_history_file, undef, $build_SQ, $readline );
my $old_idx = 1;
SUBQUERY: while ( 1 ) {
my @queries = $sf->__get_queries( $saved_subqueries, $subquery_history, $print_history );
my $menu = [ @pre, @queries ];
my $info = $ext_info || $ax->get_sql_info( $sql );
# Choose
my $idx = $tc->choose(
$menu,
lib/App/DBBrowser/Options.pm view on Meta::CPAN
use FindBin qw( $RealBin $RealScript );
#use Pod::Usage qw( pod2usage ); # required
use Encode::Locale qw();
use Term::Choose qw();
use Term::Choose::Util qw();
use App::DBBrowser::Auxil;
use App::DBBrowser::Options::Defaults;
use App::DBBrowser::Options::Menus;
use App::DBBrowser::Options::ReadWrite;
sub new {
my ( $class, $info, $options ) = @_;
bless {
i => $info,
o => $options
}, $class;
}
sub __config_global {
my ( $sf ) = @_;
my $op_mn = App::DBBrowser::Options::Menus->new( $sf->{i}, $sf->{o} );
my $op_rw = App::DBBrowser::Options::ReadWrite->new( $sf->{i}, $sf->{o} );
my $groups = $op_mn->groups();
$sf->config_groups( $groups );
$op_rw->read_config_file();
}
sub __config_plugins {
my ( $sf ) = @_;
my $tc = Term::Choose->new( $sf->{i}{tc_default} );
my $op_mn = App::DBBrowser::Options::Menus->new( $sf->{i}, $sf->{o} );
my $chosen_plugins = $sf->{o}{G}{plugins};
my $config_old_idx = 0;
CONFIG_PLUGIN: while ( 1 ) {
if ( @$chosen_plugins == 1 ) {
my $plugin = $chosen_plugins->[0];
my $groups = $op_mn->groups( $plugin );
$sf->config_groups( $groups, $plugin );
last CONFIG_PLUGIN;
}
lib/App/DBBrowser/Options.pm view on Meta::CPAN
if ( -f $file_fs && ! eval { unlink $file_fs or die "unlink '$file_fs': $!" } ) {
$ax->print_error_message( $@ );
}
}
else {
$ax->write_json( $file_fs, $conf );
}
}
}
else {
my $op_mn = App::DBBrowser::Options::Menus->new( $sf->{i}, $sf->{o} );
my $db_old_idx = 0;
DB: while ( 1 ) {
my $prompt = 'Configure ' . $plugin . ' databases';
my @pre = ( undef );
my $menu_db = [ @pre, @databases ];
my $back = length $prefix ? $sf->{i}{_back} : $sf->{i}{back};
# Choose
my $db_idx = $tc->choose(
$menu_db,
lib/App/DBBrowser/Options.pm view on Meta::CPAN
require Pod::Usage; # ctrl-c
Pod::Usage::pod2usage( { -exitval => 'NOEXIT', -verbose => 2 } );
}
}
}
sub config_groups {
my ( $sf, $groups, $plugin, $db ) = @_;
my $tc = Term::Choose->new( $sf->{i}{tc_default} );
my $op_mn = App::DBBrowser::Options::Menus->new( $sf->{i}, $sf->{o} );
my $op_rw = App::DBBrowser::Options::ReadWrite->new( $sf->{i}, $sf->{o} );
my $driver = '';
if ( $plugin ) {
my $plugin_full_name = "App::DBBrowser::DB::$plugin";
eval "require $plugin_full_name" or die $@;
my $plugin = $plugin_full_name->new( $sf->{i}, $sf->{o} );
$driver = $plugin->get_db_driver();
}
my $lo = $op_rw->read_config_file( $driver, $plugin, $db );
my $cursor_first_pos = 0;
lib/App/DBBrowser/Options/Menus.pm view on Meta::CPAN
package # hide from PAUSE
App::DBBrowser::Options::Menus;
use warnings;
use strict;
use 5.016;
use File::Basename qw( fileparse );
use File::Spec::Functions qw( catfile );
use Term::Choose qw();
use Term::Choose::Util qw( insert_sep );
lib/App/DBBrowser/Options/Menus.pm view on Meta::CPAN
{ name => '_csv_out_char', text => "- CSV options a out", section => 'csv_out' },
{ name => '_csv_out_options', text => "- CSV options b out", section => 'csv_out' },
{ name => '_file_encoding_out', text => "- File encoding out", section => 'export' },
],
group_misc => [
{ name => '_search', text => "- Search", section => 'table' },
{ name => '_warnings', text => "- Warnings", section => 'G' },
{ name => 'progress_bar', text => "- Progress bar", section => 'table' },
],
group_global => [
{ name => '_menu_memory', text => "- Menu memory", section => 'G' },
{ name => '_mouse', text => "- Mouse mode", section => 'table' },
],
group_select_plugins => [
{ name => 'plugins', text => "- Select plugins", section => 'G' },
],
};
if ( $driver eq 'DB2' ) {
push @{$groups->{group_output}}, { name => '_db2_encoding', text => "- DB2 encoding", section => 'G' };
}
return $groups->{$group};
lib/App/DBBrowser/Options/Menus.pm view on Meta::CPAN
elsif ( $sub_group eq '_view_name_prefix' ) {
my $items = [
{ name => 'view_name_prefix', prompt => "View name prefix" },
];
my $prompt = 'Set a view name prefix';
$sf->__group_readline( $info, $lo, $section, $items, $prompt );
}
elsif ( $sub_group eq '_other_sql_settings' ) {
my $prompt = 'Your choice: ';
my $sub_menu = [
[ 'edit_sql_menu_sq', "- Subqueries created with 'SQL Menu': Allow editing.", [ $no, $yes ] ],
];
if ( $driver eq 'Pg' ) {
push @$sub_menu, [ 'pg_autocast', "- Pg: Convert to 'text' automatically when required.", [ $no, $yes ] ];
}
$sf->__settings_menu_wrap( $info, $lo, $section, $sub_menu, $prompt );
}
else {
die "sql_settings: unknown sub_group $sub_group";
}
return;
lib/App/DBBrowser/Options/Menus.pm view on Meta::CPAN
return;
}
sub group_global {
my ( $sf, $info, $lo, $section, $sub_group ) = @_;
my ( $no, $yes ) = ( 'NO', 'YES' );
if ( $sub_group eq '_menu_memory' ) {
my $prompt = 'Your choice: ';
my $sub_menu = [
[ 'menu_memory', "- Menu memory", [ $no, $yes ] ],
];
$sf->__settings_menu_wrap( $info, $lo, $section, $sub_menu, $prompt );
}
elsif ( $sub_group eq '_mouse' ) {
my $prompt = 'Your choice: ';
my $sub_menu = [
[ 'mouse', "- Mouse mode", [ $no, $yes ] ]
];
$sf->__settings_menu_wrap( $info, $lo, $section, $sub_menu, $prompt );
}
xt/cntrl_db_browser.t view on Meta::CPAN
lib/App/DBBrowser/From/Subquery.pm
lib/App/DBBrowser/From/Union.pm
lib/App/DBBrowser/GetContent.pm
lib/App/DBBrowser/GetContent/Filter.pm
lib/App/DBBrowser/GetContent/Filter/ConvertDate.pm
lib/App/DBBrowser/GetContent/Filter/SearchAndReplace.pm
lib/App/DBBrowser/GetContent/Parse.pm
lib/App/DBBrowser/GetContent/Source.pm
lib/App/DBBrowser/Options.pm
lib/App/DBBrowser/Options/Defaults.pm
lib/App/DBBrowser/Options/Menus.pm
lib/App/DBBrowser/Options/ReadWrite.pm
lib/App/DBBrowser/Table.pm
lib/App/DBBrowser/Table/CommitWriteSQL.pm
lib/App/DBBrowser/Table/Extensions.pm
lib/App/DBBrowser/Table/Extensions/Case.pm
lib/App/DBBrowser/Table/Extensions/ColAliases.pm
lib/App/DBBrowser/Table/Extensions/Columns.pm
lib/App/DBBrowser/Table/Extensions/Maths.pm
lib/App/DBBrowser/Table/Extensions/ScalarFunctions.pm
lib/App/DBBrowser/Table/Extensions/ScalarFunctions/Date.pm
lib/App/DBBrowser/From/Subquery.pm
lib/App/DBBrowser/From/Union.pm
lib/App/DBBrowser/GetContent.pm
lib/App/DBBrowser/GetContent/Filter.pm
lib/App/DBBrowser/GetContent/Filter/ConvertDate.pm
lib/App/DBBrowser/GetContent/Parse.pm
lib/App/DBBrowser/GetContent/Source.pm
lib/App/DBBrowser/Options.pm
lib/App/DBBrowser/Options/Defaults.pm
lib/App/DBBrowser/Options/Menus.pm
lib/App/DBBrowser/Options/ReadWrite.pm
lib/App/DBBrowser/Table.pm
lib/App/DBBrowser/Table/CommitWriteSQL.pm
lib/App/DBBrowser/Table/Extensions.pm
lib/App/DBBrowser/Table/Extensions/Case.pm
lib/App/DBBrowser/Table/Extensions/ColAliases.pm
lib/App/DBBrowser/Table/Extensions/Columns.pm
lib/App/DBBrowser/Table/Extensions/Maths.pm
lib/App/DBBrowser/Table/Extensions/ScalarFunctions.pm
lib/App/DBBrowser/Table/Extensions/ScalarFunctions/Date.pm