(
context: *mut sqlite3_context,
argc: c_int,
argv: *mut *mut sqlite3_value,
)
| 472 | } |
| 473 | |
| 474 | unsafe extern "C" fn step_callback( |
| 475 | context: *mut sqlite3_context, |
| 476 | argc: c_int, |
| 477 | argv: *mut *mut sqlite3_value, |
| 478 | ) { |
| 479 | let context = SqliteContext::from(context); |
| 480 | let (cls, vm) = unsafe { (*context.user_data::<Self>()).retrieve() }; |
| 481 | let args = unsafe { core::slice::from_raw_parts(argv, argc as usize) }; |
| 482 | let instance = context.aggregate_context::<*const PyObject>(); |
| 483 | if unsafe { (*instance).is_null() } { |
| 484 | match cls.call((), vm) { |
| 485 | Ok(obj) => unsafe { *instance = obj.into_raw().as_ptr() }, |
| 486 | Err(exc) => { |
| 487 | return context.result_exception( |
| 488 | vm, |
| 489 | exc, |
| 490 | "user-defined aggregate's '__init__' method raised error\0", |
| 491 | ); |
| 492 | } |
| 493 | } |
| 494 | } |
| 495 | let instance = unsafe { &**instance }; |
| 496 | |
| 497 | Self::call_method_with_args(context, instance, "step", args, vm); |
| 498 | } |
| 499 | |
| 500 | unsafe extern "C" fn finalize_callback(context: *mut sqlite3_context) { |
| 501 | let context = SqliteContext::from(context); |
nothing calls this directly
no test coverage detected