README
=========================

TabCsvScanner is a console application to translate tabulated Input-files into
SQL-code  suitable  to load  the  code  directly  into a  database.  Supported
databases      are      SQLite       (http://www.sqlite.org),       PostgreSQL
(http://www.postgresql.org/) and MySQL (http://www.mysql.com).


General usage
==================

Installation
---------------

Just  download  the Zip  archiv  and  execute  the  binary for your  platform.
TabCsvScanner  is  provided  both in  source  code  and in  binary  format  for
different  platforms.  Currently the binaries for the following  platforms are
part of the download:  Win32 and Linux32. If a binary for your platform is not
available  or  the  provided  binary  does  not  work  due to  some  C-library
incompatibilities  you can compile the  application  easily yourself using the
GCC-compiler.  As the  source  code  TabCsvScanner.c  does not  depend  on any
external   library  it  should   compile   easily   using  the  command   "gcc
TabCsvScanner.c  -o  TabCsvScanner".  The resulting  binaries  might be copied
somewhere in your PATH and be used directly without any further installation.

Usage
------

The  TabCsvScanner  application  needs at least three arguments for converting
your  Tab-files  into database  data. At first the name of the Tab-file  which
should be scanned and secondly the name of a table prefix or  tablename.  This
allows to store results of different  Tab-files in the same database. A sample
invocation assuming the following input file might be the following:

col1    col2
12      yes
14      no
21      yes

$  TabCsvScanner--Windows-x86.exe  --infile  mytabdata.tab  --prefix  tabdata
        -columns "col1 INT, col2 VARCHAR(3)" --header > tabdata.sql

As the first row  contains  the  column  headers,  we have also to supply  the
optional argument  `--header'. The code in tabdata.sql can be used to fill the
database.

Usage with SQLite
==================

The SQL-code can be directly  piped into the SQLite console  application  like
here:

$ TabCsvScanner-Linux-x86 --infile mytabdata.tab --prefix tabdata --header
    --columns "col1 INT, col2 VARCHAR(3)" | sqlite3 tabdata.sqlite3

Although SQLite does not require the type declarations,  they are recommended
to keep compaibility with the other databases.

Usage with MySQL
=================

The MySQL  command  line  client can be used to import the data into a certain
database. It is recommended to do the following steps in the mysql-shell:
mysql> connect tabdb;
mysql> set autocommit=0;
mysql> source /path/to/tabdata.sql;

this will import your data into the database you are currently connected.

Usage with PostgreSQL
=====================

The psql  command  line  application  can be used to import  the data into the
database you invoke psql for importing the data into sampledb like so:

$ psql tabdb -U youruserid -f /path/to/tabdata.sql

CSV-Data
=========

The  functionality  for importing  Csv-Data is currently  implemented  but not
tested, if you need this  functionality  please  contact the author (email see
below).

License
=========

TabCsvScanner is provided under a BSD-license (see  License.txt). In short
this means that you can do  anything  you want with the source code as long as
you retain our copyright-notice.

Contact
========

TabCsvScanner   is   part   of  the   Bioscanners   project   at   Sourceforge:
http://bioscanners.sf.net.  For  reporting  bugs and  suggestions  the project
maintainer can be reached by email using dgroth(at)gmx(dot)de.