|
1 | 1 | use deadpool_postgres::{Manager, ManagerConfig, Pool, RecyclingMethod}; |
2 | 2 | use pyo3::{pyclass, pymethods, PyAny, Python}; |
3 | | -use std::{collections::HashSet, sync::Arc, vec}; |
| 3 | +use std::{sync::Arc, vec}; |
4 | 4 | use tokio_postgres::{types::ToSql, NoTls}; |
5 | 5 |
|
6 | 6 | use crate::{ |
7 | 7 | common::rustengine_future, |
8 | | - driver::transaction::{RustTransaction, Transaction}, |
9 | 8 | exceptions::rust_errors::{RustPSQLDriverError, RustPSQLDriverPyResult}, |
10 | 9 | query_result::PSQLDriverPyQueryResult, |
11 | 10 | value_converter::{convert_parameters, PythonDTO}, |
12 | 11 | }; |
13 | 12 |
|
14 | | -use super::{ |
15 | | - connection::{Connection, RustConnection}, |
16 | | - transaction_options::IsolationLevel, |
17 | | -}; |
| 13 | +use super::connection::{Connection, RustConnection}; |
18 | 14 |
|
19 | 15 | /// PSQLPool for internal use only. |
20 | 16 | /// |
@@ -111,39 +107,6 @@ impl RustPSQLPool { |
111 | 107 | Ok(PSQLDriverPyQueryResult::new(result)) |
112 | 108 | } |
113 | 109 |
|
114 | | - /// Create new inner transaction and return it. |
115 | | - /// |
116 | | - /// # Errors: |
117 | | - /// May return Err Result if cannot retrieve connection from the pool. |
118 | | - pub async fn inner_transaction<'a>( |
119 | | - &'a self, |
120 | | - isolation_level: Option<IsolationLevel>, |
121 | | - ) -> RustPSQLDriverPyResult<Transaction> { |
122 | | - let db_pool_arc = self.db_pool.clone(); |
123 | | - let db_pool_guard = db_pool_arc.read().await; |
124 | | - |
125 | | - let db_pool_manager = db_pool_guard |
126 | | - .as_ref() |
127 | | - .ok_or(RustPSQLDriverError::DatabasePoolError( |
128 | | - "Database pool is not initialized".into(), |
129 | | - ))? |
130 | | - .get() |
131 | | - .await?; |
132 | | - |
133 | | - let inner_transaction = RustTransaction { |
134 | | - db_client: Arc::new(tokio::sync::RwLock::new(db_pool_manager)), |
135 | | - is_started: Arc::new(tokio::sync::RwLock::new(false)), |
136 | | - is_done: Arc::new(tokio::sync::RwLock::new(false)), |
137 | | - rollback_savepoint: Arc::new(tokio::sync::RwLock::new(HashSet::new())), |
138 | | - isolation_level: isolation_level, |
139 | | - cursor_num: Default::default(), |
140 | | - }; |
141 | | - |
142 | | - Ok(Transaction { |
143 | | - transaction: Arc::new(tokio::sync::RwLock::new(inner_transaction)), |
144 | | - }) |
145 | | - } |
146 | | - |
147 | 110 | /// Create new Database pool. |
148 | 111 | /// |
149 | 112 | /// # Errors: |
|
0 commit comments