OmniSciDB  04ee39c94c
com.omnisci.jdbc.OmniSciPrepareTest Class Reference
+ Collaboration diagram for com.omnisci.jdbc.OmniSciPrepareTest:

Public Member Functions

void setUp () throws Exception
 
void tearDown () throws Exception
 
void prepare_test () throws Exception
 

Static Package Attributes

static Properties PROPERTIES = new Property_loader("prepare_test.properties")
 
static final String url = PROPERTIES.getProperty("default_db_connection_url")
 
static final String user = PROPERTIES.getProperty("default_super_user")
 
static final String password = PROPERTIES.getProperty("default_user_password")
 

Private Attributes

Connection m_conn = null
 

Detailed Description

Definition at line 13 of file OmniSciPrepareTest.java.

Member Function Documentation

◆ prepare_test()

void com.omnisci.jdbc.OmniSciPrepareTest.prepare_test ( ) throws Exception
inline

Definition at line 35 of file OmniSciPrepareTest.java.

References Experimental.String.

35  {
36  Statement statement = m_conn.createStatement();
37  {
38  statement.executeUpdate(PROPERTIES.getProperty("drop_base_t1"));
39  statement.executeUpdate(PROPERTIES.getProperty("create_base_t1"));
40  String prepare_insert_statement =
41  "insert into test_prepare_table1 (cc, bb, aa) values (?,?,?)";
42  PreparedStatement pr1 = m_conn.prepareStatement(prepare_insert_statement);
43  int aa_i = 100;
44  int bb_i = 1000;
45  int cc_i = 10000;
46  pr1.setInt(1, cc_i);
47  pr1.setInt(2, bb_i);
48  pr1.setInt(3, aa_i);
49  pr1.executeUpdate();
50  ResultSet rs = statement.executeQuery("select cc, bb, aa from test_prepare_table1");
51 
52  while (rs.next()) {
53  int returned_cc = rs.getInt("cc");
54  assertEquals(cc_i, returned_cc);
55  int returned_bb = rs.getInt("bb");
56  assertEquals(bb_i, returned_bb);
57  int returned_aa = rs.getInt("aa");
58  assertEquals(aa_i, returned_aa);
59  }
60  statement.executeUpdate(PROPERTIES.getProperty("drop_base_t1"));
61  }
62  {
63  statement.executeUpdate(PROPERTIES.getProperty("drop_base_t2"));
64  statement.executeUpdate(PROPERTIES.getProperty("create_base_t2"));
65  String prepare_insert_statement2 =
66  "insert into test_prepare_table2 (cc, bb, aa) values (?,?,?)";
67  PreparedStatement pr2 = m_conn.prepareStatement(prepare_insert_statement2);
68  String aa_s = "100";
69  String bb_s = "1000";
70  String cc_s = "10000";
71  pr2.setString(1, cc_s);
72  pr2.setString(2, bb_s);
73  pr2.setString(3, aa_s);
74  pr2.executeUpdate();
75  ResultSet rs2 =
76  statement.executeQuery("select cc, bb, aa from test_prepare_table2");
77 
78  while (rs2.next()) {
79  String returned_cc = rs2.getString("cc");
80  assertEquals(cc_s, returned_cc);
81  String returned_bb = rs2.getString("bb");
82  assertEquals(bb_s, returned_bb);
83  String returned_aa = rs2.getString("aa");
84  assertEquals(aa_s, returned_aa);
85  }
86  statement.executeUpdate(PROPERTIES.getProperty("drop_base_t2"));
87  }
88  }

◆ setUp()

void com.omnisci.jdbc.OmniSciPrepareTest.setUp ( ) throws Exception
inline

Definition at line 22 of file OmniSciPrepareTest.java.

22  {
23  Properties pt = new Properties();
24  pt.setProperty("user", user);
25  pt.setProperty("password", password);
26  m_conn = DriverManager.getConnection(url, pt);
27  }

◆ tearDown()

void com.omnisci.jdbc.OmniSciPrepareTest.tearDown ( ) throws Exception
inline

Definition at line 30 of file OmniSciPrepareTest.java.

30  {
31  m_conn.close();
32  }

Member Data Documentation

◆ m_conn

Connection com.omnisci.jdbc.OmniSciPrepareTest.m_conn = null
private

Definition at line 19 of file OmniSciPrepareTest.java.

◆ password

final String com.omnisci.jdbc.OmniSciPrepareTest.password = PROPERTIES.getProperty("default_user_password")
staticpackage

Definition at line 17 of file OmniSciPrepareTest.java.

◆ PROPERTIES

Properties com.omnisci.jdbc.OmniSciPrepareTest.PROPERTIES = new Property_loader("prepare_test.properties")
staticpackage

Definition at line 14 of file OmniSciPrepareTest.java.

◆ url

final String com.omnisci.jdbc.OmniSciPrepareTest.url = PROPERTIES.getProperty("default_db_connection_url")
staticpackage

Definition at line 15 of file OmniSciPrepareTest.java.

◆ user

final String com.omnisci.jdbc.OmniSciPrepareTest.user = PROPERTIES.getProperty("default_super_user")
staticpackage

Definition at line 16 of file OmniSciPrepareTest.java.


The documentation for this class was generated from the following file: