Skip to content

Commit b260ba3

Browse files
committed
Made small use corrections
1 parent 82b9fc5 commit b260ba3

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/driver/inner_connection.rs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use bytes::Buf;
2-
use deadpool_postgres::Object;
2+
use deadpool_postgres::{Object, Transaction};
33
use postgres_types::{ToSql, Type};
4-
use pyo3::{Py, PyAny, Python};
4+
use pyo3::{pyclass, Py, PyAny, Python};
55
use std::vec;
66
use tokio_postgres::{Client, CopyInSink, Row, Statement, ToStatement};
77

@@ -18,6 +18,11 @@ pub enum PsqlpyConnection {
1818
SingleConn(Client),
1919
}
2020

21+
// #[pyclass]
22+
// struct Portal {
23+
// trans: Transaction<'static>,
24+
// }
25+
2126
impl PsqlpyConnection {
2227
/// Prepare cached statement.
2328
///
@@ -38,6 +43,25 @@ impl PsqlpyConnection {
3843
}
3944
}
4045

46+
// pub async fn transaction(&mut self) -> Portal {
47+
// match self {
48+
// PsqlpyConnection::PoolConn(pconn, _) => {
49+
// let b = unsafe {
50+
// std::mem::transmute::<Transaction<'_>, Transaction<'static>>(pconn.transaction().await.unwrap())
51+
// };
52+
// Portal {trans: b}
53+
// // let c = b.bind("SELECT 1", &[]).await.unwrap();
54+
// // b.query_portal(&c, 1).await;
55+
// }
56+
// PsqlpyConnection::SingleConn(sconn) => {
57+
// let b = unsafe {
58+
// std::mem::transmute::<Transaction<'_>, Transaction<'static>>(sconn.transaction().await.unwrap())
59+
// };
60+
// Portal {trans: b}
61+
// },
62+
// }
63+
// }
64+
4165
/// Delete prepared statement.
4266
///
4367
/// # Errors

0 commit comments

Comments
 (0)