From 61934410d658dc551ea9e9fd5ae715f8d9974fa0 Mon Sep 17 00:00:00 2001 From: Matt <1009003+tantaman@users.noreply.github.com> Date: Tue, 28 May 2024 09:38:59 -0400 Subject: [PATCH] do not check `updatedTableInfosThisTx` as we can't reset on read `commitHook` is only called after a write or explicit transaction. Table infos need to be updated in read-only scenarios. --- core/rs/core/src/tableinfo.rs | 11 ----------- core/src/crsqlite.c | 2 -- 2 files changed, 13 deletions(-) diff --git a/core/rs/core/src/tableinfo.rs b/core/rs/core/src/tableinfo.rs index b36ea9a6..b4b9b618 100644 --- a/core/rs/core/src/tableinfo.rs +++ b/core/rs/core/src/tableinfo.rs @@ -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) }; @@ -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) => { @@ -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; } diff --git a/core/src/crsqlite.c b/core/src/crsqlite.c index a28a342f..71b2ec67 100644 --- a/core/src/crsqlite.c +++ b/core/src/crsqlite.c @@ -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; } @@ -47,7 +46,6 @@ static void rollbackHook(void *pUserData) { pExtData->pendingDbVersion = -1; pExtData->seq = 0; - pExtData->updatedTableInfosThisTx = 0; } #ifdef LIBSQL