lock manager and chunk allocation mutex modificationsw
[csql.git] / test / jdbc / Gateway / GwStmt8.java
blob73cccff3ff2b66c586d3e2fbd7bfd3415069c202
1 //Set Null insert statement without parameterise on cache tables t1 test it by wasNull()
2 import java.sql.*;
3 /**
5 * @author bijaya
6 */
7 public class GwStmt8
9 public static void main(String[] arg)
11 try
13 Class.forName("csql.jdbc.JdbcSqlDriver");
14 Connection con=DriverManager.getConnection("jdbc:gateway","root","manager");
15 Statement cStmt=con.createStatement();
16 PreparedStatement stmt=null,selStmt=null;
17 stmt=con.prepareStatement("INSERT INTO t1(f1,f5,f6,f7,f8,f9) VALUES(?,?,?,?,?,?);");
18 int ret=0;
19 for(int i=0;i<10;i++)
21 stmt.setInt(1,i);
22 // stmt.setByte(2,(byte)(i+2));
23 stmt.setFloat(2,(float)1000+i);
24 stmt.setString(3, String.valueOf("CSQL"+i));
25 stmt.setDate(4,Date.valueOf("2008-03-21"));
26 stmt.setTime(5,Time.valueOf("18:00:00"));
27 stmt.setTimestamp(6,Timestamp.valueOf("2008-03-21 18:00:00"));
28 ret=stmt.executeUpdate();
29 if(ret!=1) break;
31 con.commit();
32 stmt=con.prepareStatement("INSERT INTO t1(f1,f2,f4,f6,f7,f8,f9) values(10,11,101,'CSQL10','2008-03-21','18:00:00','2008-03-21 18:00:00');");
33 stmt.executeUpdate();
35 stmt.close();
36 con.commit();
38 selStmt=con.prepareStatement("Select * from t1");
39 ResultSet rs=null;
40 rs=selStmt.executeQuery();
41 while(rs.next())
44 System.out.print("Tuple value is " + rs.getInt(1)+ " ");
45 if(rs.wasNull()) System.out.print(" NULL");
46 System.out.print(rs.getShort(2) + " ");
47 if(rs.wasNull()) System.out.print(" NULL");
48 // System.out.print(rs.getByte(3) + " ");
49 // if(rs.wasNull()) System.out.print(" NULL");
50 System.out.print(rs.getLong(3) + " ");
51 if(rs.wasNull()) System.out.print(" NULL");
52 System.out.print(rs.getFloat(4) + " ");
53 if(rs.wasNull()) System.out.print(" NULL");
54 System.out.print(rs.getString(5) + " ");
55 if(rs.wasNull()) System.out.print(" NULL");
56 System.out.print(rs.getDate(6) + " ");
57 if(rs.wasNull()) System.out.print(" NULL");
58 System.out.print(rs.getTime(7) + " ");
59 if(rs.wasNull()) System.out.print(" NULL");
60 System.out.println(rs.getTimestamp(8) + " ");
61 if(rs.wasNull()) System.out.println(" NULL");
63 rs.close();
64 con.commit();
66 con.close();
67 }catch(Exception e) {
68 System.out.println("Exception in Test: "+e);
69 e.printStackTrace();