From 15a4c89ecc227ede7f14f5d2eb29913eae8ee974 Mon Sep 17 00:00:00 2001 From: Jeroen Koek Date: Tue, 7 Feb 2023 14:28:14 +0100 Subject: [PATCH] Updated rows is not returned In the PreparedStatementHandler the execute function is used and afterwards the getUpdateCount is used. However in my case (Sybase) the updateCount returns zero. The two statements can be combined to 1; executeUpdate which returns the correct result. --- .../ibatis/executor/statement/PreparedStatementHandler.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/ibatis/executor/statement/PreparedStatementHandler.java b/src/main/java/org/apache/ibatis/executor/statement/PreparedStatementHandler.java index ebdafaf0016..2ea4fc92ee6 100644 --- a/src/main/java/org/apache/ibatis/executor/statement/PreparedStatementHandler.java +++ b/src/main/java/org/apache/ibatis/executor/statement/PreparedStatementHandler.java @@ -44,9 +44,8 @@ public PreparedStatementHandler(Executor executor, MappedStatement mappedStateme @Override public int update(Statement statement) throws SQLException { - PreparedStatement ps = (PreparedStatement) statement; - ps.execute(); - int rows = ps.getUpdateCount(); + PreparedStatement ps = (PreparedStatement) statement; + int rows = ps.executeUpdate(); Object parameterObject = boundSql.getParameterObject(); KeyGenerator keyGenerator = mappedStatement.getKeyGenerator(); keyGenerator.processAfter(executor, mappedStatement, ps, parameterObject);