@@ -61,16 +61,16 @@ public class YdbQueryPreparedStatementImplTest {
6161
6262 @ BeforeAll
6363 public static void initTable () throws SQLException {
64- try (Statement statement = jdbc .connection ().createStatement (); ) {
64+ try (PreparedStatement ps = jdbc .connection ().prepareStatement ( TEST_TABLE . createTableSQL ()) ) {
6565 // create test table
66- statement .execute (TEST_TABLE . createTableSQL () );
66+ ps .execute ();
6767 }
6868 }
6969
7070 @ AfterAll
7171 public static void dropTable () throws SQLException {
72- try (Statement statement = jdbc .connection ().createStatement (); ) {
73- statement .execute (TEST_TABLE . dropTableSQL () );
72+ try (PreparedStatement ps = jdbc .connection ().prepareStatement ( TEST_TABLE . dropTableSQL ()) ) {
73+ ps .execute ();
7474 }
7575 }
7676
@@ -80,8 +80,8 @@ public void afterEach() throws SQLException {
8080 return ;
8181 }
8282
83- try (Statement statement = jdbc .connection ().createStatement ( )) {
84- statement .execute (TEST_TABLE . deleteAllSQL () );
83+ try (PreparedStatement ps = jdbc .connection ().prepareStatement ( TEST_TABLE . deleteAllSQL () )) {
84+ ps .execute ();
8585 }
8686
8787 jdbc .connection ().close ();
@@ -94,11 +94,6 @@ private String upsertSql(String column, String type) {
9494 .replaceAll ("#tableName" , TEST_TABLE_NAME );
9595 }
9696
97- private YdbPreparedStatement prepareUpsert (YdbPrepareMode mode ,String column , String type )
98- throws SQLException {
99- return jdbc .connection ().unwrap (YdbConnection .class ).prepareStatement (upsertSql (column , type ), mode );
100- }
101-
10297 private PreparedStatement prepareSimpleSelect (String column ) throws SQLException {
10398 String sql = SIMPLE_SELECT_SQL
10499 .replaceAll ("#column" , column )
@@ -375,19 +370,6 @@ public void executeScanQueryAsUpdate() throws SQLException {
375370 }
376371 }
377372
378- @ Test
379- public void executeUnsupportedModes () throws SQLException {
380- ExceptionAssert .sqlException ("Query type in prepared statement not supported: SCHEME_QUERY" , () -> {
381- String sql = "DROP TABLE test_table;" ;
382- jdbc .connection ().prepareStatement (sql );
383- });
384-
385- ExceptionAssert .sqlException ("Query type in prepared statement not supported: EXPLAIN_QUERY" , () -> {
386- String sql = "EXPLAIN " + prepareSelectAll ();
387- jdbc .connection ().prepareStatement (sql );
388- });
389- }
390-
391373 @ ParameterizedTest (name = "with {0}" )
392374 @ EnumSource (value = SqlQueries .YqlQuery .class )
393375 public void executeExplainQueryExplicitly (SqlQueries .YqlQuery mode ) throws SQLException {
0 commit comments