App-DBBrowser

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

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.

Changes  view on Meta::CPAN

        - 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

Changes  view on Meta::CPAN

        - 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

Changes  view on Meta::CPAN

        - 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.

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

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.

For DB Settings, see L</DB Settings>.

=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

The options menu is accessed with C<db-browser -h>.

=head2 Plugins

Choose the required database plugins.

=head2 DB Settings

These driver-specific I<DB Settings> are used as the default database settings.

In the prompt line menu of the L</Tables Menu>, the entry I<DB Settings> (if enabled in L</Extensions>) allows users to
make database-specific settings. If no database-specific settings are set, these global settings (for the database
plugin) I<DB Settings> are used.

User-defined database plugins: The options offered to be set in each option and whether the user's selections are
considered depend on the plugin.

=over

=item Fields

bin/db-browser  view on Meta::CPAN

=item Reset DB

Reset database-specific parameters to the global I<DB Settings>.

=back

=head2 Extensions

Add menu entries to menus:

=head3 Tables Menu

=over

=item Subquery

=item CTE

=item Join

=item Union

=item DB settings

=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

bin/db-browser  view on Meta::CPAN

Set C<always_quote>, C<binary>, C<escape_null>, C<quote_binary>, C<quote_empty> and C<quote_space>.

For the meaning of the different options, see L<Text::CSV_XS>.

=head3 File Encoding Out

The encoding of the exported CSV file.

=head2 Miscellaneous

=head3 Menu Memory

If enabled, saves the menu position while entering a submenu.

=head3 Expand Table

Expand table rows:

=over

=item C<YES>

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/Opt/Set.pm  view on Meta::CPAN

            { name => '_data_source_type',  text => "- Source type",       section => 'insert' },
        ],
        group_export => [
            { name => 'export_dir',         text => "- Destination folder", section => 'export'  },
            { name => '_exported_files',    text => "- File name",          section => 'export'  },
            { name => '_csv_out_char',      text => "- CSV options out a",  section => 'csv_out' },
            { name => '_csv_out_options',   text => "- CSV options out b",  section => 'csv_out' },
            { name => '_file_encoding_out', text => "- File encoding out",  section => 'export'  },
        ],
        group_misc => [
            { name => '_menu_memory',  text => "- Menu memory",  section => 'G'     },
            { name => '_table_expand', text => "- Expand table", section => 'table' },
            { name => '_search',       text => "- Search",       section => 'table' },
            { name => '_mouse',        text => "- Mouse mode",   section => 'table' },
            { name => '_db2_encoding', text => "- DB2 encoding", section => 'G'     },
        ],
    };
    return $groups->{$group_name};
}


lib/App/DBBrowser/Opt/Set.pm  view on Meta::CPAN

                }
                my $prompt = "\n" . 'Database plugins:';
                $sf->__choose_a_subset_wrap( $section, $opt, [ sort keys %installed_driver ], $prompt );
            }
            elsif ( $opt eq '_db_defaults' ) {
                my $odb = App::DBBrowser::Opt::DBSet->new( $sf->{i}, $sf->{o} );
                $odb->database_setting();
            }
            ##### Extensions #####
            elsif ( $opt eq '_e_table' ) {
                my $prompt = 'Extend Tables Menu:';
                my $sub_menu = [
                    [ 'm_derived',   "- Add Subquery",      [ $no, $yes ] ],
                    [ 'm_cte',       "- Add Cte",         [ $no, $yes ] ],
                    [ 'join',        "- Add Join",        [ $no, $yes ] ],
                    [ 'union',       "- Add Union",       [ $no, $yes ] ],
                    [ 'db_settings', "- Add DB settings", [ $no, $yes ] ],
                ];
                $sf->__settings_menu_wrap( $section, $sub_menu, $prompt );
            }
            elsif ( $opt eq '_e_join' ) {
                my $prompt = 'Extend Join Menu:';
                my $sub_menu = [
                    [ 'j_derived', "- Add Subquery", [ $no, $yes ] ],
                    [ 'j_cte',     "- Add Cte",      [ $no, $yes ] ],
                ];
                $sf->__settings_menu_wrap( $section, $sub_menu, $prompt );
            }
            elsif ( $opt eq '_e_union' ) {
                my $prompt = 'Extend Union Menu:';
                my $sub_menu = [
                    [ 'u_derived',     "- Add Subquery",   [ $no, $yes ] ],
                    [ 'u_cte',         "- Add Cte",        [ $no, $yes ] ],
                    [ 'u_edit_stmt',   "- Edit Statement", [ $no, $yes ] ],
                    [ 'u_parentheses', "- Parentheses",    [ $no, $yes ] ],
                ];
                $sf->__settings_menu_wrap( $section, $sub_menu, $prompt );
            }
            elsif ( $opt eq '_e_expressions' ) {
                my $prompt = 'Extended expressions:';

lib/App/DBBrowser/Opt/Set.pm  view on Meta::CPAN

                my $items = [
                    { name => 'view_name_prefix', prompt => "View name prefix" },
                ];
                my $prompt = 'Set a view name prefix';
                $sf->__group_readline( $section, $items, $prompt );
            }
            elsif ( $opt eq '_other_sql_settings' ) {
                my $prompt = 'Your choice: ';
                my $sub_menu = [
                    #[ 'limit_fetch_col_names', "- Fetch column names with LIMIT 0", [ $no, $yes ] ], ##
                    [ 'edit_sql_menu_sq',      "- Subqueries created with 'SQL Menu': Allow editing.", [ $no, $yes ] ],
                    [ 'pg_autocast',           "- Pg: Convert to 'text' automatically when required.", [ $no, $yes ] ],
                ];
                $sf->__settings_menu_wrap( $section, $sub_menu, $prompt );
            }
            ##### Create table ####
            elsif ( $opt eq '_enable_ct_opt' ) {
                my $prompt = 'Activate options';
                my $sub_menu = [
                    [ 'option_ai_column_enabled', "- Option 'Auto Increment'", [ $no, $yes ] ],
                    [ 'data_type_guessing',       "- Data type guessing",      [ $no, $yes ] ],

lib/App/DBBrowser/Opt/Set.pm  view on Meta::CPAN

                    [ 'quote_binary', "- quote_binary", [ $no, $yes ] ],
                    [ 'quote_empty',  "- quote_empty",  [ $no, $yes ] ],
                    [ 'quote_space',  "- quote_space",  [ $no, $yes ] ],
                ];
                $sf->__settings_menu_wrap( $section, $sub_menu, $prompt );
            }
            ##### misc #####
            elsif ( $opt eq '_menu_memory' ) {
                my $prompt = 'Your choice: ';
                my $sub_menu = [
                    [ 'menu_memory', "- Menu memory", [ $no, $yes ] ],
                ];
                $sf->__settings_menu_wrap( $section, $sub_menu, $prompt );
            }
            elsif ( $opt eq '_table_expand' ) {
                my $prompt = 'Your choice: ';
                my $sub_menu = [
                    [ 'table_expand', "- Expand table rows",   [ $no, $yes ] ],
                ];
                $sf->__settings_menu_wrap( $section, $sub_menu, $prompt );
            }



( run in 0.675 second using v1.01-cache-2.11-cpan-49f99fa48dc )