(&self, val: PyObjectRef, vm: &VirtualMachine)
| 1525 | } |
| 1526 | #[pygetset(setter)] |
| 1527 | fn set_autocommit(&self, val: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { |
| 1528 | let mode = AutocommitMode::try_from_borrowed_object(vm, &val)?; |
| 1529 | let db = self.db_lock(vm)?; |
| 1530 | |
| 1531 | // Handle transaction state based on mode change |
| 1532 | match mode { |
| 1533 | AutocommitMode::Enabled => { |
| 1534 | // If there's a pending transaction, commit it |
| 1535 | if !db.is_autocommit() { |
| 1536 | db._exec(b"COMMIT ", vm)?; |
| 1537 | } |
| 1538 | } |
| 1539 | AutocommitMode::Disabled => { |
| 1540 | // If not in a transaction, begin one |
| 1541 | if db.is_autocommit() { |
| 1542 | db._exec(b"BEGIN ", vm)?; |
| 1543 | } |
| 1544 | } |
| 1545 | AutocommitMode::Legacy => { |
| 1546 | // Legacy mode doesn't change transaction state |
| 1547 | } |
| 1548 | } |
| 1549 | |
| 1550 | drop(db); |
| 1551 | *self.autocommit.lock() = mode; |
| 1552 | Ok(()) |
| 1553 | } |
| 1554 | |
| 1555 | #[pygetset] |
| 1556 | fn text_factory(&self) -> PyObjectRef { |
nothing calls this directly
no test coverage detected