added man pages for utils.

lots of gmdb2 work.
added statistics collection.
This commit is contained in:
brianb
2003-01-05 14:57:50 +00:00
parent cc362c42e9
commit 320f03c401
23 changed files with 1239 additions and 123 deletions

25
doc/mdb-export.txt Normal file
View File

@@ -0,0 +1,25 @@
NAME
mdb-export - Export data in an MDB database table to CSV format.
SYNOPSIS
mdb-export [-H] [-Q] [-d <delimiter>] <database> <table>
DESCRIPTION
mdb-export is a utility program distributed with MDB Tools.
It produces a CSV (comma separated value) output for the given table. Such output is suitable for importation into databases or spreadsheets.
OPTIONS
-H Supress header row
-Q Don't wrap text-like fields (text, memo, date) in quotes. If not specified text fiels will be surrounded by " (double quote) characters.
-d Specify an alternative column delimiter If no delimiter is specified, table names will be delimited by a , (comma) character.
NOTES
HISTORY
mdb-export first appeared in MDB Tools 0\.1
AUTHORS
The mdb-export utility was written by Brian Bruns
BUGS
Memo fields are allowed to contain a newline characters, the current program does nothing about this.

25
doc/mdb-schema.txt Normal file
View File

@@ -0,0 +1,25 @@
NAME
mdb-schema - Generate schema creation DDL
SYNOPSIS
mdb-schema [-T <table>] <database> [<backend>]
DESCRIPTION
mdb-schema is a utility program distributed with MDB Tools.
It produces DDL (data definition language) output for the given database. This can be passed to another database to create a replica of the original access table format.
OPTIONS
-T Single table option. Create schema for this table only.
backend Specifies target DDL dialect. Supported values are access, sybase, oracle, and postgres. If not specified the generated DDL will be in access format.
NOTES
HISTORY
mdb-schema first appeared in MDB Tools 0\.1
AUTHORS
The mdb-schema utility was written by Brian Bruns
BUGS
Relationships and other features may not be supported by all databases.
Access datatypes are mapped to their closest counterparts in the target backend. This may not always yield an exact fit.

67
doc/mdb-sql.txt Normal file
View File

@@ -0,0 +1,67 @@
NAME
mdb-sql - SQL interface to MDB Tools
SYNOPSIS
mdb-sql [-HFp] [-d <delimiter>] [-i <file>] [-o <file>] [<database>]
DESCRIPTION
mdb-sql is a utility program distributed with MDB Tools.
mdb-sql allows querying of an MDB database using a limited SQL subset
language.
OPTIONS
-H Supress header row.
-F Supress footer row.
-p Turn off pretty printing. By default results are printed in an
ascii table format which looks nice but is not condusive to manipulating the
output with unix tools. This option prints output plainly in a tab separated
format.
-d Specify an alternative column delimiter. If no delimiter is
specified, columns will be delimited by a tab character if pretty printing
(-p) is turned off. If pretty printing is enabled this option is meaningless.
-i Specify an input file. This option allows an input file containing the SQL to be passed to mdb-sql. See Notes.
-o Specify an output file. This option allows the name of an output file to be used instead of stdout.
COMMANDS
mdb-sql in interactive mode takes some special commands.
connect to <database> If no database was specified on the command line this command is necessary before any querys are issued. It also allows the switching of databases once in the tool.
disconnect Will disconnect from the current database.
go Each batch is sent to the parser using the 'go' command.
reset A batch can be cleared using the 'reset' command.
list tables The list tables command will display a list of available tables in this database, similar to the mdb-tables utility on the command line.
describe table <table> Will display the column information for the specified table.
quit Will exit the tool.
SQL LANGUAGE
The currently implemented SQL subset is quite small, supporting only single table queries, no aggregates, and limited support for WHERE clauses. Here is a brief synopsis of the supported language.
select: SELECT [* | <column list>] FROM <table> WHERE <where clause>
column list: <column> [, <column list>]
where clause: <column> <operator> <literal> [AND <where clause>]
operator: =, =>, =<, <>, like, <, >
literal: integers, floating point numbers, or string literal in single quotes
NOTES
When passing a file (-i) or piping output to mdb-sql the final 'go' is optional. This allow constructs like
echo "Select * from Table1" | mdb-sql mydb.mdb
to work correctly.
The -i command can be passed the string 'stdin' to test entering text as if using a pipe.
HISTORY
mdb-sql first appeared in MDB Tools 0\.3
AUTHORS
The mdb-sql utility was written by Brian Bruns
BUGS

27
doc/mdb-tables.txt Normal file
View File

@@ -0,0 +1,27 @@
NAME
mdb-tables - Get listing of tables in an MDB database
SYNOPSIS
mdb-tables [-S] [-1 | -d<delimiter>] <database>
DESCRIPTION
mdb-tables is a utility program distributed with MDB Tools.
It produces a list of tables contained within an MDB database in a format suitable for use in shell scripts.
OPTIONS
-S Show system tables. System tables are generally those beginning with 'MSys'
-1 specifies that the tables should be listed 1 per line.
-d delimiter specifies an alternative delimiter. If no delimiter is specified, table names will be delimited by a tab character, or by newline if the -1 option was specified.
NOTES
HISTORY
mdb-tables first appeared in MDB Tools 0\.3
AUTHORS
The mdb-tables utility was written by Brian Bruns
BUGS
Access allows for tables to have spaces embeded in the table name. You must specify a delimiter (-d) if you intend on piping the output of mdb-tables to a program such as awk or cut.

25
doc/mdb-ver.txt Normal file
View File

@@ -0,0 +1,25 @@
NAME
mdb-ver - Return the format of a given MDB database.
SYNOPSIS
mdb-ver <database>
DESCRIPTION
mdb-ver is a utility program distributed with MDB Tools.
It will return a single line of output with either 'JET3' for those files produced in Access 97 format or 'JET4' for those produced by Access 2000 and XP.
OPTIONS
NOTES
Access changed its format between Jet 3 used in Access 97 and Jet 4 used for Access 2000 and XP. The nature of the changes included moving the page size from 2K to 4K and added support for unicode. MDB Tools actively supports both formats.
HISTORY
mdb-ver first appeared in MDB Tools 0\.4
AUTHORS
The mdb-ver utility was written by Brian Bruns
BUGS
mdb-ver does minimal checking on the validity of a file. It is possbile for it to misidentify a non-MDB file.
mdb-ver does not recognize Access 2.0 (Jet 2) or the newer MSDE format files.

307
doc/txt2man Executable file
View File

@@ -0,0 +1,307 @@
#!/bin/sh
test "$HOME" = ~ || exec ksh $0 "$@" # try ksh if sh too old (not yet POSIX)
# Copyright (C) 2001, 2002 Marc Vertes
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# txt2man-1.4.5
usage()
{
cat << EOT
NAME
txt2man - convert flat ASCII text to man page format
SYNOPSIS
txt2man [-hpTX] [-t mytitle] [-P pname] [-r rel] [-s sect]
[-v vol] [-I txt] [-B txt] [ifile]
DESCRIPTION
txt2man converts the input text into nroff/troff standard man(7)
macros used to format Unix manual pages. Nice pages can be generated
specially for commands (section 1 or 8) or for C functions reference
(sections 2, 3), with the ability to recognize and format command and
function names, flags, types and arguments.
txt2man is also able to recognize and format sections, paragraphs,
lists (standard, numbered, description, nested), cross references and
literal display blocks.
If input file ifile is omitted, standard input is used. Result is
displayed on standard output.
Here is how text patterns are recognized and processed:
Sections These headers are defined by a line in upper case, starting
column 1. If there is one or more leading spaces, a
sub-section will be generated instead.
Paragraphs They must be separated by a blank line, and left aligned.
Tag list The item definition is separated from the item description
by at least 2 blank spaces, even before a new line, if
definition is too long. Definition will be emphasized
by default.
Bullet list
Bullet list items are defined by the first word being "-"
or "*" or "o".
Enumerated list
The first word must be a number followed by a dot.
Literal display blocks
This paragraph type is used to display unmodified text,
for example source code. It must be separated by a blank
line, and be indented. It is primarily used to format
unmodified source code. It will be printed using fixed font
whenever possible (troff).
Cross references
A cross reference (another man page) is defined by a word
followed by a number in parenthesis.
Special sections:
NAME The function or command name and short description are set in
this section.
SYNOPSIS This section receives a special treatment to identify command
name, flags and arguments, and propagate corresponding
attributes later in the text. If a C like function is recognized
(word immediately followed by an open parenthesis), txt2man will
print function name in bold font, types in normal font, and
variables in italic font. The whole section will be printed using
a fixed font family (courier) whenever possible (troff).
It is a good practice to embed documentation into source code, by using
comments or constant text variables. txt2man allows to do that, keeping
the document source readable, usable even without further formatting
(i.e. for online help) and easy to write. The result is high quality
and standard complying document.
OPTIONS
-h The option -h displays help.
-P pname Set pname as project name in header. Default to uname -s.
-p Probe title, section name and volume.
-t mytitle Set mytitle as title of generated man page.
-r rel Set rel as project name and release.
-s sect Set sect as section in heading, ususally a value from 1 to 8.
-v vol Set vol as volume name, i.e. "Unix user 's manual".
-I txt Italicize txt in output. Can be specified more than once.
-B txt Emphasize (bold) txt in output. Can be specified more than once.
-T Text result previewing using PAGER, usually more(1).
-X X11 result previewing using gxditview(1).
ENVIRONMENT
PAGER name of paging command, usually more(1), or less(1). If not set
falls back to more(1).
EXAMPLE
Try this command to format this text itself:
$ txt2man -h | txt2man -T
HINTS
To obtain an overall good formating of output document, keep paragraphs
indented correctly. If you have unwanted bold sections, search for
multiple spaces between words, which are used to identify a tag list
(term followed by a description). Choose also carefully the name of
command line or function parameters, as they will be emphasized each
time they are encountered in the document.
SEE ALSO
man(1), mandoc(7), rman(1), groff(1), more(1), gxditview(1), troff(1).
BUGS
- Automatic probe (-p option) works only if input is a regular file (i.e.
not stdin).
AUTHOR
mvertes@cimai.com (Marc Vertes)
EOT
}
sys=$(uname -s)
rel=
volume=
section=
title=untitled
doprobe=
itxt=
btxt=
post=cat
while getopts :hpTXr:s:t:v:P:I:B: opt
do
case $opt in
r) rel=$OPTARG;;
t) title=$OPTARG;;
s) section=$OPTARG;;
v) volume=$OPTARG;;
P) sys=$OPTARG;;
p) doprobe=1;;
I) itxt="$OPTARG<52>$itxt";;
B) btxt=$OPTARG;;
T) post="groff -mandoc -Tlatin1 | ${PAGER:-more}";;
X) post="groff -mandoc -X";;
*) usage; exit;;
esac
done
shift $(($OPTIND - 1))
if test "$doprobe"
then
title=${1##*/}; title=${title%.txt}
grep -q '#include ' $1 &&
{ section=${section:-3};
volume=${volume:-"$sys Programmer's Manual"}; } ||
{ section=${section:-1};
volume=${volume:-"$sys Reference Manual"}; }
# get release from path
rel=$(pwd | sed 's:/.*[^0-9]/::g
s:/.*::g')
fi
head=".TH $title $section \"$(date +'%B %d, %Y')\" \"$rel\" \"$volume\""
expand $* | # All tabs converted to spaces
gawk -v head="$head" -v itxt="$itxt" -v btxt="$btxt" ' # gawk is needed because use of non standard regexp
BEGIN {
print ".\\\" Text automatically generated by txt2man-1.4.5"
print head
avar[1] = btxt; avar[2] = itxt
for (k in avar) {
mark = (k == 1 ? "\\fB" : "\\fI")
split(avar[k], tt, "<22>")
for (i in tt)
if (tt[i] != "")
subwords["\\<" tt[i] "\\>"] = mark tt[i] "\\fP"
delete tt
}
delete avar
}
{ sub(/\.\.\./, "\\.\\.\\.") }
/^[^[:lower:]]+$/ { # Section header
if (in_bd == 1) {
in_bd = 0
print ".fam T\n.fi"
}
if (section == "SYNOPSIS") {
print ".fam T\n.fi"
type["SYNOPSIS"] = ""
}
if ($0 ~/^[^[:space:]]/) print ".SH " $0
else print ".SS" $0
sub(/^ +/, "")
section = $0
if (section == "SYNOPSIS") print ".nf\n.fam C"
ls = 0 # line start index
pls = 0 # previous line start index
pnzls = 0 # previous non zero line start index
ni = 0 # indent level
ind[0] = 0 # indent offset table
prevblankline = 0
next
}
{ # compute line start index, handle start of example display block
pls = ls
if (ls != 0) pnzls = ls
match($0, /[^ ]/)
ls = RSTART
if (pls == 0 && pnzls > 0 && ls > pnzls && $1 !~ /^[0-9\-\*\o]\.*$/) {
# example display block
if (prevblankline == 1) { print ".PP"; prevblankline = 0 }
print ".nf\n.fam C"
in_bd = 1
eoff = ls
}
if (ls > 0 && ind[0] == 0) ind[0] = ls
}
in_bd == 1 { # In example display block
if (ls != 0 && ls < eoff) { # End of litteral display block
in_bd = 0
print ".fam T\n.fi"
} else { print; next }
}
section == "NAME" { $1 = "\\fB" $1; sub(/ \- /, " \\fP- ") }
section == "SYNOPSIS" { # Identify arguments of fcts and cmds
if (type["SYNOPSIS"] == "") {
if (index($0, "(") == 0 && index($0, ")") == 0 &&
index($0, "#include") == 0)
type["SYNOPSIS"] = "cmd"
else
type["SYNOPSIS"] = "fct"
}
if (type["SYNOPSIS"] == "cmd") { # Line is a command line
if ($1 !~ /^\[/) {
b = $1
sub(/^\*/, "", b)
subwords["\\<" b "\\>"] = "\\fB" b "\\fP"
}
for (i = 2; i <= NF; i++) {
a = $i
gsub(/[\[\]\|]/, "", a)
if (a ~ /^[^\-]/) subwords["\\<" a "\\>"] = "\\fI" a "\\fP"
}
} else { # Line is a C function definition
for (i = 1; i <= NF; i++)
if ($i ~ /[\,\)]/) {
a = $i
sub(/.*\(/, "", a)
gsub(/\W/, "", a)
subwords["\\<" a "\\>"] = "\\fI" a "\\fP"
}
}
}
{
for (i = 1; i <= NF; i++) { # identify func calls and cross refs
while ($i ~ /\w\.\w/) sub(/\./, "_dOt_", $i) # protect dots inside words
b = $i
sub(/^\*/, "", b)
if ((a = index(b, ")(")) > 0) {
w = substr(b, 3, a - 3)
subwords["\\<" w "\\>"] = "\\fI" w "\\fP"
}
if ((a = index(b, "(")) > 0) {
w = substr(b, 1, a - 1)
subwords["\\<" w "\\("] = "\\fB" w "\\fP("
}
}
#for (i in subwords) gsub(i, subwords[i]) # word attributes
gsub(/\B\-+\w+(\-\w+)*/, "\\fB&\\fP") # shell options
gsub(/_dOt_/, ".") # unprotect dots inside words
if (match($0, /[^ ] +/) > 0) { # tag list item
adjust_indent()
tag = substr($0, 1, RSTART)
sub(/^ */, "", tag)
tail = substr($0, RSTART + RLENGTH)
print ".TP\n.B"
print tag
$0 = tail
prevblankline = 0
if (NF == 0) next
} else if ($1 == "-"||$1 == "o"||$1 == "*") { # bullet list item
adjust_indent()
print ".IP \\(bu 3"
prevblankline = 0
$1 = ""
} else if ($1 ~ /^[0-9]+[\).]$/) { # enum list item
adjust_indent()
print ".IP " $1 " 4"
prevblankline = 0
$1 = ""
} else if (pls == 0) { # new paragraph
adjust_indent()
} else if (NF == 0) { # blank line
prevblankline = 1; next
} else prevblankline = 0 # other
if (prevblankline == 1) { # flush vertical space
print ".PP"; prevblankline = 0
}
sub(/ */,"") # trim leading blank spaces
print
}
function adjust_indent()
{
if (ls > ind[ni]) { ind[++ni] = ls; print ".RS" }
else if (ls < ind[ni])
while (ls < ind[ni]) { ni--; print ".RE" }
}
' | eval $post