The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

db-browser - Search and read in SQLite/MySQL/PostgreSQL databases.

VERSION

Version 0.015

SYNOPSIS

SQLite/MySQL/PostgreSQL

    db-browser

    db-browser -h|--help

When the db-browser is called with the argument -h|--help it shows a menu - see "Options".

SQLite

    db-browser [-s|--search] [directories to be searched]

If no directories are passed the home directory is searched for SQLite databases.

db-browser called with -s|--search causes a new search of SQLite databases instead of using the cached data.

DESCRIPTION

Search and read in SQLite/MySQL/PostgreSQL databases.

To be able to browse database-, schema- and table-lists and the content of tables one needs to have the database privileges required for fetching the respective data.

The db-browser expects an existing home directory with read and write permissions for the user of db-browser.

It is recommended to work with an UTF encoding. Non mappable characters might break the output.

It is needed a terminal with a width of at least 40 print columns.

USAGE

The best way to find out how db-browser works is calling db-browser.

To be able to use all the features of the db-browser some basic SQL knowledge is required.

Keys to move around

  • the Arrow keys (or hjkl) to move up and down respective to move right and left.

  • the PageUp key (or Ctrl-B) to go back one page, the PageDown key (or Ctrl-F) to go forward one page.

  • the Home key (or Ctrl-A) to jump to the beginning of the menu, the End key (or Ctrl-E) to jump to the end of the menu.

  • the Enter/Return key to confirm a chosen menu item.

With the option mouse mode enabled it can be used the mouse with the left mouse key to navigate through the menus instead of the keyboard keys.

The q key goes back (Ctrl-D instead of q if prompted for a string) in the menu hierarchy.

OPTIONS

HELP

Show this Info.

Path

Shows the path of the running db-browser and the application directory.

Tabwidth

Set the number of spaces between columns.

Colwidth

Set the width the columns should have at least when printed.

Undef

Set the string that will be shown on the screen instead of an undefined field.

Max Rows

Set the maximum number of fetched table rows. This can be overwritten by setting a SQL LIMIT statement.

The fetched table rows are kept in memory.

To disable the automatic limit set max rows to undef (--).

ProgressBar

Set the progress bar threshold. If the number of fields (rows x columns) is higher than the threshold a progress bar is shown while preparing the data for the output.

DB Drivers

Choose the needed database drivers.

Operators

Choose the needed operators.

Parentheses

Enable parentheses in WHERE and/or HAVING TO clauses.

Separator

Choose the thousands separator displayed in menus.

Sssc Mode

With the Sssc mode "compat" enabled back-arrows are offered in the SQL menus entries. In the "simple" mode it can be used the q key instead of the back-arrows.

To reset a SQL "sub-statement" (e.g WHERE) re-enter into the respective menu entry and choose '- OK -'.

Expand

Set the behavior of different menus.

For the menus "Choose Database", "Choose Schema" and "Choose Table" setting Expand to "Enchanted" means: save the menu position.

For "Print Table" "Enchanted" means: enable printing the chosen table row.

Mouse Mode

Set the mouse mode (see "mouse" in Term::Choose).

Lock

Set the default lock value:

- Lk0: Reset the SQL-statement after each "PrintTable".

- Lk1: Reset the SQL-statement only when a table is selected.

Metadata

If enabled system tables/schemas/databases are appended to the respective list.

Regexp Case

If enabled REGEXP will match case sensitive.

With MySQL the sensitive match is achieved by enabling the BINARY operator.

DB Login

Determine when db-browser asks for the login data:

- once per DB: log in data is asked once per database.

- only once: log in data is asked only once and then used for all connections.

DB Defaults

Set Database defaults:

Default User

If set the default user is used as username for database logins.

See if it's a number

If set to "YES" DBD::SQLite tries to see if the bind values are number or not, and does not quote if they are numbers.

See DBD::SQLite for details. This is a SQLite-only option.

Enable utf8

If enabled the utf8 flag will be turned on for character data coming from the database.

For a more driver specific explanation see the documentation of the respective Perl DBI driver.

"Binary Filter"

Print "BNRY" instead of arbitrary binary data.

If the data matches the repexp /[\x00-\x08\x0B-\x0C\x0E-\x1F]/ it is considered arbitrary binary data.

Printing arbitrary binary data could break the output.

Database defaults can be overwritten for each Database with the "Database settings".

HINTS

The hints refer to the SQL menu - the menu which opens after a table was selected.

If AGGREGATE or/and GROUP BY is set, the SELECT statement is automatically formed.

Changing the lock mode Lk[01] will also reset the entire SQL.

Scalar functions

There is a hidden menu entry: selecting the prompt Customize: makes available some scalar functions.

To remove a chosen scalar function from a column select the column with the function a second time.

With SQLite the function TRUNCATE returns stringified values:

- when comparing in WHERE or HAVING TO clauses with numbers take the non-truncated (original) value for the comparison if sqlite_see_if_its_a_number is enabled (default).

- also to get a numeric comparison in an ORDER BY clause use the non-truncated (original) values for the ordering.

AUTHOR

Matthäus Kiem <cuer2s@gmail.com>

CREDITS

Thanks to the Perl-Community.de and the people form stackoverflow for the help.

LICENSE AND COPYRIGHT

Copyright 2012-2014 Matthäus Kiem.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For details, see the full text of the licenses in the file LICENSE.