1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use futures_core::future::BoxFuture;

use crate::{Rqlite, RqliteConnection};
use sqlx_core::error::Error;
use sqlx_core::transaction::TransactionManager;

/// Implementation of [`TransactionManager`] for SQLite.
pub struct RqliteTransactionManager;

impl TransactionManager for RqliteTransactionManager {
    type Database = Rqlite;

    fn begin(_conn: &mut RqliteConnection) -> BoxFuture<'_, Result<(), Error>> {
        Box::pin(async {
            Err(Error::Io(std::io::Error::new(
                std::io::ErrorKind::Other,
                "begin not supported",
            )))
        })
    }

    fn commit(_conn: &mut RqliteConnection) -> BoxFuture<'_, Result<(), Error>> {
        Box::pin(async {
            Err(Error::Io(std::io::Error::new(
                std::io::ErrorKind::Other,
                "commit not supported",
            )))
        })
    }

    fn rollback(_conn: &mut RqliteConnection) -> BoxFuture<'_, Result<(), Error>> {
        Box::pin(async {
            Err(Error::Io(std::io::Error::new(
                std::io::ErrorKind::Other,
                "rollback not supported",
            )))
        })
    }

    fn start_rollback(_conn: &mut RqliteConnection) {
        //conn.worker.start_rollback().ok();
    }
}