File tree Expand file tree Collapse file tree
backend/framework/src/main/java/org/jumpserver/chen/framework/datasource/base Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,29 +56,26 @@ public int getAffectedRows(SQL sql) throws SQLException {
5656
5757 var sqlStmts = SQLUtils .parseStatements (sql .getSql (), this .druidDbType );
5858
59- if (sqlStmts .size () != 1 ) {
60- return -1 ;
61- }
62-
63- var sqlStmt = sqlStmts .get (0 );
64-
65- if (sqlStmt instanceof SQLUpdateStatement || sqlStmt instanceof SQLDeleteStatement || sqlStmt instanceof SQLInsertStatement ) {
66- var conn = this .getConnection ();
67- try {
68- conn .setAutoCommit (false );
69- var stmt = conn .createStatement ();
70- stmt .execute (sqlStmt .toString ());
71-
72- result = stmt .getUpdateCount ();
73-
74- conn .rollback ();
75- stmt .close ();
76- } finally {
77- if (this .connection == null ) {
78- conn .close ();
79- } else {
80- conn .setAutoCommit (true );
59+ for (var sqlStmt : sqlStmts ) {
60+ if (sqlStmt instanceof SQLUpdateStatement || sqlStmt instanceof SQLDeleteStatement || sqlStmt instanceof SQLInsertStatement ) {
61+ var conn = this .getConnection ();
62+ try {
63+ conn .setAutoCommit (false );
64+ var stmt = conn .createStatement ();
65+ stmt .execute (sqlStmt .toString ());
66+
67+ result += stmt .getUpdateCount ();
68+
69+ conn .rollback ();
70+ stmt .close ();
71+ } finally {
72+ if (this .connection == null ) {
73+ conn .close ();
74+ } else {
75+ conn .setAutoCommit (true );
76+ }
8177 }
78+
8279 }
8380 }
8481 return result ;
You can’t perform that action at this time.
0 commit comments