1#!/bin/sh
2
3sqlr-stop
4sleep 2
5
6#for DB in firebird freetds informix mysql oracle postgresql sap sqlite db2
7for DB in informix mysql oracle postgresql sap sqlite db2
8do
9
10	echo "benching $DB..."
11
12	sqlr-start -id ${DB}test
13	sleep 2
14
15	PING=""
16	for attempts in 1 2 3 4 5 6 7 8 9 10
17	do
18		echo
19		echo "pinging $DB..."
20		PING=`sqlrsh -id ${DB}test -command ping`
21
22		# (this collapses whitespace)
23		PING=`echo $PING`
24
25		echo $PING
26
27		if ( test "$PING" = "0: Couldn't connect to the listener." )
28		then
29			sleep 2
30		else
31			break
32		fi
33	done
34
35	if ( test "$PING" = "The database is up." )
36	then
37		echo
38		echo "success..."
39		echo
40		./sqlr-bench -db $DB
41	else
42		echo
43		echo "failed to start ${DB}test"
44		echo
45		echo "hit enter to continue or ctrl-c to stop..."
46		read
47	fi
48
49	sleep 2
50	sqlr-stop -id ${DB}test
51	sleep 2
52
53	echo
54	echo "================================================================================"
55	echo
56done
57