1. Taro L. Saito
  2. sqlite-jdbc
  3. Issues
Issue #16 resolved

DDL statements return result other than 0

Grace Batumbya
created an issue

From http://code.google.com/p/sqlite-jdbc/issues/detail?id=22

What steps will reproduce the problem? 1.First, establish a connection and execute sth like:

stat.executeUpdate("insert into people values ('blah', 'someone');");

  1. then

stat.executeUpdate("drop table if exists people;");

What is the expected output? What do you see instead?

If you printout result returned by last statement, it is 1 instead of 0. This happens because executeUpdate returns changes = db.changes() without checking whether it is a DDL statement or not. In this case, it's 1, the result from INSERT statement.

What version of the product are you using? On what operating system?

I'm using 3.7.8-snapshot on Mac.

Please provide any additional information below.

In Stmt.executeUpdate(String sql) line: 157

            changes = db.changes();

here native method NativeDB.changes() calling for C function int sqlite3_changes(sqlite3*);, which " returns the number of changes in the most recent INSERT, UPDATE, or DELETE that also occurred at the top level. "

Many thanks for your great work,

  • Fiona

Comments (7)

  1. Log in to comment