Skip to content

Commit

Permalink
Fixed the row update count in the JDBC API.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Dec 5, 2016
1 parent a8750da commit 6786f3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Expand Up @@ -5,4 +5,4 @@ Date: XXXXX GMT
Content-Type: application/json
Content-Length: 28

{"success":true,"changes":0}
{"success":true,"changes":1}
9 changes: 7 additions & 2 deletions rapidoid-sql/src/main/java/org/rapidoid/jdbc/JdbcClient.java
Expand Up @@ -160,15 +160,20 @@ private static void close(ResultSet rs) {
public int execute(String sql, Object... args) {
ensureIsInitialized();

Log.info("SQL", "sql", sql, "args", args);
Log.debug("SQL", "sql", sql, "args", args);

Connection conn = provideConnection();
PreparedStatement stmt = null;

try {
stmt = JDBC.prepare(conn, sql, args);

if (sql.trim().toUpperCase().startsWith("UPDATE ")) {
String q = sql.trim().toUpperCase();

if (q.startsWith("INSERT ")
|| q.startsWith("UPDATE ")
|| q.startsWith("DELETE ")) {

return stmt.executeUpdate();

} else {
Expand Down

0 comments on commit 6786f3e

Please sign in to comment.