adding test scripts
[csql.git] / test / jdbc / Threads / treeIndexTest.java
blobfaf9657c888bad418f226299d0c824732313c672
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 treeIndexTest{
14 public static void main(String[] args) {
15 try
18 int noOfThreads=5;
19 int noOfRecords=1000;
20 Class.forName("csql.jdbc.JdbcSqlDriver");
21 Connection con = DriverManager.getConnection("jdbc:csql:", "root", "manager");
22 Statement cStmt = con.createStatement();
23 cStmt.execute("CREATE TABLE emp (f1 int, f2 char (20));");
24 cStmt.execute("create index ind on emp(f1) tree unique;");
25 connect[] conth= new connect[10];
26 System.out.println("Table Insert");
27 for(int i=0;i<noOfThreads;i++)
29 conth[i] = new connect(i,0,noOfRecords);
31 for(int i=0;i<noOfThreads;i++)
33 conth[i].th.join();
35 System.out.println("Table Select");
37 for(int i=0;i<noOfThreads;i++)
39 conth[i] = new connect(i,4,noOfRecords);
41 for(int i=0;i<noOfThreads;i++)
43 conth[i].th.join();
45 System.out.println("Table Update");
46 for(int i=0;i<noOfThreads;i++)
48 conth[i] = new connect(i,2,noOfRecords);
50 for(int i=0;i<noOfThreads;i++)
52 conth[i].th.join();
54 System.out.println("Table delete");
55 for(int i=0;i<noOfThreads;i++)
57 conth[i] = new connect(i,3,noOfRecords);
59 for(int i=0;i<noOfThreads;i++)
61 conth[i].th.join();
64 System.out.println("Drop Table ");
66 cStmt.execute("DROP TABLE emp ;");
67 con.close();
68 }catch(Exception e) {
69 System.out.println("Exception in Test: "+e);
70 e.printStackTrace();