mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-08 18:54:21 +01:00
bindings/python: Add Connection.rollback()
This commit is contained in:
@@ -263,9 +263,16 @@ impl Connection {
|
||||
}
|
||||
|
||||
pub fn rollback(&self) -> PyResult<()> {
|
||||
Err(PyErr::new::<NotSupportedError, _>(
|
||||
"Transactions are not supported in this version",
|
||||
))
|
||||
if !self.conn.get_auto_commit() {
|
||||
self.conn.execute("COMMIT").map_err(|e| {
|
||||
PyErr::new::<OperationalError, _>(format!("Failed to commit: {:?}", e))
|
||||
})?;
|
||||
|
||||
self.conn.execute("BEGIN").map_err(|e| {
|
||||
PyErr::new::<OperationalError, _>(format!("Failed to commit: {:?}", e))
|
||||
})?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn __enter__(&self) -> PyResult<Self> {
|
||||
|
||||
Reference in New Issue
Block a user