Skip to content

Commit

Permalink
transaciton manager
Browse files Browse the repository at this point in the history
  • Loading branch information
insipx committed Aug 15, 2024
1 parent cb27000 commit 8a6ecbf
Showing 1 changed file with 3 additions and 28 deletions.
31 changes: 3 additions & 28 deletions diesel-wasm-sqlite/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct WasmSqliteConnection {
// connection itself
statement_cache: StmtCache<WasmSqlite, Statement>,
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: (),
Expand Down Expand Up @@ -111,7 +111,7 @@ impl AsyncConnection for WasmSqliteConnection {
fn transaction_state(
&mut self,
) -> &mut <Self::TransactionManager as diesel_async::TransactionManager<Self>>::TransactionStateData{
todo!()
&mut self.transaction_manager
}

fn instrumentation(&mut self) -> &mut dyn Instrumentation {
Expand All @@ -123,32 +123,7 @@ impl AsyncConnection for WasmSqliteConnection {
}
}

/*
impl LoadConnection<DefaultLoadingMode> 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<Self::Cursor<'conn, 'query>>
where
T: Query + QueryFragment<Self::Backend> + QueryId + 'query,
Self::Backend: QueryMetadata<T::SqlType>,
{
let statement = self.prepared_query(source)?;

Ok(StatementIterator::new(statement))
}
}
*/
/*
impl WithMetadataLookup for WasmSqliteConnection {
fn metadata_lookup(&mut self) -> &mut <WasmSqlite as TypeMetadata>::MetadataLookup {
&mut self.metadata_lookup
}
}
*/

#[cfg(feature = "r2d2")]
impl crate::r2d2::R2D2Connection for crate::sqlite::SqliteConnection {
Expand Down Expand Up @@ -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)),
})
Expand Down

0 comments on commit 8a6ecbf

Please sign in to comment.