sqlite3_last_insert_rowid implementation