I am using Sqlite3 with Flask microframework, but this question concerns only the Sqlite side of things..
Here is a snippet of the code:
g.db.execute('INSERT INTO downloads (name, owner, mimetype) VALUES (?, ?, ?)', [name, owner, mimetype])
file_entry = query_db('SELECT last_insert_rowid()')
g.db.commit()
The downloads
table has another column with the following attributes: id integer primary key autoincrement,
If two people write at the same time the code above could produce errors.
Transactions can be messy. In Sqlite is there a neat built in way of returning the primary key generated after doing an INSERT ?