(
context: SqliteContext,
instance: &PyObject,
name: &str,
args: &[*mut sqlite3_value],
vm: &VirtualMachine,
)
| 644 | } |
| 645 | |
| 646 | fn call_method_with_args( |
| 647 | context: SqliteContext, |
| 648 | instance: &PyObject, |
| 649 | name: &str, |
| 650 | args: &[*mut sqlite3_value], |
| 651 | vm: &VirtualMachine, |
| 652 | ) { |
| 653 | let f = || -> PyResult<()> { |
| 654 | let db = context.db_handle(); |
| 655 | let args = args |
| 656 | .iter() |
| 657 | .cloned() |
| 658 | .map(|val| value_to_object(val, db, vm)) |
| 659 | .collect::<PyResult<Vec<PyObjectRef>>>()?; |
| 660 | vm.call_method(instance, name, args).map(drop) |
| 661 | }; |
| 662 | |
| 663 | if let Err(exc) = f() { |
| 664 | if exc.fast_isinstance(vm.ctx.exceptions.attribute_error) { |
| 665 | context.result_exception( |
| 666 | vm, |
| 667 | exc, |
| 668 | &format!("user-defined aggregate's '{name}' method not defined\0"), |
| 669 | ) |
| 670 | } else { |
| 671 | context.result_exception( |
| 672 | vm, |
| 673 | exc, |
| 674 | &format!("user-defined aggregate's '{name}' method raised error\0"), |
| 675 | ) |
| 676 | } |
| 677 | } |
| 678 | } |
| 679 | } |
| 680 | |
| 681 | impl Drop for CallbackData { |
nothing calls this directly
no test coverage detected