Skip to content

Commit ffbedad

Browse files
committed
Continue implementing new realization. Implementing Cursor. pre-commit disabled.
Signed-off-by: chandr-andr (Kiselev Aleksandr) <chandr@chandr.net>
1 parent 0b98bb8 commit ffbedad

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

src/driver/cursor.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,3 +512,21 @@
512512
// })
513513
// }
514514
// }
515+
516+
use std::sync::Arc;
517+
518+
use crate::value_converter::PythonDTO;
519+
520+
use super::transaction::Transaction;
521+
522+
pub struct Cursor {
523+
db_transaction: Arc<Transaction>,
524+
querystring: String,
525+
parameters: Vec<PythonDTO>,
526+
cursor_name: String,
527+
fetch_number: usize,
528+
scroll: Option<bool>,
529+
prepared: bool,
530+
is_started: bool,
531+
closed: bool,
532+
}

src/driver/transaction.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -411,23 +411,23 @@ use std::{collections::HashSet, sync::Arc};
411411
// slf
412412
// }
413413

414-
// /// Return new instance of transaction.
415-
// ///
416-
// /// It's necessary because python requires it.
417-
// ///
418-
// /// # Errors
419-
// /// May return Err Result if future returns error.
420-
// pub fn __anext__(&self, py: Python<'_>) -> RustPSQLDriverPyResult<Option<PyObject>> {
421-
// let transaction_clone = self.transaction.clone();
422-
// let cursor_num = self.cursor_num;
423-
// let future = rustdriver_future(py, async move {
424-
// Ok(Transaction {
425-
// transaction: transaction_clone,
426-
// cursor_num,
427-
// })
428-
// });
429-
// Ok(Some(future?.into()))
430-
// }
414+
// /// Return new instance of transaction.
415+
// ///
416+
// /// It's necessary because python requires it.
417+
// ///
418+
// /// # Errors
419+
// /// May return Err Result if future returns error.
420+
// pub fn __anext__(&self, py: Python<'_>) -> RustPSQLDriverPyResult<Option<PyObject>> {
421+
// let transaction_clone = self.transaction.clone();
422+
// let cursor_num = self.cursor_num;
423+
// let future = rustdriver_future(py, async move {
424+
// Ok(Transaction {
425+
// transaction: transaction_clone,
426+
// cursor_num,
427+
// })
428+
// });
429+
// Ok(Some(future?.into()))
430+
// }
431431

432432
// #[allow(clippy::missing_errors_doc)]
433433
// #[allow(clippy::needless_pass_by_value)]
@@ -1689,7 +1689,7 @@ use std::{collections::HashSet, sync::Arc};
16891689
// }
16901690

16911691
#[pyclass]
1692-
pub struct TransactionNew {
1692+
pub struct Transaction {
16931693
connection: Arc<Connection>,
16941694
is_started: bool,
16951695
is_done: bool,

0 commit comments

Comments
 (0)