From b31389a8c134d44eb9ef2c89f85212879292d90d Mon Sep 17 00:00:00 2001 From: bijaya Date: Mon, 22 Sep 2008 06:49:25 +0000 Subject: [PATCH] 2092882 error in commit /rollback query Test Script --- test/sqlapi/Select/create.sql | 61 ++++++++++++++++++++++++ test/sqlapi/Select/csql.conf | 70 +++++++++++++++++++++++++++ test/sqlapi/Select/exp.test005.ksh | 97 ++++++++++++++++++++++++++++++++++++++ test/sqlapi/Select/test005.ksh | 28 +++++++++++ 4 files changed, 256 insertions(+) create mode 100644 test/sqlapi/Select/create.sql create mode 100644 test/sqlapi/Select/csql.conf create mode 100644 test/sqlapi/Select/exp.test005.ksh create mode 100755 test/sqlapi/Select/test005.ksh diff --git a/test/sqlapi/Select/create.sql b/test/sqlapi/Select/create.sql new file mode 100644 index 00000000..c709af22 --- /dev/null +++ b/test/sqlapi/Select/create.sql @@ -0,0 +1,61 @@ +echo create table t1 (f1 int,f2 int); +create table t1 (f1 int,f2 int); +echo check for SET AUTOCOMMIT OFF; +SET AUTOCOMMIT OFFer; +echo insert some record; +insert into t1 values(10,20); +insert into t1 values(20,30); +insert into t1 values(30,40); +insert into t1 values(40,50); +insert into t1 values(50,60); +echo rollback; +rollback; +echo select * from t1; +select * from t1; + +SET AUTOCOMMIT OFF; +insert into t1 values(30,40); +insert into t1 values(30,40); +insert into t1 values(30,40); +insert into t1 values(30,40); +insert into t1 values(30,40); +insert into t1 values(30,40); +insert into t1 values(30,40); +insert into t1 values(30,40); +insert into t1 values(30,40); +insert into t1 values(30,40); +echo test for commit; +commiter; +rollback; +select * from t1; + +echo test for rollback; +echo insert 5 records; + +insert into t1 values(20,40); +insert into t1 values(20,40); +insert into t1 values(20,40); +insert into t1 values(20,40); +insert into t1 values(20,40); +rollbacked; +commit; +select * from t1; + +echo check for show tables; +show tablesss; + +echo check for SET AUTOCOMMIT ON; + +SET AUTOCOMMIT ONNER; +echo insert some records; + +insert into t1 values(50,60); +insert into t1 values(50,60); +insert into t1 values(50,60); +insert into t1 values(50,60); +insert into t1 values(50,60); +rollback; +select * from t1; + +echo drop teble; +drop table t1; diff --git a/test/sqlapi/Select/csql.conf b/test/sqlapi/Select/csql.conf new file mode 100644 index 00000000..e33cef74 --- /dev/null +++ b/test/sqlapi/Select/csql.conf @@ -0,0 +1,70 @@ +# CSQL System Configuration File + +#####################################Server Section######################## +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined + +# Page size. Each database is logically divided into pages and allocation happens +# in this unit of pages. Increasing this value will reduce frequent allocation of pages. +PAGE_SIZE= 8192 + +#Total number of client process which can connect and work with the +# database concurrently +MAX_PROCS = 100 + +# Maximum size of the system database. +MAX_SYS_DB_SIZE=1048576 + +#Maximum size of the user database file. +MAX_DB_SIZE=10485760 + +#Shared memory key to be used by the system to create and locate system database. +SYS_DB_KEY=1199 + +#Shared memory key to be used by the system to create and locate user database. +USER_DB_KEY=2277 + +#Give full path for the log file where important system actions are stored. +LOG_FILE=/tmp/log/csql/log.out + +#The virtual memory start address at which the shared memory segment +# will be created and attached. +MAP_ADDRESS=400000000 + +#Give full path for the database file where table and record information will +#be stored for durability +DATABASE_FILE=/tmp/csql/csql.db + +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined +#####################################Client Section######################## + +#Mutex timeout interval seconds +MUTEX_TIMEOUT_SECS=0 +MUTEX_TIMEOUT_USECS=5000 +MUTEX_TIMEOUT_RETRIES=10 + +#Lock timeout interval seconds +LOCK_TIMEOUT_SECS=0 +LOCK_TIMEOUT_USECS=5000 +LOCK_TIMEOUT_RETRIES=10 + +#####################################Cache Section######################## + +#Whether to enable caching of tables from target database +CACHE_TABLE=false + +#DSN Name to connect to the target database. +#This should be present in ~/odbc.ini file +DSN=myodbc3 + +ENABLE_BIDIRECTIONAL_CACHE=false + +CACHE_RECEIVER_WAIT_SECS=10 + +#Give full path for the file where all the cached table information is stored +TABLE_CONFIG_FILE=/tmp/csql/csqltable.conf + +#####################################End Section######################## diff --git a/test/sqlapi/Select/exp.test005.ksh b/test/sqlapi/Select/exp.test005.ksh new file mode 100644 index 00000000..63a5470f --- /dev/null +++ b/test/sqlapi/Select/exp.test005.ksh @@ -0,0 +1,97 @@ +Case 1: create table t1 ,test for SET AUTOCOMMIT OFF and some records +[Parser: syntax error] SET +[Parser: syntax error] commiter +[Parser: syntax error] rollbacked +[Parser: syntax error] show +[Parser: syntax error] SET +echo create table t1 (f1 int,f2 int); +Statement Executed +echo check for SET AUTOCOMMIT OFF; +Statement prepare failed with error -19 +echo insert some record; +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo rollback; +echo select * from t1; +--------------------------------------------------------- + f1 f2 +--------------------------------------------------------- + 10 20 + 20 30 + 30 40 + 40 50 + 50 60 + +AUTOCOMMIT Mode is set to OFF +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +echo test for commit; +Statement prepare failed with error -19 +--------------------------------------------------------- + f1 f2 +--------------------------------------------------------- + 10 20 + 20 30 + 30 40 + 40 50 + 50 60 + +echo test for rollback; +echo insert 5 records; +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement prepare failed with error -19 +--------------------------------------------------------- + f1 f2 +--------------------------------------------------------- + 10 20 + 20 30 + 30 40 + 40 50 + 50 60 + 20 40 + 20 40 + 20 40 + 20 40 + 20 40 + +echo check for show tables; +Statement prepare failed with error -19 +echo check for SET AUTOCOMMIT ON; +Statement prepare failed with error -19 +echo insert some records; +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +Statement Executed: Rows Affected = 1 +--------------------------------------------------------- + f1 f2 +--------------------------------------------------------- + 10 20 + 20 30 + 30 40 + 40 50 + 50 60 + 20 40 + 20 40 + 20 40 + 20 40 + 20 40 + +echo drop teble; +Statement Executed diff --git a/test/sqlapi/Select/test005.ksh b/test/sqlapi/Select/test005.ksh new file mode 100755 index 00000000..b109d523 --- /dev/null +++ b/test/sqlapi/Select/test005.ksh @@ -0,0 +1,28 @@ +#!/bin/sh +# Test Case +# check options -D chunk with empty database +#create table t1 (f1,f2) check with -D chunk +#drop t1 check with -D chunk + +CSQL_CONF=${PWD}/sqlapi/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/sqlapi/Select +fi +export CSQL_CONFIG_FILE=$REL_PATH/csql.conf + +$CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 & +pid=$! +sleep 5 +echo "Case 1: create table t1 ,test for SET AUTOCOMMIT OFF and some records " +$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/create.sql 2>&1 +if [ $? -ne 0 ] +then + exit 1; +fi + +kill -9 $pid +ipcrm -M 1199 -M 2277 +exit 0; + -- 2.11.4.GIT