Dear all,

Why isn't there some:

        sqlite3_int64 sqlite3_stmt_last_insert_rowid(sqlite3_stmt*);
        int sqlite3_stmt_changes(sqlite3_stmt*);

in addition to these:

        sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
        int sqlite3_changes(sqlite3*);

Reading this:

"If a separate thread makes changes on the same database connection while 
sqlite3_changes() / sqlit3_last_insert_rowid() is running then the value 
returned is unpredictable and not meaningful."

I interpret that (I may be wrong): even if using two distinct sqlite3_stmt* 
handles (linked to a same sqlite3* handle), two competing threads would get 
unusable answers from both these API.

Wouldn't it be more useful to have this info restricted to some statement 
handle?

Or should the design of competing threads revolve around each one having a 
distinct connection handle?

Reason for asking: I was about to consider using sqlite3_changes() after some 
specific UPDATEs (returning 0 changes) to implement an UPDATE OR INSERT similar 
to some other SQL engines offer. But as far as I understand from these API 
descriptions, it looks like I would have to manage a distinct single connection 
per thread, instead of sharing the connection and using only distinct statement 
handles.

I'm really new to SQLite and still need to learn a lot from source code, so I 
can't yet appreciate if sharing connection handle between threads is 
interesting or if a model where each thread have all their private handles is a 
better world, without major performance impact.

-- 
Meilleures salutations, Met vriendelijke groeten, Best Regards,
Olivier Mascia, integral.be/om


Reply via email to