(
&self,
value: PySetterValue<Option<PyStrRef>>,
vm: &VirtualMachine,
)
| 1488 | } |
| 1489 | #[pygetset(setter)] |
| 1490 | fn set_isolation_level( |
| 1491 | &self, |
| 1492 | value: PySetterValue<Option<PyStrRef>>, |
| 1493 | vm: &VirtualMachine, |
| 1494 | ) -> PyResult<()> { |
| 1495 | match value { |
| 1496 | PySetterValue::Assign(value) => { |
| 1497 | if let Some(val_str) = &value { |
| 1498 | begin_statement_ptr_from_isolation_level(val_str, vm)?; |
| 1499 | } |
| 1500 | |
| 1501 | // If setting isolation_level to None (auto-commit mode), commit any pending transaction |
| 1502 | if value.is_none() { |
| 1503 | let db = self.db_lock(vm)?; |
| 1504 | if !db.is_autocommit() { |
| 1505 | // Keep the lock and call implicit_commit directly to avoid race conditions |
| 1506 | db.implicit_commit(vm)?; |
| 1507 | } |
| 1508 | } |
| 1509 | let _ = unsafe { self.isolation_level.swap(value) }; |
| 1510 | Ok(()) |
| 1511 | } |
| 1512 | PySetterValue::Delete => { |
| 1513 | Err(vm.new_attribute_error("'isolation_level' attribute cannot be deleted")) |
| 1514 | } |
| 1515 | } |
| 1516 | } |
| 1517 | |
| 1518 | #[pygetset] |
| 1519 | fn autocommit(&self, vm: &VirtualMachine) -> PyObjectRef { |
nothing calls this directly
no test coverage detected