latexdb(1)

latexdb

latexdb - Extend LaTeX documents with SQL database access

SYNTAX

latexdb -h
latexdb <tex file>

DESCRIPTION

latexdb enhances standard latex by allowing you to use SQL queries in your TeX documents.

There are three additional commands that you can embed in documents. They are used for setting up the database connection (currently only MySQL is supported), creating SQL select queries, and accessing the result sets.

OPTIONS

Any option other than -h will be forwarded to latex(1). Note that the filename must always be the first argument, before any latex options.

FILES

/etc/latexdbrc
~/.latexdbrc

EXAMPLES

To run this program the standard way type:

latexdb somefile.tex

The extra commands to be used in your TeX files are

\texdbconnection{DBType,host,user,passwd,db}
    DBType can currently only be "MySQL", host, user, and passwd are the data needed to access the database server, and db is the database name.

\texdbdef{##query}{select var1,var2,... from table where...}{##VAR1,##VAR2;,...}
    ##query defines a name for the query, and it will be used later in a \texdbfor statement. the second group holds a standard SQL query. Actually you can send any data to the SQL server, including updates, but that makes no sense in the context of the program right now. The third part is used to give names to the column fields which are to be returned. So if you know your table well, you could do a "select * from table" query and simply name all columns.

\texdbfor{##query}{... some LaTeX stuff with ##VAR1, ...}
    This is how you access the result sets for your queries. ##query must be a query name that was defined in a \texdbdef statement. ##VAR1, ... refer to the column names given in that statement.

While the first two need to be on one line (and have no other TeX code on those lines), the third one can expand over several lines and have regular LaTeX code in front and past it.

All special commands can occur anywhere in the tex document (with the only rule that a database has to be definied before any query definitions, and query definitions must precede the first use of the result sets. However, I recommend putting database and query definitions in the tex header, before the \begin{document} statement.

You can do short things like

Your address is \texdbfor{##people}{##street in the
    town of ##town}, and that's where I will send the package.

AUTHORS

Hans-Georg Eßer <h.g.esser@gmx.de>

SEE ALSO

latex(1) mysql(1)