Having read : https://www.sqlite.org/isolation.html
Specifically the line "And the application can UPDATE the current row or
any prior row, though doing so might cause that row to reappear in a
subsequent sqlite3_step()."
Is it possible to create and endless loop with the following (pseudo)code?
#define SELECT_EXPIRE_INFO \
"SELECT Auth_id, expiration FROM AuthTable;"
#define UPDATE_SESID_EXPIRED \
"UPDATE AuthTable SET sesCookie=?, expiration=? WHERE Auth_id=?;"
static void
expire_sesid(void)
{
/* get raw current time */
current_time = get_current_db_time(false);
/* prepare SQL queries */
sqlite3_prepare_v2(db, SELECT_EXPIRE_INFO,
-1, &expire_info, NULL);
sqlite3_prepare_v2(db, UPDATE_SESID_EXPIRED,
-1, &update_ses_expired, NULL);
/* while there is work to be done */
while (sqlite3_step(expire_info) == SQLITE_ROW) {
auth_id = sqlite3_column_int(expire_info, 0); /* auth_id */
expiration_time = sqlite3_column_int64(expire_info, 1); /* expiration
*/
/* if the session is expired, today is greater than expiration date */
if ( current_time > expiration_time ) {
/* generate new invalid session id */
generate_ses_id(ses_id);
/* invalidate ses_id and set internal expiration to a year ahead, log
in
will set it to a month for user log in */
sqlite3_bind_text(update_ses_expired, 1, ses_id,
16, SQLITE_STATIC);
sqlite3_bind_int64(update_ses_expired, 2, current_time_plus_year);
sqlite3_bind_int(update_ses_expired, 3, auth_id);
sqlite3_step(update_ses_expired);
sqlite3_reset(update_ses_expired);
}
}
/* all work has completed */
sqlite3_finalize(expire_info);
sqlite3_finalize(update_ses_expired);
return;
}
I appreciate everyone's time,
-Alex V
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users