From 8a6ecbf58105c7e9357e609c3087f091e24ca11e Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Thu, 15 Aug 2024 11:24:45 -0400 Subject: [PATCH] transaciton manager --- diesel-wasm-sqlite/src/connection/mod.rs | 31 +++--------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/diesel-wasm-sqlite/src/connection/mod.rs b/diesel-wasm-sqlite/src/connection/mod.rs index 9293c05a3..a91ab2c92 100644 --- a/diesel-wasm-sqlite/src/connection/mod.rs +++ b/diesel-wasm-sqlite/src/connection/mod.rs @@ -40,7 +40,7 @@ pub struct WasmSqliteConnection { // connection itself statement_cache: StmtCache, pub raw_connection: RawConnection, - transaction_state: AnsiTransactionManager, + transaction_manager: AnsiTransactionManager, // this exists for the sole purpose of implementing `WithMetadataLookup` trait // and avoiding static mut which will be deprecated in 2024 edition metadata_lookup: (), @@ -111,7 +111,7 @@ impl AsyncConnection for WasmSqliteConnection { fn transaction_state( &mut self, ) -> &mut >::TransactionStateData{ - todo!() + &mut self.transaction_manager } fn instrumentation(&mut self) -> &mut dyn Instrumentation { @@ -123,32 +123,7 @@ impl AsyncConnection for WasmSqliteConnection { } } -/* -impl LoadConnection for WasmSqliteConnection { - type Cursor<'conn, 'query> = StatementIterator<'conn, 'query>; - type Row<'conn, 'query> = self::row::SqliteRow<'conn, 'query>; - - fn load<'conn, 'query, T>( - &'conn mut self, - source: T, - ) -> QueryResult> - where - T: Query + QueryFragment + QueryId + 'query, - Self::Backend: QueryMetadata, - { - let statement = self.prepared_query(source)?; - Ok(StatementIterator::new(statement)) - } -} -*/ -/* -impl WithMetadataLookup for WasmSqliteConnection { - fn metadata_lookup(&mut self) -> &mut ::MetadataLookup { - &mut self.metadata_lookup - } -} - */ #[cfg(feature = "r2d2")] impl crate::r2d2::R2D2Connection for crate::sqlite::SqliteConnection { @@ -310,7 +285,7 @@ impl WasmSqliteConnection { Ok(Self { statement_cache: StmtCache::new(), raw_connection, - transaction_state: AnsiTransactionManager::default(), + transaction_manager: AnsiTransactionManager::default(), metadata_lookup: (), instrumentation: Arc::new(Mutex::new(None)), })