91 Statement statement = m_conn.createStatement();
92 statement.executeUpdate(PROPERTIES.getProperty(
"drop_base_t3"));
93 statement.executeUpdate(PROPERTIES.getProperty(
"create_base_t3"));
94 statement.executeQuery(
"insert into test_prepare_table3 values(1, 1.1, 'one')");
95 ResultSetMetaData md = null;
97 PreparedStatement pr_select_no_params =
98 m_conn.prepareStatement(
"select aa, bb, cc from test_prepare_table3");
99 md = pr_select_no_params.getMetaData();
101 assertEquals(md.getColumnCount(), 3);
102 assertEquals(md.getColumnName(1),
"aa");
103 assertEquals(md.getColumnType(1), Types.INTEGER);
104 assertEquals(md.getColumnType(2), Types.DOUBLE);
106 PreparedStatement pr_select_with_params = m_conn.prepareStatement(
107 "select bb, aa from test_prepare_table3 where cc <> ? and aa > ?");
108 md = pr_select_with_params.getMetaData();
110 assertEquals(md.getColumnCount(), 2);
111 assertEquals(md.getColumnName(1),
"bb");
112 assertEquals(md.getColumnType(1), Types.DOUBLE);
113 assertEquals(md.getColumnType(2), Types.INTEGER);
128 String sql_statement =
129 " \n \n select bb, aa from test_prepare_table3 where cc <> ? and aa > ?";
130 PreparedStatement pr_select_with_params_and_comments =
131 m_conn.prepareStatement(sql_statement);
132 md = pr_select_with_params_and_comments.getMetaData();
134 assertEquals(md.getColumnCount(), 2);
136 PreparedStatement pr_insert = m_conn.prepareStatement(
137 "insert into test_prepare_table3(aa, bb, cc) values (?, ?, ?)");
138 md = pr_insert.getMetaData();
141 PreparedStatement pr_insert_from_select = m_conn.prepareStatement(
142 "insert into test_prepare_table3(aa, bb, cc) select aa, bb, cc from test_prepare_table3 where cc <> ?");
143 md = pr_insert_from_select.getMetaData();
146 statement.executeUpdate(PROPERTIES.getProperty(
"drop_base_t3"));