Nikolaus Rath wrote:
> 
> So as soon as I make a change in the database, I do not get any more
> results. If I understood you correctly, I should have gotten (4,)
> instead.
> 
> Is this a bug?
> 

It is probably a bug (or a design decision) in the apsw wrapper. The 
following program produces the expected output using the C API functions.

#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>

using namespace std;

int main(int argc, char *argv[])
{
     sqlite3* db;

     sqlite3_open("test.db3", &db);
     sqlite3_exec(db, "create table numbers (n integer)", 0, 0, 0);

     char sql[100];
     for (int i = 1; i <=10; ++i) {
         sprintf(sql, "insert into numbers values(%d)", i);
         sqlite3_exec(db, sql, 0, 0, 0);
     }

     sqlite3_stmt* s;
     sqlite3_prepare(db, "select * from numbers", -1, &s, 0);

     sqlite3_step(s);
     printf("%d\n", sqlite3_column_int(s, 0));
     sqlite3_step(s);
     printf("%d\n", sqlite3_column_int(s, 0));
     sqlite3_step(s);
     printf("%d\n", sqlite3_column_int(s, 0));

     sqlite3_exec(db, "delete from numbers where n = 5", 0, 0, 0);

     sqlite3_step(s);
     printf("%d\n", sqlite3_column_int(s, 0));
     sqlite3_step(s);
     printf("%d\n", sqlite3_column_int(s, 0));
     sqlite3_step(s);
     printf("%d\n", sqlite3_column_int(s, 0));

     sqlite3_finalize(s);
     sqlite3_close(db);

     system("PAUSE");
     return EXIT_SUCCESS;
}

This produces:

1
2
3
4
6
7
Press any key to continue . . .


HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to