Skip to content

Commit

Permalink
fix: insert-select error
Browse files Browse the repository at this point in the history
  • Loading branch information
hantmac committed May 14, 2024
1 parent 9ee8dc7 commit c411bf7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ protected boolean execute(List<StatementInfoWrapper> statements) throws SQLExcep
try {
for (int i = 0; i < statements.size(); i++) {
String sql = statements.get(i).getSql();
if (sql.toLowerCase().contains("insert")) {
if (sql.toLowerCase().contains("insert") && !sql.toLowerCase().contains("select")) {
handleBatchInsert();
} else {
execute(sql);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ public void testUpdateSetNull() throws SQLException {
Assertions.assertEquals(null, r.getString(2));
}
}
String insertSelectSql = "insert overwrite test_prepare_statement select * from test_prepare_statement";
try (PreparedStatement statement = conn.prepareStatement(insertSelectSql)) {
statement.execute();
} catch (Exception e) {
e.printStackTrace();
}
}

@Test
Expand Down

0 comments on commit c411bf7

Please sign in to comment.