@@ -712,7 +712,8 @@ jsg::JsRef<jsg::JsValue> DurableObjectStorage::transactionSync(
712712 // depth to each savepoint name like I originally thought. We should refactor this -- and use
713713 // prepared statements.
714714
715- sqlite.run (SqliteDatabase::TRUSTED, kj::str (" SAVEPOINT _cf_sync_savepoint_" , depth));
715+ sqlite.run (
716+ {.regulator = SqliteDatabase::TRUSTED}, kj::str (" SAVEPOINT _cf_sync_savepoint_" , depth));
716717 return js.tryCatch ([&]() {
717718 auto result = callback (js);
718719
@@ -721,14 +722,17 @@ jsg::JsRef<jsg::JsValue> DurableObjectStorage::transactionSync(
721722 JSG_REQUIRE (!sqlite.observedCriticalError (), Error,
722723 " Cannot commit transaction due to an earlier SQL critical error" );
723724
724- sqlite.run (SqliteDatabase::TRUSTED, kj::str (" RELEASE _cf_sync_savepoint_" , depth));
725+ sqlite.run (
726+ {.regulator = SqliteDatabase::TRUSTED}, kj::str (" RELEASE _cf_sync_savepoint_" , depth));
725727 return kj::mv (result);
726728 }, [&](jsg::Value exception) -> jsg::JsRef<jsg::JsValue> {
727729 // If a critical error forced an automatic rollback, we skip the rollback and release
728730 // attempt, because savepoints should already be released.
729731 if (!sqlite.observedCriticalError ()) {
730- sqlite.run (SqliteDatabase::TRUSTED, kj::str (" ROLLBACK TO _cf_sync_savepoint_" , depth));
731- sqlite.run (SqliteDatabase::TRUSTED, kj::str (" RELEASE _cf_sync_savepoint_" , depth));
732+ sqlite.run ({.regulator = SqliteDatabase::TRUSTED},
733+ kj::str (" ROLLBACK TO _cf_sync_savepoint_" , depth));
734+ sqlite.run (
735+ {.regulator = SqliteDatabase::TRUSTED}, kj::str (" RELEASE _cf_sync_savepoint_" , depth));
732736 }
733737 js.throwException (kj::mv (exception));
734738 });
0 commit comments