Skip to content

Commit

Permalink
do not check updatedTableInfosThisTx as we can't reset on read
Browse files Browse the repository at this point in the history
`commitHook` is only called after a write or explicit transaction.

Table infos need to be updated in read-only scenarios.
  • Loading branch information
tantaman committed May 28, 2024
1 parent 0d62b52 commit b41f73c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
11 changes: 0 additions & 11 deletions core/rs/core/src/tableinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,11 +750,6 @@ pub extern "C" fn crsql_ensure_table_infos_are_up_to_date(
ext_data: *mut crsql_ExtData,
err: *mut *mut c_char,
) -> c_int {
let already_updated = unsafe { (*ext_data).updatedTableInfosThisTx == 1 };
if already_updated {
return ResultCode::OK as c_int;
}

let schema_changed =
unsafe { crsql_fetchPragmaSchemaVersion(db, ext_data, TABLE_INFO_SCHEMA_VERSION) };

Expand All @@ -769,9 +764,6 @@ pub extern "C" fn crsql_ensure_table_infos_are_up_to_date(
Ok(new_table_infos) => {
*table_infos = new_table_infos;
forget(table_infos);
unsafe {
(*ext_data).updatedTableInfosThisTx = 1;
}
return ResultCode::OK as c_int;
}
Err(e) => {
Expand All @@ -782,9 +774,6 @@ pub extern "C" fn crsql_ensure_table_infos_are_up_to_date(
}

forget(table_infos);
unsafe {
(*ext_data).updatedTableInfosThisTx = 1;
}
return ResultCode::OK as c_int;
}

Expand Down
2 changes: 0 additions & 2 deletions core/src/crsqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ static int commitHook(void *pUserData) {
pExtData->dbVersion = pExtData->pendingDbVersion;
pExtData->pendingDbVersion = -1;
pExtData->seq = 0;
pExtData->updatedTableInfosThisTx = 0;
return SQLITE_OK;
}

Expand All @@ -47,7 +46,6 @@ static void rollbackHook(void *pUserData) {

pExtData->pendingDbVersion = -1;
pExtData->seq = 0;
pExtData->updatedTableInfosThisTx = 0;
}

#ifdef LIBSQL
Expand Down

0 comments on commit b41f73c

Please sign in to comment.