Hi,

I'm checking just to make sure, if something like this is OK to do in SQLite.
My example works in practice but I wasn’t sure by reading the manual if I was 
allowed to do ANY changes between the sqlite3_step() calls.
I’ve read from the mailing list there are problems if the UPDATE alters 
something that is mentioned in the WHERE terms, which seems logical, but what 
about this?

const char *sql = “SELECT rowid, foo FROM bar WHERE y = z;”;
sqlite3_stmt *stmt;
sqlite3_prepare_v2(conn,sql,-1,&stmt, NULL);
while((step = sqlite3_step(stmt)) == SQLITE_ROW) {
        //do some stuff with the row here
        ...

        //make some changes to the row with new statement
        sqlite3_exec(conn, “UPDATE bar SET foo=1 WHERE rowid = 123;”, NULL, 
NULL, NULL);
}

Thanks!

Best regards,
Mikko Korkalo
mi...@korkalo.fi
+358509104329
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to