Manual
Table of chapters
Table of contents
1. What is dbMan
Description of this package and much more basic information you can find in
What is dbMan ? readme document and in screenshorts page.
How to mirroring dbMan is described in Mirroring HOWTO.
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
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:
Example:
Example:
Example:
Example:
Example:
Which editor will be executed you can determine through system
environment variable EDITOR (e.g. I have set in bash
export EDITOR=vim).
Example:
Example:
Local memory buffer in one instance of dbMan work without any
restrictions.
Example:
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:
You can set this "plain" format by this tag or from dbMan menu of course.
Example:
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:
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:
I have written much faster engine for importing SQL definition files
(large files) - you can use menu option or this tag.
Example:
Example:
You can use also Perl commands through eval command - such as
in standard SQL input.
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:
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:
Example:
Example:
You must specify host and port on remote side via proxy_host and proxy_port tags.
Example:
Example:
Another way to load plugins is use of plugin_dir tag.
Example:
Example:
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:
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:
Example:
Why is default port 2401 ? I think that my girl was born at
Jun 24 ... good solution, that ?
Example:
Translation to SQL92 statements:
Example:
Example:
Example:
4. Command line options
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.
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.
sorm is login name, mydatabase is database name. You
can specify of course only database (e.g. connect to
mydatabase in command line mode):
Or only login name (this example connect to database defined from
configuration file as sorm in X interface):
Option -x allows start dbMan with Adelton's xdbish parameters (Perl DBI DSN). dbMan also provide xdbish emulator. Using e.g.:
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
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:
If you change this in menu item Window->SQL line->Multi line,
you have got something like this:
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
Functions are devided between this six menus (and three submenus):
Database Menu
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
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:
Table Menu
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
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
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
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.:
will be showed as:
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
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.
7. Internal commands
\.
\. standalone repeat last command, \. n where n is
number repeat n-th command. E.g.
repeat the fifth command in history buffer.
\!
Some typical use:
\b
Typical use:
\c
This internal command open authetification dialog.
\co
\cr
\d
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:
\db
\dt
\e
For example:
\ec
\en
\eh
\es
\ew
\ex
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:
\f
Typical use (first show dialog, second start searching):
\fa
\fap
\fp
\h
Typical use (first show index, second and third description of
SQL command):
\hw
\i
Typical use:
Good thing is combination of executing one query in command line mode
and input file:
and fantastic way (e.g. from another program to build tables etc.) -
in Perl e.g.:
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
\iq
\lt
\m
\o
Typical use (first to standard output, second to file):
\q
\ph
\s
Typical use (first to standard output, second and third to file):
You can use this comand also to save output of internal commands -
like helps etc.:
\sc
\si
\ta
\tb
Same as menu item Database -> Transaction ->
Begin. Please read more info about transaction by Transaction Menu.
\tc
Same as menu item Database -> Transaction ->
Commit. Please read more info about transaction by Transaction Menu.
\tr
Same as menu item Database -> Transaction ->
Rollback. Please read more info about transaction by Transaction Menu.
\w
Typical use:
\wb
\?
about
author
authors
begin
You can use this equivalent variant:
commit
You can use this equivalent variant:
describe
end
You can use this equivalent variant:
eval
exit
help
logout
proxy
Now is supported only getting version of proxy:
rollback
You can use this equivalent variant:
quit
version
dbMan is a simple SQL monitor for common database system (PgSQL, Oracle,
MySQL etc.). It's based on Perl, Tk and DBI interfaces.
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.
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.
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).
buffer
auth mypassword
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).
counting
buffer no
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.
database
counting yes
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.
driver
database template1
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.
empty_null
driver Oracle
If you prefer empty strings as undefined values instead of string
NULL (default), you can use this tag to change it.
external_editor
empty_null yes
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.
fields_separator
external_editor yes
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.
filehistory
fields_separator |-+
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.
font
filehistory no
dbMan must support international environment, because it's used on
projects in Czech Republic, where is work with localized data
required.
format
font -adobe-courier-medium-r-normal-*-*-*-*-*-*-*-iso8859-2
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.
history
format plain
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.
host
history ~/our-team/sql_history
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.
import
host kyklop.fi.muni.cz
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.
login
import quick
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).
login_sql
login sorm
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).
longreadlen
login_sql alter session set current_schema=dbsorm
login_sql eval for (qw/Little Middle Big/) { print "Hello Mr.$_!\n"; }
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.
macro
longreadlen 10000
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.
multiline
macro desc(ribe)? describe
macro region select * from region where nazev like
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.
multiline_count
multiline yes
If multiline tag is enabled,
you can specify number of displayed lines (window is vertical
scrollable of course). Default is three lines.
ndbi_proxy
multiline_count 5
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.
output_len_warn
ndbi_proxy on
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.
plugin
output_len_warn 5000000
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.).
plugin_dir
plugin /usr/lib/dbman/plugins/plugOracle.pm
plugin ~/our-team/plugins/plugIS.pm
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.
port
plugin_dir /usr/lib/dbman/plugins
plugin_dir ~/our-team/plugins
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.
proxy
port 5432
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.
proxy_host
proxy on
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.
proxy_port
host dbserver.fi.muni.cz
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.
sql_transaction
port 2401
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.
summary
\ta end [work|transaction]
\tb begin [work|transaction]
\tc commit
\tr rollback
sql_transaction yes
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.
warning_before
summary yes
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.
warning_before yes
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
dbman -e "select * from faq where ask = 'What is dbMan ?'"
dbman -e "select * from faq" sorm@mydatabase
dbman -l mydatabase
dbman sorm@
dbman -x dbi:Pg:dbname=mydatabase;host=data.myfirm.cz;port=5432
xdbish dbi:Pg:dbname=mydatabase;host=data.myfirm.cz;port=5432
Please look at screenshots for basic
imagine of dbMan windows. Thank you.
Menu hiearchy start at main menubar at to top of main window. Here is
0.0.9's menubar:
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.
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.
\ta end [work|transaction]
\tb begin [work|transaction]
\tc commit
\tr rollback
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.
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.
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.
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.
1|Peter |Magus | 32000|13
1,"Peter","Magus",32000,13
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.
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.
\. 5
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.
\! ps axf
\! echo "Something wonderful !"
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.
\b select * from table1,table2 where table1.key = table2.refkey
\b describe table1
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 command is equivalent of menu item Window -> Counting SQL query
rows (e.g. for command line use).
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.
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.
\d mytable
describe otherschema.yourtable
\b \d nicetable
\b describe longtable
This command is equivalent for menu item Window -> Window only for
single query. E.g. for command line use.
This command display list of tables in output buffer - for
compatibility with psql from PostgreSQL and for quick
orientation in database.
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.
\e mytable
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.
Equivalent for Window -> Show NULL values as empty string.
Clear SQL commands history as menu item Window -> History ->
Erase or erase button in History Window invoked by Window ->
History -> Window.
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.
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.
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.
\ex(backup.sql) table1,table2,table3
\ex mytable,yourtable
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.
\f
\f interest(ing|ed) (thing|commands?) for me
Equivalent for menu item Configuration -> Freeze authentification.
Useful in command line mode - start external editor (in graphics mode
can be started internal editor).
Same as \fa, but with password - as menu item Configuration
-> Freeze authentification with password.
Same as menu item Window -> Plain output.
Without arguments show index of SQL help, with argument try to show
help for argument commands. Command line version of Help menu.
\h
\h select
\h create table
Same as menu item Window -> History -> Window.
This command works as menu item Database -> Import SQL file. But
instead of showing dialog use standard input (without argument)
or from file.
\i
\i definition.sql
dbman -e '\i definition.sql'
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;
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.
Same as menu item Database -> Quick import. Use this before input
for increasing speed.
Start window with List of tables (only in graphics version) - same as
menu item Table -> List of tables.
Start window with Table manager (only in graphics version) - same as
menu item Table -> Manager.
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.
\o
\o output.buffer
Exit dbMan (as menu item Database -> Exit).
Print history buffer into output window with numbers for \. internal command.
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.
\s select * from mytable
\s(file.out) select * from yourtable
\s(table.desc) describe anytable
\s(internal_help) \?
\s(tables) \dt
Same as menu item Configuration -> Save configuration. In command
line mode invoke external editor with configuration file.
Same as menu item Window -> Show summary information.
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.
Begin transaction block. Start transaction process - you must use
\tc and \tr commands to control transaction.
Commit current transaction. Transaction must be started by
\ta command.
Rollback current transaction. Transaction must be started by
\ta command.
This prefix show output of command or query in separate window. Can be
used both with SQL queries and with other internal commands.
\w select * from mytable
\w \?
\w \h select
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.
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.
Now synonym to authors command.
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.
Same as \tb command if SQL92
compatible mode is started.
\tb
begin
begin work
begin trascation
Same as \tc command if SQL92
compatible mode is started.
\tc
commit
Equivalent for \d command. These two
commands makes the same:
\d mytable
describe mytable
Same as \ta command if SQL92
compatible mode is started.
\ta
end
end work
end transaction
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:
Equivalent to \q command.
Equivalent to \h command. You can use
these variant of this fuction:
\h
help
\h select
help select
Equivalent to \q command.
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.
$ dbman -e 'proxy version'
dbMan-proxy 0.1.0
Same as \tr command if SQL92
compatible mode is started.
\tr
rollback
Equivalent to \q command.
Display something like this:
This is dbMan version 0.1.0.