Skip to content

DDL statements return result other than 0  #22

@GoogleCodeExporter

Description

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

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

2. 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


Original issue reported on code.google.com by lauraf...@gmail.com on 8 Mar 2012 at 8:26

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions