7 public class hashIndexTest
{
9 public static void main(String
[] args
) {
13 int noOfRecords
=10000;
14 //Class.forName("csql.jdbc.JdbcSqlDriver");
15 //Connection con = DriverManager.getConnection("jdbc:csql:", "root", "manager");
16 Connection con
= connect
.getDBConn();
17 Statement cStmt
= con
.createStatement();
18 cStmt
.execute("CREATE TABLE emp (f1 int, f2 char (20));");
19 cStmt
.execute("create index ind on emp(f1) hash unique;");
20 connect
[] conth
= new connect
[noOfThreads
];
21 for(int i
=0;i
<noOfThreads
;i
++)
23 conth
[i
] = new connect(i
,0,noOfRecords
);
25 for(int i
=0;i
<noOfThreads
;i
++)
29 long totalTimeTaken
=0;
30 for(int i
=0;i
<noOfThreads
;i
++)
32 totalTimeTaken
= totalTimeTaken
+ conth
[i
].timeTaken
;
34 System
.out
.println("Table Insert " + totalTimeTaken
);
36 for(int i
=0;i
<noOfThreads
;i
++)
38 conth
[i
] = new connect(i
,1,noOfRecords
);
40 for(int i
=0;i
<noOfThreads
;i
++)
45 for(int i
=0;i
<noOfThreads
;i
++)
47 totalTimeTaken
= totalTimeTaken
+ conth
[i
].timeTaken
;
49 System
.out
.println("Table Select " + totalTimeTaken
);
50 /*System.out.println("Table Update");
51 for(int i=0;i<noOfThreads;i++)
53 conth[i] = new connect(i,2,noOfRecords);
55 for(int i=0;i<noOfThreads;i++)
59 System.out.println("Table delete");
60 for(int i=0;i<noOfThreads;i++)
62 conth[i] = new connect(i,3,noOfRecords);
64 for(int i=0;i<noOfThreads;i++)
68 System.out.println("Drop Table ");
71 cStmt
.execute("DROP TABLE emp ;");
74 System
.out
.println("Exception in Test: "+e
);