#!/bin/sh
OUTDIR=${1:-/tmp}
dbdir=$(cd `dirname $0`; pwd -P)/../db
echo $dbdir
for i in mapitem mapname maptype attribute:attr object:obj; do
  tbl=${i%:*}
  csv=${i#*:}
  sqlite3 -csv $dbdir/viewer_prc.sq3 <<-EOF
	.once $OUTDIR/$csv.csv
	SELECT * FROM $tbl
	EOF
  echo $tbl TABLE output to $OUTDIR/$csv.csv
done
