#!/bin/sh

sqlite3 -csv -header /home/dawu/dw.db "select rowid,cardnum,gatenum+1,accessstat,CreatedTime from accessrecord order by rowid desc" > /home/dawu/dwaccess.csv

#output HTTP header
#echo "Pragma: no-cache\n"
#echo "Cache-control: no-cache\n"
#echo "Content-type: application/octet-stream"
#echo "Content-Transfer-Encoding: binary"			#  "\n" make Un*x happy
#echo "Content-Disposition: attachment; filename=\"dwaccess.csv\""
#echo ""

#echo "#The following line must not be removed."
#echo "Default"
#cat /home/dawu/dwaccess.csv 2>/dev/null

