#!/bin/sh
#echo "select count(*) from PollData" | mysql -usatis -psatis satis | tail -n 1 
#echo "select count(*) from PollData where sync = -1" | mysql -usatis -psatis satis | tail -n 1 
#echo "select count(*) from Alarms" | mysql -usatis -psatis satis | tail -n 1 
#echo "select count(*) from Alarms where sync = -1" | mysql -usatis -psatis satis | tail -n 1 

if [ -f scripts.conf ]
then
	. ./scripts.conf
else 
	if [ -f ~/scripts/scripts.conf ] 
	then
		. ~/scripts/scripts.conf
	fi
fi

echo "SELECT\
	(SELECT COUNT(*) FROM PollData) AS TotalRecords,\
	(SELECT COUNT(*) FROM PollData WHERE sync = -1) AS SyncRecords,\
	(SELECT COUNT(*) FROM Alarms) AS TotalAlarms,\
	(SELECT COUNT(*) FROM Alarms WHERE sync = -1) AS SyncAlarms\
 FROM DUAL" | mysql -u$dbuser -p$dbpass $db | tail -n 1 

