adding test scripts
[csql.git] / test / jdbc / Threads / hashIndexTest.java
blobe63511d01bf2a05a255c8e7654e187e43b763f21
1 /*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
6 import java.sql.*;
7 /**
9 * @author bijaya
12 public class hashIndexTest{
14 public static void main(String[] args) {
15 try
19 int noOfThreads=5;
20 int noOfRecords=1000;
21 Class.forName("csql.jdbc.JdbcSqlDriver");
22 Connection con = DriverManager.getConnection("jdbc:csql:", "root", "manager");
23 Statement cStmt = con.createStatement();
24 cStmt.execute("CREATE TABLE emp (f1 int, f2 char (20));");
25 cStmt.execute("create index ind on emp(f1) hash unique;");
26 connect[] conth= new connect[10];
27 System.out.println("Table Insert");
28 for(int i=0;i<noOfThreads;i++)
30 conth[i] = new connect(i,0,noOfRecords);
32 for(int i=0;i<noOfThreads;i++)
34 conth[i].th.join();
36 System.out.println("Table Select");
38 for(int i=0;i<noOfThreads;i++)
40 conth[i] = new connect(i,1,noOfRecords);
42 for(int i=0;i<noOfThreads;i++)
44 conth[i].th.join();
46 System.out.println("Table Update");
47 for(int i=0;i<noOfThreads;i++)
49 conth[i] = new connect(i,2,noOfRecords);
51 for(int i=0;i<noOfThreads;i++)
53 conth[i].th.join();
55 System.out.println("Table delete");
56 for(int i=0;i<noOfThreads;i++)
58 conth[i] = new connect(i,3,noOfRecords);
60 for(int i=0;i<noOfThreads;i++)
62 conth[i].th.join();
65 System.out.println("Drop Table ");
67 cStmt.execute("DROP TABLE emp ;");
68 con.close();
69 }catch(Exception e) {
70 System.out.println("Exception in Test: "+e);
71 e.printStackTrace();