#!/bin/bash
# This extract the table defination from the database.
#When you use sybase then it give less problems for HSQLDB.
# I have not test it if you can use it.
# Supported values are access,
#              sybase, oracle, and postgres. If not specified the generated
#              DDL will be in access forma


# this script is only working with linux.
# It is not important where this script but I think a good place is 
# a) not in the map where the file are
# b) store them in a separate map named bin

# Set the field separator to one line
# we assume that we are working in a map what does have the name of the database.
# We have only to add the extension to then
# we add "../" in front and then it can work
database=../"${PWD/*\/}.mdb"
for datafile  in *.csv
	do
		# now extract table information 
		mdb-schema "${database}" sybase >"${datafile/csv/ddl}"
	done
