From d39c5a681c1d003c1068c82b42037bfe2f815c7a Mon Sep 17 00:00:00 2001 From: bijaya Date: Tue, 23 Dec 2008 06:42:08 +0000 Subject: [PATCH] Test Script for Gateway Statement when csqlserver is not running --- test/jdbc/Gateway/GwTest10.java | 92 +++++++++++++++++++++++++++++++++++++++ test/jdbc/Gateway/GwTest11.java | 63 +++++++++++++++++++++++++++ test/jdbc/Gateway/GwTest12.java | 61 ++++++++++++++++++++++++++ test/jdbc/Gateway/GwTest13.java | 60 ++++++++++++++++++++++++++ test/jdbc/Gateway/GwTest14.java | 63 +++++++++++++++++++++++++++ test/jdbc/Gateway/GwTest15.java | 95 +++++++++++++++++++++++++++++++++++++++++ test/jdbc/Gateway/GwTest16.java | 92 +++++++++++++++++++++++++++++++++++++++ test/jdbc/Gateway/test050.ksh | 33 ++++++++++++++ test/jdbc/Gateway/test051.ksh | 31 ++++++++++++++ test/jdbc/Gateway/test052.ksh | 31 ++++++++++++++ test/jdbc/Gateway/test053.ksh | 34 +++++++++++++++ test/jdbc/Gateway/test054.ksh | 32 ++++++++++++++ test/jdbc/Gateway/test055.ksh | 31 ++++++++++++++ test/jdbc/Gateway/test056.ksh | 31 ++++++++++++++ 14 files changed, 749 insertions(+) create mode 100644 test/jdbc/Gateway/GwTest10.java create mode 100644 test/jdbc/Gateway/GwTest11.java create mode 100644 test/jdbc/Gateway/GwTest12.java create mode 100644 test/jdbc/Gateway/GwTest13.java create mode 100644 test/jdbc/Gateway/GwTest14.java create mode 100644 test/jdbc/Gateway/GwTest15.java create mode 100644 test/jdbc/Gateway/GwTest16.java create mode 100755 test/jdbc/Gateway/test050.ksh create mode 100755 test/jdbc/Gateway/test051.ksh create mode 100755 test/jdbc/Gateway/test052.ksh create mode 100755 test/jdbc/Gateway/test053.ksh create mode 100755 test/jdbc/Gateway/test054.ksh create mode 100755 test/jdbc/Gateway/test055.ksh create mode 100755 test/jdbc/Gateway/test056.ksh diff --git a/test/jdbc/Gateway/GwTest10.java b/test/jdbc/Gateway/GwTest10.java new file mode 100644 index 00000000..70e69164 --- /dev/null +++ b/test/jdbc/Gateway/GwTest10.java @@ -0,0 +1,92 @@ + +//1. Donot run csqlserver +//Then do (INSERT/UPDATE/DELETE/SELECT) with params statement using gateway statement + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.Statement; + + +/** + * + * @author bijaya + */ +public class GwTest10 { + public static void main(String[] args) + { + try + { + Class.forName("csql.jdbc.JdbcSqlDriver"); + Connection con = DriverManager.getConnection("jdbc:gateway", "root", "manager"); + Statement cStmt = con.createStatement(); + PreparedStatement stmt = null, selStmt= null; + stmt = con.prepareStatement("INSERT INTO T1 VALUES (?, ?);"); + for (int i =0 ; i< 10 ; i++) { + stmt.setInt(1, i); + stmt.setString(2, String.valueOf(i+100)); + stmt.executeUpdate(); + } + stmt.close(); + con.commit(); + selStmt = con.prepareStatement("SELECT * from T1 where f1 = ?;"); + ResultSet rs = null; + for (int i =0 ; i< 10 ; i++) { + selStmt.setInt(1, i); + rs = selStmt.executeQuery(); + while (rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1)+ " "+ rs.getString(2)); + } + rs.close(); + } + int ret=0; + stmt = con.prepareStatement("UPDATE T1 SET f2 = ? WHERE f1 = ?;"); + for (int i =0 ; i< 10 ; i +=2) { + stmt.setString(1, String.valueOf(i+200)); + stmt.setInt(2, i); + ret = stmt.executeUpdate(); + if (ret != 1) break; + } + stmt.close(); + con.commit(); + System.out.println("After update, listing tuples:"); + for (int i =0 ; i< 10 ; i++) { + selStmt.setInt(1, i); + rs = selStmt.executeQuery(); + while (rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1)+ " "+ rs.getString(2)); + } + rs.close(); + } + con.commit(); + stmt = con.prepareStatement("DELETE FROM T1 WHERE f1 = ?;"); + for (int i =0 ; i< 10 ; i +=3) { + stmt.setInt(1, i); + ret = stmt.executeUpdate(); + if (ret !=1) break; + } + stmt.close(); + con.commit(); + + System.out.println("After delete, listing tuples:"); + for (int i =0 ; i< 10 ; i++) { + selStmt.setInt(1, i); + rs = selStmt.executeQuery(); + while (rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1)+ " "+ rs.getString(2)); + } + rs.close(); + } + con.commit(); + con.close(); + }catch(Exception e) { + System.out.println("Exception in Test: "+e); + e.printStackTrace(); + } + } + +} diff --git a/test/jdbc/Gateway/GwTest11.java b/test/jdbc/Gateway/GwTest11.java new file mode 100644 index 00000000..4d2e1890 --- /dev/null +++ b/test/jdbc/Gateway/GwTest11.java @@ -0,0 +1,63 @@ + +//donot run csql server +//Create a table and index for that table. Then do (INSERT/UPDATE/DELETE/SELECT) with no params statement. +import java.sql.*; +/** + * + * @author bijaya + */ +public class GwTest11 { + public static void main(String[] args) + { + try + { + Class.forName("csql.jdbc.JdbcSqlDriver"); + Connection con = DriverManager.getConnection("jdbc:gateway", "root", "manager"); + Statement cStmt = con.createStatement(); + con.commit(); + + cStmt.execute("INSERT INTO T1 VALUES (1, 'FIRST');"); + cStmt.executeUpdate("INSERT INTO T1 VALUES (2, 'SECOND');"); + con.commit(); + + ResultSet rs = null; + rs = cStmt.executeQuery("SELECT * from T1 where f1 = 1;"); + while (rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1)+ " "+ rs.getString(2)); + } + rs.close(); + + + cStmt.execute("SELECT * from T1 where f1 = 2;"); + rs = cStmt.getResultSet(); + while (rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1)+ " "+ rs.getString(2)); + } + rs.close(); + con.commit(); + + cStmt.executeUpdate("UPDATE T1 SET f2 = 'CHANGED' WHERE f1 = 1;"); + con.commit(); + + + + cStmt.executeUpdate("DELETE FROM T1 WHERE f1 = 2;"); + con.commit(); + + System.out.println("After delete, listing tuples:"); + rs = cStmt.executeQuery("SELECT * from T1 ;"); + while (rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1)+ " "+ rs.getString(2)); + } + rs.close(); + con.close(); + }catch(Exception e) { + System.out.println("Exception in Test: "+e); + e.printStackTrace(); + } + } + +} diff --git a/test/jdbc/Gateway/GwTest12.java b/test/jdbc/Gateway/GwTest12.java new file mode 100644 index 00000000..d17a796f --- /dev/null +++ b/test/jdbc/Gateway/GwTest12.java @@ -0,0 +1,61 @@ +//donot run csql server +//Open a connection and then close it. After that execute INSERT/QUERY/UPDATE statement. It should fail + +import java.sql.*; +/** + * + * @author bijaya + */ +public class GwTest12 { +public static void main(String[] args) + { + try + { + Class.forName("csql.jdbc.JdbcSqlDriver"); + Connection con = DriverManager.getConnection("jdbc:gateway", "root", "manager"); + Statement cStmt = con.createStatement(); + con.commit(); + con.close(); + + //after close the connection,execute "INSERT" statement,it should fail + try + { + cStmt.execute("INSERT INTO T1 VALUES (1, 'FIRST');"); + System.exit(1); + } + catch(Exception e) + { + System.out.println("insert exception---" + e.getMessage()); + } + + //after close the connection,execute "QUERY" statement,it should fail + try + { + cStmt.executeQuery("SELECT * from T1 where f1 = 1;"); + System.exit(2); + } + catch(Exception e) + { + System.out.println("query exception---" + e.getMessage()); + } + + //after close the connection,execute "UPDATE" statement,it should fail + try + { + cStmt.executeUpdate("UPDATE T1 SET f2 = 'CHANGED' WHERE f1 = 1;"); + System.exit(3); + } + catch(Exception e) + { + System.out.println("update exception---" + e.getMessage()); + } + + //cleanup + + }catch(Exception e) { + System.out.println("Exception in Test: " + e.getMessage()); + e.printStackTrace(); + System.exit(4); + } + } +} diff --git a/test/jdbc/Gateway/GwTest13.java b/test/jdbc/Gateway/GwTest13.java new file mode 100644 index 00000000..31e0e0ee --- /dev/null +++ b/test/jdbc/Gateway/GwTest13.java @@ -0,0 +1,60 @@ +//donot run csql server +//CREATE TABLE T1 (f1 integer, f2 smallint, f3 tinyint,f4 bigint, f5 float, f6 char(10), f7 date, f8 time, f9 timestamp); +//insert 9 tuples with params for all fields (INSERT INTO T1 values (?,?,?,?,?,?,?,?,?)) +//select tuple with WHERE clause having param for each fields(SELECT * FROM T1 WHERE f1=?, SELECT * from T1 where f2=?) +import java.sql.*; +/** + * + * @author bijaya + */ +public class GwTest13 { + public static void main(String[] args) + { + try + { + Class.forName("csql.jdbc.JdbcSqlDriver"); + Connection con = DriverManager.getConnection("jdbc:gateway", "root", "manager"); + Statement cStmt = con.createStatement(); + PreparedStatement stmt = null, selStmt= null; + stmt = con.prepareStatement("INSERT INTO T1 VALUES (?,?,?,?,?,?,?,?,?);"); + stmt.setInt(1, 1); + stmt.setShort(2,(short)2); + stmt.setByte(3,(byte)3); + stmt.setLong(4,(long)4); + stmt.setFloat(5,(float)5); + stmt.setString(6, String.valueOf(5)); + stmt.setDate(7,Date.valueOf("2008-03-21")); + stmt.setTime(8,Time.valueOf("18:00:00")); + stmt.setTimestamp(9,Timestamp.valueOf("2008-03-21 18:00:00")); + stmt.executeUpdate(); + stmt.close(); + con.commit(); + + selStmt = con.prepareStatement("SELECT * from T1 where f1 = ?;"); + ResultSet rs = null; + + selStmt.setInt(1, 1); + rs = selStmt.executeQuery(); + while (rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1) + " "+ + rs.getShort(2) + " "+ + rs.getByte(3) + " "+ + rs.getLong(4) + " "+ + rs.getFloat(5) + " "+ + rs.getString(6) + " "+ + rs.getDate(7) + " "+ + rs.getTime(8) + " "+ + rs.getTimestamp(9) + " " + ); + } + rs.close(); + selStmt.close(); + con.close(); + }catch(Exception e) { + System.out.println("Exception in Test: "+e); + e.printStackTrace(); + } + } + +} diff --git a/test/jdbc/Gateway/GwTest14.java b/test/jdbc/Gateway/GwTest14.java new file mode 100644 index 00000000..dedbebf0 --- /dev/null +++ b/test/jdbc/Gateway/GwTest14.java @@ -0,0 +1,63 @@ +//donot run csql server +//select tuple with WHERE clause having param for some fields(SELECT * FROM T1 WHERE f1=?AND f2=? AND f3=?) +import java.sql.*; +/** + * + * @author bijaya + */ +public class GwTest14 { + public static void main(String[] arg) + { + try + { + Class.forName("csql.jdbc.JdbcSqlDriver"); + Connection con=DriverManager.getConnection("jdbc:gateway","root","manager"); + Statement cStmt=con.createStatement(); + PreparedStatement stmt=null,selStmt=null; + stmt=con.prepareStatement("INSERT INTO T1 VALUES(?,?,?,?,?,?,?,?,?);"); + int ret=0; + for(int i=0;i<10;i++) + { + stmt.setInt(1,i); + stmt.setShort(2,(short)(i+1)); + stmt.setByte(3,(byte)(i+2)); + stmt.setLong(4,(long)i); + stmt.setFloat(5,(float)1000+i); + stmt.setString(6, String.valueOf("Nihar"+i)); + stmt.setDate(7,Date.valueOf("2008-03-21")); + stmt.setTime(8,Time.valueOf("18:00:00")); + stmt.setTimestamp(9,Timestamp.valueOf("2008-03-21 18:00:00")); + ret=stmt.executeUpdate(); + if(ret!=1) break; + } + stmt.close(); + con.commit(); + selStmt=con.prepareStatement("SELECT * FROM T1 where f1 = ? "); + ResultSet rs=null; + selStmt.setInt(1,2); + //selStmt.setShort(2,(short)3); + //selStmt.setByte(1,(byte)4); + rs=selStmt.executeQuery(); + while(rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1) + " "+ + rs.getShort(2) + " "+ + rs.getByte(3) + " "+ + rs.getLong(4) + " "+ + rs.getFloat(5) + " "+ + rs.getString(6) + " "+ + rs.getDate(7) + " "+ + rs.getTime(8) + " "+ + rs.getTimestamp(9) + " " + ); + } + rs.close(); + con.commit(); + con.close(); + }catch(Exception e) { + System.out.println("Exception in Test: "+e); + e.printStackTrace(); + } + } + +} diff --git a/test/jdbc/Gateway/GwTest15.java b/test/jdbc/Gateway/GwTest15.java new file mode 100644 index 00000000..15caf6c1 --- /dev/null +++ b/test/jdbc/Gateway/GwTest15.java @@ -0,0 +1,95 @@ +//donot run csql server +//update tuple with WHERE clause having param for all fields(UPDATE T1 SET f2=100 WHERE f1=?AND f3=?....) +import java.sql.*; +/** + * + * @author bijaya + */ +public class GwTest15 { + public static void main(String[] arg) + { + try + { + Class.forName("csql.jdbc.JdbcSqlDriver"); + Connection con=DriverManager.getConnection("jdbc:gateway","root","manager"); + Statement cStmt=con.createStatement(); + PreparedStatement stmt=null,selStmt=null; + stmt=con.prepareStatement("INSERT INTO T1 VALUES(?,?,?,?,?,?,?,?,?);"); + int ret=0; + for(int i=0;i<10;i++) + { + stmt.setInt(1,i); + stmt.setShort(2,(short)(i+1)); + stmt.setByte(3,(byte)(i+2)); + stmt.setLong(4,(long)i); + stmt.setFloat(5,(float)1000+i); + stmt.setString(6, String.valueOf("Cache"+i)); + stmt.setDate(7,Date.valueOf("2008-03-21")); + stmt.setTime(8,Time.valueOf("18:00:00")); + stmt.setTimestamp(9,Timestamp.valueOf("2008-03-21 18:00:00")); + ret=stmt.executeUpdate(); + if(ret!=1) break; + } + stmt.close(); + con.commit(); + selStmt=con.prepareStatement("Select * from T1"); + ResultSet rs=null; + rs=selStmt.executeQuery(); + while(rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1) + " "+ + rs.getShort(2) + " "+ + rs.getByte(3) + " "+ + rs.getLong(4) + " "+ + rs.getFloat(5) + " "+ + rs.getString(6) + " "+ + rs.getDate(7) + " "+ + rs.getTime(8) + " "+ + rs.getTimestamp(9) + " " + ); + + } + rs.close(); + con.commit(); + ret=0; + stmt=con.prepareStatement("UPDATE T1 SET f2=?, f8=? WHERE f1=?AND f9=?;"); + for(int i=0;i<10;i++) + { + stmt.setShort(1,(short)100); + stmt.setTime(2,Time.valueOf("19:38:25")); + stmt.setInt(3,3); + stmt.setTimestamp(4,Timestamp.valueOf("2008-03-21 18:00:00")); + ret=stmt.executeUpdate(); + if(ret!=1) break; + } + stmt.close(); + con.commit(); + selStmt=con.prepareStatement("Select * from T1"); + rs=null; + rs=selStmt.executeQuery(); + System.out.println(); + while(rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1) + " "+ + rs.getShort(2) + " "+ + rs.getByte(3) + " "+ + rs.getLong(4) + " "+ + rs.getFloat(5) + " "+ + rs.getString(6) + " "+ + rs.getDate(7) + " "+ + rs.getTime(8) + " "+ + rs.getTimestamp(9) + " " + ); + + } + rs.close(); + con.commit(); + con.close(); + }catch(Exception e) { + System.out.println("Exception in Test: "+e); + e.printStackTrace(); + } + } + + +} diff --git a/test/jdbc/Gateway/GwTest16.java b/test/jdbc/Gateway/GwTest16.java new file mode 100644 index 00000000..5af38f40 --- /dev/null +++ b/test/jdbc/Gateway/GwTest16.java @@ -0,0 +1,92 @@ +//donot run csql server +//delete tuple with WHERE clause having params (DELETE FROM T1 WHERE f1=?AND f9=?) using gateway +import java.sql.*; +/** + * + * @author bijaya + */ +public class GwTest16 { +public static void main(String[] arg) + { + try + { + Class.forName("csql.jdbc.JdbcSqlDriver"); + Connection con=DriverManager.getConnection("jdbc:gateway","root","manager"); + Statement cStmt=con.createStatement(); + PreparedStatement stmt=null,selStmt=null; + stmt=con.prepareStatement("INSERT INTO T1 VALUES(?,?,?,?,?,?,?,?,?);"); + int ret=0; + for(int i=0;i<10;i++) + { + stmt.setInt(1,i); + stmt.setShort(2,(short)(i+1)); + stmt.setByte(3,(byte)(i+2)); + stmt.setLong(4,(long)i); + stmt.setFloat(5,(float)1000+i); + stmt.setString(6, String.valueOf("Cache"+i)); + stmt.setDate(7,Date.valueOf("2008-03-21")); + stmt.setTime(8,Time.valueOf("18:00:00")); + stmt.setTimestamp(9,Timestamp.valueOf("2008-03-21 18:00:00")); + ret=stmt.executeUpdate(); + if(ret!=1) break; + } + stmt.close(); + con.commit(); + selStmt=con.prepareStatement("Select * from T1"); + ResultSet rs=null; + rs=selStmt.executeQuery(); + while(rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1) + " "+ + rs.getShort(2) + " "+ + rs.getByte(3) + " "+ + rs.getLong(4) + " "+ + rs.getFloat(5) + " "+ + rs.getString(6) + " "+ + rs.getDate(7) + " "+ + rs.getTime(8) + " "+ + rs.getTimestamp(9) + " " + ); + + } + rs.close(); + con.commit(); + ret=0; + stmt=con.prepareStatement("DELETE FROM T1 WHERE f1=? AND f9=?;"); + for(int i=0;i<10;i++) + { + stmt.setInt(1,3); + stmt.setTimestamp(2,Timestamp.valueOf("2008-03-21 18:00:00")); + ret=stmt.executeUpdate(); + if(ret!=1) break; + } + stmt.close(); + con.commit(); + selStmt=con.prepareStatement("Select * from T1"); + rs=null; + rs=selStmt.executeQuery(); + System.out.println(); + while(rs.next()) + { + System.out.println("Tuple value is " + rs.getInt(1) + " "+ + rs.getShort(2) + " "+ + rs.getByte(3) + " "+ + rs.getLong(4) + " "+ + rs.getFloat(5) + " "+ + rs.getString(6) + " "+ + rs.getDate(7) + " "+ + rs.getTime(8) + " "+ + rs.getTimestamp(9) + " " + ); + + } + rs.close(); + con.commit(); + con.close(); + }catch(Exception e) { + System.out.println("Exception in Test: "+e); + e.printStackTrace(); + } + } + +} diff --git a/test/jdbc/Gateway/test050.ksh b/test/jdbc/Gateway/test050.ksh new file mode 100755 index 00000000..74b12abd --- /dev/null +++ b/test/jdbc/Gateway/test050.ksh @@ -0,0 +1,33 @@ +#!/bin/sh +# Connect with connectstring "jdbc:gateway" +# Then do (INSERT/UPDATE/DELETE/SELECT) with params statement using gateway statement +# It should pass.when csqlserver is not runnig +# GwTest10.java + +TESTFILE=${PWD}/jdbc/Gateway/ConnTest01.java +REL_PATH=. +if [ -s "$TESTFILE" ] +then + REL_PATH=`pwd`/jdbc/Gateway +fi +export CLASSPATH=$CLASSPATH:${REL_PATH} +export CSQL_CONFIG_FILE=$REL_PATH/csql.conf +echo "create table T1 (f1 int,f2 char(10),primary key(f1));" >${REL_PATH}/t1create.sql +isql $DSN < ${REL_PATH}/t1create.sql >/dev/null 2>&1 +if [ $? -ne 0 ] +then + rm -f ${REL_PATH}/t1create.sql + exit 1; +fi +java GwTest10 +if [ $? -ne 0 ] +then + exit 2; +fi + +echo "drop table T1;">${REL_PATH}/dp.sql +isql $DSN < ${REL_PATH}/dp.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dp.sql +rm -f ${REL_PATH}/t1create.sql + +exit 0; diff --git a/test/jdbc/Gateway/test051.ksh b/test/jdbc/Gateway/test051.ksh new file mode 100755 index 00000000..8befcb8a --- /dev/null +++ b/test/jdbc/Gateway/test051.ksh @@ -0,0 +1,31 @@ +#!/bin/sh +# Connect with connectstring "jdbc:gateway" +# Create a table and index for that table. Then do (INSERT/UPDATE/DELETE/SELECT) with no params statement. when csqlserver is not runnig +# GwTest11.java +TESTFILE=${PWD}/jdbc/Gateway/ConnTest01.java +REL_PATH=. +if [ -s "$TESTFILE" ] +then + REL_PATH=`pwd`/jdbc/Gateway +fi +export CLASSPATH=$CLASSPATH:${REL_PATH} +export CSQL_CONFIG_FILE=$REL_PATH/csql.conf +echo "create table T1 (f1 int,f2 char(10),primary key(f1));" >${REL_PATH}/t1create.sql +isql $DSN < ${REL_PATH}/t1create.sql >/dev/null 2>&1 +if [ $? -ne 0 ] +then + rm -f ${REL_PATH}/t1create.sql + exit 1; +fi +java GwTest11 +if [ $? -ne 0 ] +then + exit 2; +fi + +echo "drop table T1;">${REL_PATH}/dp.sql +isql $DSN < ${REL_PATH}/dp.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dp.sql +rm -f ${REL_PATH}/t1create.sql + +exit 0; diff --git a/test/jdbc/Gateway/test052.ksh b/test/jdbc/Gateway/test052.ksh new file mode 100755 index 00000000..02915d5f --- /dev/null +++ b/test/jdbc/Gateway/test052.ksh @@ -0,0 +1,31 @@ +#!/bin/sh +# Connect with connectstring "jdbc:gateway" +# Open a connection and then close it. After that execute INSERT/QUERY/UPDATE statement. It should fail,when csqlserver is not runnig +# GwTest12.java +TESTFILE=${PWD}/jdbc/Gateway/ConnTest01.java +REL_PATH=. +if [ -s "$TESTFILE" ] +then + REL_PATH=`pwd`/jdbc/Gateway +fi +export CLASSPATH=$CLASSPATH:${REL_PATH} +export CSQL_CONFIG_FILE=$REL_PATH/csql.conf +echo "create table T1 (f1 int,f2 char(10),primary key(f1));" >${REL_PATH}/t1create.sql +isql $DSN < ${REL_PATH}/t1create.sql >/dev/null 2>&1 +if [ $? -ne 0 ] +then + rm -f ${REL_PATH}/t1create.sql + exit 1; +fi +java GwTest12 +if [ $? -ne 0 ] +then + exit 2; +fi + +echo "drop table T1;">${REL_PATH}/dp.sql +isql $DSN < ${REL_PATH}/dp.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dp.sql +rm -f ${REL_PATH}/t1create.sql + +exit 0; diff --git a/test/jdbc/Gateway/test053.ksh b/test/jdbc/Gateway/test053.ksh new file mode 100755 index 00000000..2b4937dc --- /dev/null +++ b/test/jdbc/Gateway/test053.ksh @@ -0,0 +1,34 @@ +#!/bin/sh +# Connect with connectstring "jdbc:gateway" +# CREATE TABLE T1 (f1 integer, f2 smallint, f3 tinyint,f4 bigint, f5 float, f6 char(10), f7 date, f8 time, f9 timestamp); +# insert 9 tuples with params for all fields (INSERT INTO T1 values (?,?,?,?,?,?,?,?,?)) +# select tuple with WHERE clause having param for each fields(SELECT * FROM T1 WHERE f1=?, SELECT * from T1 where f2=?) +# GwTest13.java + +TESTFILE=${PWD}/jdbc/Gateway/ConnTest01.java +REL_PATH=. +if [ -s "$TESTFILE" ] +then + REL_PATH=`pwd`/jdbc/Gateway +fi +export CLASSPATH=$CLASSPATH:${REL_PATH} +export CSQL_CONFIG_FILE=$REL_PATH/csql.conf +echo "CREATE TABLE T1 (f1 integer, f2 smallint, f3 tinyint, f4 bigint, f5 float, f6 char(10), f7 date, f8 time, f9 timestamp);" >${REL_PATH}/t1create.sql +isql $DSN < ${REL_PATH}/t1create.sql >/dev/null 2>&1 +if [ $? -ne 0 ] +then + rm -f ${REL_PATH}/t1create.sql + exit 1; +fi +java GwTest13 +if [ $? -ne 0 ] +then + exit 2; +fi + +echo "drop table T1;">${REL_PATH}/dp.sql +isql $DSN < ${REL_PATH}/dp.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dp.sql +rm -f ${REL_PATH}/t1create.sql + +exit 0; diff --git a/test/jdbc/Gateway/test054.ksh b/test/jdbc/Gateway/test054.ksh new file mode 100755 index 00000000..d6183721 --- /dev/null +++ b/test/jdbc/Gateway/test054.ksh @@ -0,0 +1,32 @@ +#!/bin/sh +# Connect with connectstring "jdbc:gateway" +# select tuple with WHERE clause having param for some fields(SELECT * FROM T1 WHERE f1=?AND f2=? AND f3=?) +# when csqlserver is not runnig +# GwTest14.java +TESTFILE=${PWD}/jdbc/Gateway/ConnTest01.java +REL_PATH=. +if [ -s "$TESTFILE" ] +then + REL_PATH=`pwd`/jdbc/Gateway +fi +export CLASSPATH=$CLASSPATH:${REL_PATH} +export CSQL_CONFIG_FILE=$REL_PATH/csql.conf +echo "CREATE TABLE T1 (f1 integer, f2 smallint, f3 tinyint, f4 bigint, f5 float, f6 char(10), f7 date, f8 time, f9 timestamp);" >${REL_PATH}/t1create.sql +isql $DSN < ${REL_PATH}/t1create.sql >/dev/null 2>&1 +if [ $? -ne 0 ] +then + rm -f ${REL_PATH}/t1create.sql + exit 1; +fi +java GwTest14 +if [ $? -ne 0 ] +then + exit 2; +fi + +echo "drop table T1;">${REL_PATH}/dp.sql +isql $DSN < ${REL_PATH}/dp.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dp.sql +rm -f ${REL_PATH}/t1create.sql + +exit 0; diff --git a/test/jdbc/Gateway/test055.ksh b/test/jdbc/Gateway/test055.ksh new file mode 100755 index 00000000..4d95bba8 --- /dev/null +++ b/test/jdbc/Gateway/test055.ksh @@ -0,0 +1,31 @@ +#!/bin/sh +# Connect with connectstring "jdbc:gateway" +# Then do (INSERT/UPDATE/DELETE/SELECT) with params statement using gateway statement, when csqlserver is not running +# GwTest15.java +TESTFILE=${PWD}/jdbc/Gateway/ConnTest01.java +REL_PATH=. +if [ -s "$TESTFILE" ] +then + REL_PATH=`pwd`/jdbc/Gateway +fi +export CLASSPATH=$CLASSPATH:${REL_PATH} +export CSQL_CONFIG_FILE=$REL_PATH/csql.conf +echo "CREATE TABLE T1 (f1 integer, f2 smallint, f3 tinyint, f4 bigint, f5 float, f6 char(10), f7 date, f8 time, f9 timestamp);" >${REL_PATH}/t1create.sql +isql $DSN < ${REL_PATH}/t1create.sql >/dev/null 2>&1 +if [ $? -ne 0 ] +then + rm -f ${REL_PATH}/t1create.sql + exit 1; +fi +java GwTest15 +if [ $? -ne 0 ] +then + exit 2; +fi + +echo "drop table T1;">${REL_PATH}/dp.sql +isql $DSN < ${REL_PATH}/dp.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dp.sql +rm -f ${REL_PATH}/t1create.sql + +exit 0; diff --git a/test/jdbc/Gateway/test056.ksh b/test/jdbc/Gateway/test056.ksh new file mode 100755 index 00000000..b4f86b84 --- /dev/null +++ b/test/jdbc/Gateway/test056.ksh @@ -0,0 +1,31 @@ +#!/bin/sh +# Connect with connectstring "jdbc:gateway" +# delete tuple with WHERE clause having params (DELETE FROM T1 WHERE f1=?AND f9=?) using gateway,when csqlserver is not runnig + +# GwTest16.java +TESTFILE=${PWD}/jdbc/Gateway/ConnTest01.java +REL_PATH=. +if [ -s "$TESTFILE" ] +then + REL_PATH=`pwd`/jdbc/Gateway +fi +export CLASSPATH=$CLASSPATH:${REL_PATH} +export CSQL_CONFIG_FILE=$REL_PATH/csql.conf +echo "CREATE TABLE T1 (f1 integer, f2 smallint, f3 tinyint, f4 bigint, f5 float, f6 char(10), f7 date, f8 time, f9 timestamp);" >${REL_PATH}/t1create.sql +isql $DSN < ${REL_PATH}/t1create.sql >/dev/null 2>&1 +if [ $? -ne 0 ] +then + rm -f ${REL_PATH}/t1create.sql + exit 1; +fi +java GwTest16 +if [ $? -ne 0 ] +then + exit 2; +fi + +echo "drop table T1;">${REL_PATH}/dp.sql +isql $DSN < ${REL_PATH}/dp.sql >/dev/null 2>&1 +rm -f ${REL_PATH}/dp.sql +rm -f ${REL_PATH}/t1create.sql +exit 0; -- 2.11.4.GIT