dbMan

Manual

Table of chapters

  1. What is dbMan
  2. Installation
  3. Configuration
  4. Command line options
  5. Basic usage
  6. Menus
  7. Internal commands


Table of contents

  1. What is dbMan
  2. Installation
  3. Configuration
  4. Command line options
  5. Basic usage
  6. Menus
  7. Internal commands


1. What is dbMan

dbMan is a simple SQL monitor for common database system (PgSQL, Oracle, MySQL etc.). It's based on Perl, Tk and DBI interfaces.

Description of this package and much more basic information you can find in What is dbMan ? readme document and in screenshorts page.

2. Installation

All basic installations steps and information about installing needed Perl modules, language dependencies and creating simple nDBD drivers and of course types of distribution and rsync installation are in detail describe in Installation HOWTO.

How to mirroring dbMan is described in Mirroring HOWTO.

3. Configuration

dbMan use your user's ~/.dbmanrc file to obtain some default values and for automatic authorization. You can also use dbmanrc file in dbMan installation directory (e.g. /usr/lib/dbman/dbmanrc), but if user have his own ~/.dbmanrc file, this one is use and standard isn't.

Empty lines are ignored, all from hash mark (#) is comment. All others is represented as case-insensitive tag and his argument. In directory argument you can use ~ character instead of user home directory (obtain from shell :)).

You can use these group of tags:

This is description of all tags:

auth

If you specify this tag followed by password, you will be automatically logged into database after dbMan start (this tag invoke same things like setting password and pressing Connect in dbMan authentification dialog).

Without setting auth you have got only pre-setting values in authentification dialog and login_sql tag can't work.

For logging are used other parameters defined via tags database, driver, host, login, login_sql, ndbi_proxy, port, proxy, proxy_host and proxy_port.

Example:

	auth mypassword

buffer

If you use command line interactive mode, you can want don't save SQL outputs into buffer (buffer can be saved to file, but if you don't use this function, buffer catch a lot of free memory for nothing).

Example:

	buffer no

counting

If you plan see counting of SQL output lines, you can set this option to yes. In Tk version is counting displayed as first beveled column with numbers, in command line interface you can see column with vertical colon separator from SQL output. Multiline database rows are counted only as one row.

Example:

	counting yes

database

This tag specify name of database for automatic authentification to database system or for pre-setting dbman authentification dialog. Some database system don't use database names (e.g. Oracle) but use schemas - you can use login_sql tag for change current schema after successfully logging.

Example:

	database template1

driver

In automatic authentification you must specify database driver (nDBD driver) for connection. You can choose from ADO, Adabas, Altera, CSV, DB2, ExampleP, FreeTDS, Fulcrum, Illustra, Informix, Informix4, Ingres, mSQL, mysql, NET, NullP, ODBC, Oracle, Pg, pNET, QBase, Solid, Sponge, Sybase and XBase. You must have installed nDBD and DBD modules for such database system of course.

Example:

	driver Oracle

empty_null

If you prefer empty strings as undefined values instead of string NULL (default), you can use this tag to change it.

Example:

	empty_null yes

external_editor

You can edit SQL query input in editor instead of internal bottom line or lines. Default editor for this is Tk based quite trivial editor. You can use your favourite editor by setting this tag.

Which editor will be executed you can determine through system environment variable EDITOR (e.g. I have set in bash export EDITOR=vim).

Example:

	external_editor yes

fields_separator

Do you hate standard vertical, horizontal and crossing chars in dbMan outputs ? You can change it via this tag. Specify three characters - vertical, horizontal and crossing state. Default is |-+ but you can set e.g. nice $=# or uniform %%% etc.

Example:

	fields_separator |-+

filehistory

Your SQL and internal commands are saved in history buffer and (for persistence) in external file. If you don't want this feature, you can disable dynamic history saving to file by this tag.

Local memory buffer in one instance of dbMan work without any restrictions.

Example:

	filehistory no

font

dbMan must support international environment, because it's used on projects in Czech Republic, where is work with localized data required.

You can specify two types of fonts - for output windows (main window, one quiestion output windows, browseable grid and editable grid) and for all other captions and labels (menus, dialogs, information etc.).

Second group you must specify via Tk command line option -fn (look at czdbman wrapper for see a way for specifying Czech font).

Font for output windows you can specify through this tag - in standard X Window System definition. In dbMan you can find dialog for specifying this font in Window->Font menu. The best way is using system tool such as xfontsel for choosing font and copying this selection into configuration or font selection dialog in dbMan.

Example:

	font -adobe-courier-medium-r-normal-*-*-*-*-*-*-*-iso8859-2

format

Standard format of SQL output is nice table. But you can want typical comma separated list known from other programs such as sqlplus, psql etc.

You can set this "plain" format by this tag or from dbMan menu of course.

Example:

	format plain

history

Your SQL and internal commands are saved in history buffer and (for persistence) in external file. Default file is file named .dbman_history in your home directory (~/.dbman_history), but you can via this tag specify another file in any directory where you can write.

This history file is text file with one SQL input on each row (may be ended via semicolon or not - dbMan ignore it). Because dbMan add lines to this file without looking at content of the file, you can share this file between users - simply team work. After start dbMan, this file will be read and lines stored in local memory buffer.

You can set off using this file through tag filehistory.

Example:

	history ~/our-team/sql_history

host

Some database drivers (e.g. Pg driver) can connect to the another computer in native form. You need select hostname and port for target server machine. Hostname can be selected via this tag, port via tag port.

For other drivers (and of course for this drivers if you can) mean this tag hostname for DBI proxying mechanism (default Perl DBI/DBD proxy mechanism - see proxy tag for detail information). But I don't like DBI proxying - use nDBI proxying rather - see tags proxy_host, proxy_port and ndbi_proxy tags).

Example:

	host kyklop.fi.muni.cz

import

We use dbMan in big project when we build university information system. We have a lot of megabytes of data and when we want load stored SQL definition for rebuilding all tables and content of tables (stored of course by dbMan), dbMan classic import mechanism is quite slow, because dbMan save imported commands to history buffer and disk history file, show output in main output window etc.

I have written much faster engine for importing SQL definition files (large files) - you can use menu option or this tag.

Example:

	import quick

login

To each database you need login name for connect. You can specify them in this tag. If auth tag is defined, automatic logging can be done only with three things - login, password (from auth tag) and driver name (from driver tag).

Example:

	login sorm

login_sql

After sucessfully logging via auth tag you need sometimes make some SQL commands (e.g. select your current schema in Oracle or set datetime format etc.). For this things you can use this tag (you can use multiple tags).

You can use also Perl commands through eval command - such as in standard SQL input.

	login_sql alter session set current_schema=dbsorm
	login_sql eval for (qw/Little Middle Big/) { print "Hello Mr.$_!\n"; }

longreadlen

Perl database engine DBI/DBD limit maximum returned characters from database system through standard DBI parameter LongReadLen. Default value for this parameter in dbMan is 1 million of characters, but you can set your maximum via this tag.

Lower value can increase speed of communication with database system, but you have low top limit of result. Higher value is safer, but slower.

Example:

	longreadlen 10000

macro

dbMan use simple macro language for increase productivity of work. You can specify two regular expressions in Perl syntax - one is pattern, second is substitute. This works like Perl mechanism s///g.

First regular expression end with first white character (space or tab) - if you need use space or tab in first string, try general white space \s or another Perl syntax.

I think I must think much better syntax of this macro language (e.g. describe abbreviation desc is defined in example ... terrible). And I'm afraid some things can't make with this language.

Example:

	macro desc(ribe)? describe
	macro region select * from region where nazev like

multiline

Some people (e.g. Hynek) like multiline input of SQL commands. You can use single input line (default) or multiline (via this tag). Look at multiline_count tag for specify how much line is displayed in multiline.

Example:

	multiline yes

multiline_count

If multiline tag is enabled, you can specify number of displayed lines (window is vertical scrollable of course). Default is three lines.

Example:

	multiline_count 5

ndbi_proxy

If you need (or like) use proxying, you can use classic Perl DBI/DBD proxying or my nDBI/nDBD proxying. Default proxying is Perl proxying (because many people have run dbiproxy server. You can activate proxying via proxy tag, nDBI proxying can be select by this tag.

You must specify host and port on remote side via proxy_host and proxy_port tags.

Example:

	ndbi_proxy on

output_len_warn

If you often use dbMan, you see that dbMan consume a lot of memory, because stores outputs in memory buffers (command line output buffer or Tk window). dbMan can times to times offer you clearing this buffer - how often you can select by this tag. Default value is 1 million of characters.

Example:

	output_len_warn 5000000

plugin

dbMan use plugin system to enhance functions. Plugin can be loaded through menu selection, by internal command or from configuration file. This tag allow loading of one plugin. Plugins have prefix plug and suffix .pm and they are Perl modules with defined functions (register, deregister etc.).

Another way to load plugins is use of plugin_dir tag.

Example:

	plugin /usr/lib/dbman/plugins/plugOracle.pm
	plugin ~/our-team/plugins/plugIS.pm

plugin_dir

dbMan's plugins can be loaded through classic plugin tag. If you need load all plugins from one directory (files with mask plug*.pm), you can use this tag.

Example:

	plugin_dir /usr/lib/dbman/plugins
	plugin_dir ~/our-team/plugins

port

Some database drivers (e.g. Pg driver) can connect to the another computer in native form. You need select hostname and port for target server machine. Hostname can be selected via host tag, port via this tag.

For other drivers (and of course for this drivers if you can) mean this tag port for DBI proxying mechanism (default Perl DBI/DBD proxy mechanism - see proxy tag for detail information). But I don't like DBI proxying - use nDBI proxying rather - see tags proxy_host, proxy_port and ndbi_proxy tags).

Example:

	port 5432

proxy

If you need (or like) use proxying, you can use classic Perl DBI/DBD proxying or my nDBI/nDBD proxying. Default proxying is Perl proxying (because many people have run dbiproxy server. You can activate proxying via this tag, nDBI proxying can be select by tag ndbi_proxy tag.

You must specify host and port on remote side via standard host and port tags.

And what is proxying ? For example if you have Solaris system with Oracle at work and you need use dbMan at home on your Linux system. You can start proxy (dbiproxy, dbman-proxy) on remote system (at work) - e.g. through telnet or ssh session and at home start dbMan connected to proxy at work (over the net go only data, not remote Tk application started on remote side). Nice, that ?

Example:

	proxy on

proxy_host

If you use nDBI proxying (tag ndbi_proxy), you must specify hostname of proxy by this tag. Port can be selected via proxy_port tag.

Example:

	host dbserver.fi.muni.cz

proxy_port

If you use nDBI proxying (tag ndbi_proxy), you must specify port of proxy server by this tag. Hostname can be selected via proxy_host tag.

Why is default port 2401 ? I think that my girl was born at Jun 24 ... good solution, that ?

Example:

	port 2401

sql_transaction

In dbMan exists transaction support by commands \ta, \tb, \tc and \tr. But many people like default transaction SQL92 compatible commands - than you can set this tag to yes.

Translation to SQL92 statements:

	\ta	end [work|transaction]
	\tb	begin [work|transaction]
	\tc	commit
	\tr	rollback	

Example:

	sql_transaction yes

summary

At the end of each select or describe SQL query can be showed short summary information about number of returned rows and columns. If you want this summary set this tag to yes.

Example:

	summary yes

warning_before

Some SQL commands (update, delete, drop, vacuum, shutdown, truncate etc.) can make unrecoverable changes in your database. You can set "paranoic" mode of dbMan when dbMan asks you for commit this commands in special window. This mode can be started by this tag.

Example:

	warning_before yes

4. Command line options

dbMan can be started with some options on command line and with authentification information. Short information can be retrieve by dbman -h:

	Usage: dbman [OPTIONS...] [AUTH INFO]
		-c      Command line shell via NCurses
		-d	Debug on
		-e      Direct execute SQL query
		-h      This little help
		-l      Command line shell
		-q      Quite output
		-s      Command line shell via SLang
		-t	Only Table Designer
		-x	xdbish compatible start - DSN
		-v      Print version

Command line shell (-l) is non-Tk version of dbMan. Now they operate only in standard (-l) version, but I plan NCurses and Slang version (through options -c and -s).

When dbMan starting and loading modules (Perl and its own) type some information on console. You can suppress this messages by option -q.

If you need execute only one query, you can run dbMan with option -e and with SQL command as next argument (-e set also -l - command line output), e.g.

	dbman -e "select * from faq where ask = 'What is dbMan ?'"

Good thing is authentification in configuration file, but sometimes is better specify this through command line. In [AUTH INFO] you can determine login name and database - only password you need to set up in X dialogs or command line ask. E.g.

	dbman -e "select * from faq" sorm@mydatabase

sorm is login name, mydatabase is database name. You can specify of course only database (e.g. connect to mydatabase in command line mode):

	dbman -l mydatabase

Or only login name (this example connect to database defined from configuration file as sorm in X interface):

	dbman sorm@

Option -x allows start dbMan with Adelton's xdbish parameters (Perl DBI DSN). dbMan also provide xdbish emulator. Using e.g.:

	dbman -x dbi:Pg:dbname=mydatabase;host=data.myfirm.cz;port=5432
	xdbish dbi:Pg:dbname=mydatabase;host=data.myfirm.cz;port=5432

Option -d start debugging mode (some additional reports on standard error output).

Option -t start only Table Designer module, similar function has wrapper tdesigner.

5. Basic usage

Please look at screenshots for basic imagine of dbMan windows. Thank you.

You can enter SQL commands or internal commands into SQL input line at the bottom of main window. After pressing Enter or Return key or by clicking to Do button inputs are examined and executed. If you use multiline mode, Enter key only skip to next line, you must use Ctrl and Enter together (Ctrl+Enter) to execute query.

All inputs are stored in memory buffer (and sometimes in disk history file). When you press up or down arrows, you can see previous or next command. In multiline mode you must use (of course) Ctrl+Up and Ctrl+Down keys.

Type Esc key to clear input line. If you write /pattern (slash and searched pattern), dbMan looks into history buffer and find for you last commands with this pattern. Previous match can be selected by pressing Ctrl+/. This selection is made on cycle buffer - you can try to find infinite times. If nothing is found, only empty line is displayed.

Default SQL input is only one-row selection:

Single line input query

If you change this in menu item Window->SQL line->Multi line, you have got something like this:

Multi line input query

And of course you can select number of lines in multi line input in the same menu.

All SQL output can be stored in output window (or in others standalone windows) - you can use scrollbars to show all of formatted outputs. If you need clear main SQL output window, you can use menu item Window->Clear. History can be setting up by menu Window->History.

6. Menus

Menu hiearchy start at main menubar at to top of main window. Here is 0.0.9's menubar:

Database   Table   Plugins   Configuration   Window   Help

Functions are devided between this six menus (and three submenus):

  • Database - open and close database, remote connection, import SQL files, exit dbMan
    • Transaction - begin and end transaction system, commit and rollback transaction, SQL92 compatible transaction
  • Table - Manager, list, browse, count rows of output
  • Plugins - install plugins, plugins
  • Configuration - manipulate with configuration, authentification data (freeze), options
  • Window - find, clear output, some options about window and executing queries, change output font, output to file
    • SQL line - single or multi line mode, number of lines in multiline mode
    • History - saving to disk, erase, window
  • Help - SQL help, internal commands help, about

Database Menu

Database Menu     In this menu you can do some basic operation with database. First of all you must connect to database before executing query and working with dbMan. You can connect direct to database (Open) or connect to database on remote computer via dbiproxy or dbman-proxy (Open remote connection). Both items show authentification dialog with proper functions.

After work you can end this connection by Close item. But exiting dbMan or closing dbMan by other way (killing, Ctrl+C on console, close button on window, quit command etc.) close database too.

Second part of Database Menu functions are anchor to Transaction Menu. If you need work with transactions (good thing) with your database, you can try this.

Third part is part about importing SQL files into dbMan. You can Import SQL file (determined in appearing dialog). If you havn't enabled Quick import of SQL file (as I), all imported commands are stored in history buffer and output of these queries in output window. This makes dbMan import very slow. Than you can enable Quick import - without saving anything in any buffers. This solve your "slow" problem.

And (of course at the end) - exit function. Exit disconnect from database and unload all plugins.

Transaction Menu

Transaction Menu     Transactions are very useful tool with many database system. You can make changes in tables and database and everytimes rollback changes or commit previous steps. This can be important if you need use some "danger" queries for delete or update data - and you don't know if it is correctly written. Transaction solve this situation.

You can start transaction by Begin item. Now all commands in one transaction block will be showed with yellow background (you can directly see what is transaction block and what isn't).

If you plan save changes, you use Commit item. For disappear all changes in tracastion block use Rollback. Commited queries lost his yellow background, rollbacked queries disappear from output window. After Commit/Rollback you automatically start new transaction block.

If you don't need transaction, you can stop it by End/Auto item. This mean that you current transaction will be commited and length of one transaction block will be set up to one query - after each query will be transaction automatically commited.

You can of course use internal commands \tc and \tr for commit/rollback transaction. If you know SQL92 compatible commands for transaction, you can enable last item - SQL compatible commands. After this next commands will be work:

	\ta	end [work|transaction]
	\tb	begin [work|transaction]
	\tc	commit
	\tr	rollback	

Table Menu

Table Menu     This short menu containt key items - I think base functions (gold things) in dbMan. First is Table Manager (item Manager), which display dbMan Table Manager with hiearchically list of tables. I plan functions for creating/editing structure of table here.

Second item display list of tables with buttons for browsing/editing/describing tables etc. I use this list very often - I think editing table in grid is much more better than update queries if we need change one item.

Browse item start dialog asking for select query. This query will be showed in browse grid - better view than output window. You can browse queries of course from internal commands - \b prefix.

Last item count output rows from last select or describe query and show this number. You can use this fuctions instead of counting rows if you need know number of lines of large SQL output.

Plugins Menu

Plugins Menu     Advanced users and teams can want add his (or their) own functions to dbMan. dbMan has interface for building plugins in Perl. You can load plugins automatically after start if you specify these plugins to configuration file or from this menu.

First item display dialog - you can specify plugin (plug*.pm file) with full path or only directory - dbMan load one plugin or all plugins in specified directory.

Next item can unload and load all loaded modules (reload all), but now don't function delete from menus (in Tk) - this functions is only experimental.

Before separator start menu for each plugin (plugins are separated by line). This part isn't translated into each language - plugins control his part of menu himself.

On the picture we can see three standard plugins - plugExample with Example method (shows funny message in output window), plugOracle which can select schema for you in nice dialog and plugPgSQL for PostgreSQL users with three function items - vacuum database cleaner, show list of databases (but you must be connected into one of it - e.g. to template1 database. Third item is list of system pg_ tables - for developers etc.

Configuration Menu

Configuration Menu     This menu help user in manage his configuration of dbMan. You can edit your configuration file in editor which is defined in system environment variable EDITOR - but changes will be affected after next start of dbMan, not after edit.

Second item help user to save current configuration - this add all major settings to the end of dbMan configuration file - you must delete old configuration directive yourself. For this will be started editor as by first item.

Third item use people for storing current authentification to configuration file (please read more about this in configuration part of this manual. Editor will be started for arranging configuration. All new information will be added to the end of configuration file. Password with auth directive will not be saved.

Fourth item do the same thing as third, but save also auth tag - password. Please be careful and look if your configuration file has rw------- access rights (0600 for real UN*Xs men and women).

Last item select warning_before option - before danger SQL commands (update, delete, drop etc.) will be displayed confirmation window. Very useful things if you often make mistakes.

Window Menu

Window Menu     First item of this menu start very useful thing - find in output buffer. This item shows dialog where you can enter Perl regular expression (if you don't know what this is you can read man perlre, basic users can use of course only pattern of sentences.

Second item clear output buffer (dbMan allocate a lot of memory for his output buffer, if you don't need old information you can clear this buffer and you take more free memory for other UN*X things).

Next five options change behaviour of basic functions of dbMan - first "Window only for single query" makes output buffer very short - only for one query output. This can be useful if you have low memory, but you can go back to history of outputs.

Second checkbox change "nice" table format of output to conventional comma separated output - e.g.:

	1|Peter      |Magus        |  32000|13

will be showed as:

	1,"Peter","Magus",32000,13

Third checkbox produce counting each outputs - you will see number before each output line. Fourth option produce little statistics (summary information) after each select or descibe query - you can use this statistics instead of counting outputs.

Last checkbox change meaning of NULL value - disable this checkbox produce default message "NULL" at the position of undefined value, enabled checkbox show empty string - another meaning - you can choose your favoirite or needed.

Font item open dialog for selecting font for output windows (useful for foreign language - e.g. Czech and ISO8859-2 fonts). Next two items open next two menus.

Last item save content of SQL output window to file (permanent hardcopy). You can choose file or standard output (-) in opened dialog.

SQL line Menu

SQL line Menu     This menu can change design of bottom SQL line - from single line to multiple line and reverse (meaning of first two radio buttons). If you have multiline mode you can change number of these lines (third item). Optimum value is between two and ten lines.

You can use internal editor if you edit long query (press Ctrl+Space in SQL line and editor will be started). Internal editor is written in Tk (in command line exist only extarnal editor). Many people hate this little editors and use rather his big editor like vi, joe, pico or emacs - you can set up using of external editor in last item of menu - dbMan use editor from EDITOR system environment variable.

History Menu

History Menu     dbMan contain large history buffer for SQL input query. You can save this buffer permanently to disk transparently if you choose first checkbox in this menu and make its enabled.

You can also erase history buffer by second item - of course this erase memory and disk buffer together.

Last item display history window where you can execute commands from any place in history - you can use this window together with main window and main console (and of course with manager, list of tables and many of output windows if you can).

Help Menu

Help Menu     Last menu is designed for getting information. First item produce the same things as internal command \? - list of internal commands and short description in main window.

Second and third item operate over SQL commands help (which is stored in external files). First of these items show index of current SQL help file in main output buffer, second open dialog for selecting which SQL command help you want to display - in main window or in standalone window.

And of course About item shows version and copyright for dbMan. You can produce this and more information by internal commands about, authors and version.

7. Internal commands

dbMan use large set of internal commands and prefixs for making work with databases and tables (and of course with dbMan) much more simple as we (authors) can program. Now dbMan know these commands (and with these short description):

	\.	  Repeat last SQL command (or \. n repeat n-th SQL history command)
	\!	  Insert output of command \! command to output buffer
	\b	  Browse result of SQL query
	\c	  Open (connect to) database
	\co	  Counting rows of SQL output
	\cr	  Show number of rows from last SQL command
	\d	  Describe table (via SQL)
	\db	  Don't store any data in output buffer
	\dt	  List of tables
	\e	  Edit table (name as arg)
	\ec	  Edit configuration
	\en	  Show undefined values (NULL) as empty strings
	\eh	  Clear SQL commands history
	\es	  Edit SQL command in editor
	\ew	  Clear output SQL window
	\ex	  Export tables to file as SQL definition - \ex(file) tables,...
	\f	  Find dialog
	\fa	  Freeze authentification data
	\fap	  Freeze authentification data with password
	\fp	  Plain format of outputs in SQL queries
	\h	  SQL commands help
	\hw	  Display history window
	\i	  Import SQL file (arg is name, else stdout)
	\ip	  Install plugin (arg is concrete file or directory)
	\iq	  Set quick import of SQL files
	\lt	  List of tables - in separate window
	\m        Table manager
	\o        Send current output buffer to file (arg is filename, else stdout)
	\q        Quit session
	\ph	  Show history of commands in output buffer
	\s	  Save output of current query to file (e.g. \s(file.sql) query), without brackets (\s query) to stdout
	\sc	  Save configuration
	\si	  Show summary information about SQL query
	\ta       Auto transaction (end transaction)
	\tb       Begin transaction
	\tc       Commit
	\tr       Rollback
	\w	  Show output of current query in separate standalone window
	\wb	  Show/hide warnings before dangerous SQL queries
	\?        Show short help
	about	  Show short information about version, license and authors
	author	  Same as authors
	authors	  Show short information about authors and copyrights
	begin	  Same as \tb in SQL92 compatible mode
	commit	  Same as \tc in SQL92 compatible mode
	describe  Same as \d
	end	  Same as \ta in SQL92 compatible mode
	eval	  Evaluating Perl expression
	exit	  Same as \q
	help	  Same as \h
	logout	  Same as \q
	proxy	  Managing dbman-proxy from dbMan
	rollback  Same as \tr in SQL92 compatible mode
	quit	  Same as \q
	version	  Show version

\.

If you want to repeat last SQL command, you can use history buffer and up cursor etc. But you can use also internal command \. which repeat last or any command before last in history buffer.

\. standalone repeat last command, \. n where n is number repeat n-th command. E.g.

	\. 5

repeat the fifth command in history buffer.

\!

If you need call any shell command or external program (I don't know why we need this but this can be useful in SQL input files for producing echo messages etc.) - you can use this internal command. Output will be stored in output window.

Some typical use:

	\! ps axf
	\! echo "Something wonderful !"

\b

If you want browse any SQL query in nice grid rather then in classic output window, you can use menu Table -> Browse or this internal prefix. Write \b before any select, describe or show query in Tk mode - browse window will be opened with result of this query.

Typical use:

	\b select * from table1,table2 where table1.key = table2.refkey
	\b describe table1

\c

You can connect to another database by menu Database -> Open, but in command line mode you can't access to menu item. You can use this internal command instead of menu. Of course this command work in graphics mode.

This internal command open authetification dialog.

\co

This command is equivalent of menu item Window -> Counting SQL query rows (e.g. for command line use).

\cr

This invoke counting lines same as menu item Table -> Count rows. You can use \cr or \cl equivalent. Good for command line mode when menu isn't accessible.

\d

If you need know structure of table, you can use in some database system command describe or desc, but e.g. some Oracle variant or PostgreSQL havn't these commands.

nDBD drivers have defined methos for describing database - and this command call this method. It's same as internal describe command. In database system which describe knows nDBD call original method from database interface.

You can prefix this command by \b to show this in browse window instead of normal output window.

Typical use:

	\d mytable
	describe otherschema.yourtable
	\b \d nicetable
	\b describe longtable

\db

This command is equivalent for menu item Window -> Window only for single query. E.g. for command line use.

\dt

This command display list of tables in output buffer - for compatibility with psql from PostgreSQL and for quick orientation in database.

\e

So as you can browse tables and queries in grid, you can of course edit table in editable grid. Normal way is choosing table in List of tables and pressing Edit button. But you can of course do this by internal command. Use \e followed by name of edited table.

For example:

	\e mytable

\ec

Equivalent for menu item Configuration -> Edit configuration. useful in command line mode to invoke external editor. Configuration will be affected after next start of dbMan.

\en

Equivalent for Window -> Show NULL values as empty string.

\eh

Clear SQL commands history as menu item Window -> History -> Erase or erase button in History Window invoked by Window -> History -> Window.

\es

Edit current SQL command in editor. You can invoke this editor by pressing Ctrl+Space in bottom SQL line and your current query will be transmissed into editor. You can also write only command \es and you can type all query in your favourite (or internal) editor.

\ew

Equivalent for menu item Window -> Clear. This commands clear SQL output window and erase buffer. Information about conservation of memory with these function are written in section about Window Menu.

\ex

You can export SQL table into SQL file as SQL definition - sequence of CREATE TABLE and INSERT commands. This can be very useful in backuping, automatized changing, upgrading and other manipulating with database system.

You can write name of SQL file into argument of this internal command into bracket. Without name will be result displayed on console (standard output).

Example of typical use:

	\ex(backup.sql) table1,table2,table3
	\ex mytable,yourtable

\f

This internal commands show find dialog same as menu item Window -> Find. But you can direct specify pattern (regular expression) for searching - dialog can be skipped.

Typical use (first show dialog, second start searching):

	\f
	\f interest(ing|ed) (thing|commands?) for me

\fa

Equivalent for menu item Configuration -> Freeze authentification. Useful in command line mode - start external editor (in graphics mode can be started internal editor).

\fap

Same as \fa, but with password - as menu item Configuration -> Freeze authentification with password.

\fp

Same as menu item Window -> Plain output.

\h

Without arguments show index of SQL help, with argument try to show help for argument commands. Command line version of Help menu.

Typical use (first show index, second and third description of SQL command):

	\h
	\h select
	\h create table

\hw

Same as menu item Window -> History -> Window.

\i

This command works as menu item Database -> Import SQL file. But instead of showing dialog use standard input (without argument) or from file.

Typical use:

	\i
	\i definition.sql

Good thing is combination of executing one query in command line mode and input file:

	dbman -e '\i definition.sql'

and fantastic way (e.g. from another program to build tables etc.) - in Perl e.g.:

	open DBMAN,"|dbman -e '\i'" or die "dbMan execute error: $!";
	print DBMAN <<EOF;
		create table mytable (a int, b varchar(7));
		insert into mytable (1,'abc');
		insert into mytable (2,'def');
		select * from mytable where a = 1;
		drop table mytable;
		\o /tmp/output.buffer
	EOF
	close DBMAN;

In this example you can see creating database, using, dropping all things and of course saving output to file - can be parsed later in program etc. Can be used also \s command to save only output from select query etc. Good things, that ?

\ip

Equivalent for menu item Plugins -> Install. Argument is file with plugin (plug*.pm) with path or directory (install all plugins from selected directory). It is needed for command line mode when menu isn't accessbile.

\iq

Same as menu item Database -> Quick import. Use this before input for increasing speed.

\lt

Start window with List of tables (only in graphics version) - same as menu item Table -> List of tables.

\m

Start window with Table manager (only in graphics version) - same as menu item Table -> Manager.

\o

Same as Window -> Output to file, but instead of dialog you must use argument (name of output file). Without argument output go to standard output (with '-e' command line option will be these used as piped filter etc.

Typical use (first to standard output, second to file):

	\o
	\o output.buffer

\q

Exit dbMan (as menu item Database -> Exit).

\ph

Print history buffer into output window with numbers for \. internal command.

\s

Save output of current query to file. This prefix has one optional argument in bracket - name of output file. Without brackets prints to standard output.

Typical use (first to standard output, second and third to file):

	\s select * from mytable
	\s(file.out) select * from yourtable
	\s(table.desc) describe anytable

You can use this comand also to save output of internal commands - like helps etc.:

	\s(internal_help) \?
	\s(tables) \dt

\sc

Same as menu item Configuration -> Save configuration. In command line mode invoke external editor with configuration file.

\si

Same as menu item Window -> Show summary information.

\ta

End transaction block. Commit current query and start autocommiting each query. Same as menu item Database -> Transaction -> End/Auto (with Commit). Please read more info about transaction by Transaction Menu.

\tb

Begin transaction block. Start transaction process - you must use \tc and \tr commands to control transaction.

Same as menu item Database -> Transaction -> Begin. Please read more info about transaction by Transaction Menu.

\tc

Commit current transaction. Transaction must be started by \ta command.

Same as menu item Database -> Transaction -> Commit. Please read more info about transaction by Transaction Menu.

\tr

Rollback current transaction. Transaction must be started by \ta command.

Same as menu item Database -> Transaction -> Rollback. Please read more info about transaction by Transaction Menu.

\w

This prefix show output of command or query in separate window. Can be used both with SQL queries and with other internal commands.

Typical use:

	\w select * from mytable
	\w \?
	\w \h select

\wb

Same as menu item Configuration -> Warning before changing SQL commands.

\?

Show short information about backslashed internal commands - like short summary at the begin of this chapter.

about

Display something like this:

	This is dbMan version 0.1.0.

	(c) Copyright 1999-2000 by Milan Sorm <sorm@fi.muni.cz>
	                           and others listed in CREDITS.
	If you will plan to use dbMan you must respect all paragraphs
	GNU General Public License which is provided in file Copying
	or all paragraphs Artistic License listed in Artistic file.

author

Now synonym to authors command.

authors

Show something like this:

	(c) Copyright 1999-2000 by Milan Sorm <sorm@fi.muni.cz>
	                           and others listed in CREDITS.
	If you will plan to use dbMan you must respect all paragraphs
	GNU General Public License which is provided in file Copying
	or all paragraphs Artistic License listed in Artistic file.

begin

Same as \tb command if SQL92 compatible mode is started.

You can use this equivalent variant:

	\tb
	begin
	begin work
	begin trascation

commit

Same as \tc command if SQL92 compatible mode is started.

You can use this equivalent variant:

	\tc
	commit

describe

Equivalent for \d command. These two commands makes the same:

	\d mytable
	describe mytable

end

Same as \ta command if SQL92 compatible mode is started.

You can use this equivalent variant:

	\ta
	end
	end work
	end transaction

eval

You can call any Perl commands in special eval environment. This environment is different from %main environment. You can use this special functions to interface to dbMan:

  • do_sql - execute query on internal command
  • sql_select - return output of select or describe SQL query (LoL)
  • execute - do non-select SQL query

exit

Equivalent to \q command.

help

Equivalent to \h command. You can use these variant of this fuction:

	\h
	help
	\h select
	help select

logout

Equivalent to \q command.

proxy

This command control dbman-proxy on remote side. All commands after prefix proxy will be transmitted to remote server to proxy in special proxy control function.

Now is supported only getting version of proxy:

	$ dbman -e 'proxy version'
	dbMan-proxy 0.1.0

rollback

Same as \tr command if SQL92 compatible mode is started.

You can use this equivalent variant:

	\tr
	rollback

quit

Equivalent to \q command.

version

Display something like this:

	This is dbMan version 0.1.0.

Go back to main page