#!/bin/sh
#
# A one-shot test battery using a large ordinary file (snp.dat) that will have a 'direct' index
#
# The 2>&1 at the end of each command redirects error content into the output file.
#
# The 'snp' data file must be downloaded from http://midriff.sourceforge.net
# and then placed somewhere in your file system.. then set TABLE to contain
# its pathname..

TABLE="../../bigtestdata/snp.dat"

NOINDEX=""

# command to be used when displaying result rows..
SHSQL="shsql -echo -n $NOINDEX"
# command to be used for other things..
SHSQL2="shsql -echo $NOINDEX"


echo "*************************************************"
echo "0. drop any existing index.."
$SHSQL2 "drop index on $TABLE *" 2> /dev/null

echo "*************************************************"
echo "1. create direct index on ordinary file.."
$SHSQL2 "create index (type=direct) on $TABLE (key)" 2>&1


echo "*************************************************"
echo "2. tabdef"
tabdef $TABLE

echo "*************************************************"
echo "3. select"
$SHSQL "select snpid, chr, loc, sts from $TABLE where key inrange 5020000000,5020400000"

