From d713997b926fa387b8209d7887344aba906a3fb2 Mon Sep 17 00:00:00 2001 From: Catalin Badea Date: Thu, 2 Aug 2012 20:53:09 +0300 Subject: add test script. diff --git a/test_date.sh b/test_date.sh new file mode 100755 index 0000000..546aacf --- /dev/null +++ b/test_date.sh @@ -0,0 +1,53 @@ +#!/bin/bash +if [ $# -ne 1 ] +then + echo "usage: $0 name@domain.sth" + exit -1; +fi +echo "populating db for user $1" + +dbName='testDB.db' +sqlite="sqlite3" +JIDs=('andrew@gmail.com' 'john@gmail.com' 'carol@redcode.com' 'nick@foss.org' 'james@random.org') +selfJID=$1 +randomWords=('cheese' 'house' 'berry' 'tree' 'glass' 'door' 'music' 'work') + +baseStatement="INSERT INTO messages('message', 'fromBare', 'fromResource', 'toBare', 'toResource', 'type', 'time') VALUES(" +baseMessage="Message from: " + +firstDay=1 +lastDay=8 +month=6 + +$sqlite -line $dbName "CREATE TABLE IF NOT EXISTS messages('message' STRING, 'fromBare' INTEGER, 'fromResource' STRING, 'toBare' INTEGER, 'toResource' STRING, 'type' INTEGER, 'time' INTEGER, 'offset' INTEGER);" + +$sqlite -line $dbName "CREATE TABLE IF NOT EXISTS jids('id' INTEGER PRIMARY KEY ASC AUTOINCREMENT, 'jid' STRING UNIQUE NOT NULL);" + +$sqlite -line $dbName "INSERT INTO jids('jid') VALUES('$selfJID');" + +for (( id=2; id<${#JIDs[@]} + 2; id++ )) +do + echo $id + $sqlite -line $dbName "INSERT INTO jids('jid') VALUES('${JIDs[$((id - 2))]}');" + for (( i=$firstDay; i