adding DSN to csql.conf based on the cache test mode
[csql.git] / test / cache / CacheTable / test010.ksh
blobe525d72fd581d4999a4f4eb8bb6a29c03f953543
1 #!/bin/sh
2 # Test Case
4 # 9.create table t1 (f1 int, f2 int) in mysql and
5 # create table t1 (f1 int, f2 int, f3 int) in csql.
6 # load with no definition option. should fail.
8 #Run this test only under csql/test or on this directory.
9 #Otherwise, it may fail
10 dropAll() {
11 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
12 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
13 #cp $CSQL_CONFIG_FILE /tmp/csql.conf
14 #echo DSN=$DSN >>$CSQL_CONFIG_FILE
15 isql $DSN < ${REL_PATH}/dropall.sql >/dev/null 2>&1
16 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropall.sql > /dev/null 2>&1
17 #cp /tmp/csql.conf $CSQL_CONFIG_FILE
21 input=${PWD}/cache/CacheTable/create.sql
22 REL_PATH=.
23 if [ -s "$input" ]
24 then
25 REL_PATH=${PWD}/cache/CacheTable
28 cp $CSQL_CONFIG_FILE /tmp/csql.conf
29 echo DSN=$DSN >>$CSQL_CONFIG_FILE
30 isql $DSN < ${REL_PATH}/create.sql >/dev/null 2>&1
31 echo table t1 and t2 are created with records in target db
33 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
34 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
36 # write to the file
37 echo "1:t1 NULL NULL NULL" > /tmp/csql/csqltable.conf
38 echo "2:t2 NULL t2f1<5 NULL" >> /tmp/csql/csqltable.conf
40 $CSQL_INSTALL_ROOT/bin/cachetable -R
41 if [ $? -ne 0 ]
42 then
43 dropAll
44 cp /tmp/csql.conf $CSQL_CONFIG_FILE
45 exit 1;
48 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectstar.sql
49 dropAll
50 cp /tmp/csql.conf $CSQL_CONFIG_FILE
51 exit 0;