MCPcopy Index your code
hub / github.com/RustPython/RustPython / authorizer_callback

Method authorizer_callback

crates/stdlib/src/_sqlite3.rs:566–589  ·  view source on GitHub ↗
(
            data: *mut c_void,
            action: c_int,
            arg1: *const libc::c_char,
            arg2: *const libc::c_char,
            db_name: *const libc::c_char,
            access: 

Source from the content-addressed store, hash-verified

564 }
565
566 unsafe extern "C" fn authorizer_callback(
567 data: *mut c_void,
568 action: c_int,
569 arg1: *const libc::c_char,
570 arg2: *const libc::c_char,
571 db_name: *const libc::c_char,
572 access: *const libc::c_char,
573 ) -> c_int {
574 let (callable, vm) = unsafe { (*data.cast::<Self>()).retrieve() };
575 let f = || -> PyResult<c_int> {
576 let arg1 = ptr_to_str(arg1, vm)?;
577 let arg2 = ptr_to_str(arg2, vm)?;
578 let db_name = ptr_to_str(db_name, vm)?;
579 let access = ptr_to_str(access, vm)?;
580
581 let val = callable.call((action, arg1, arg2, db_name, access), vm)?;
582 let Some(val) = val.downcast_ref::<PyInt>() else {
583 return Ok(SQLITE_DENY);
584 };
585 val.try_to_primitive::<c_int>(vm)
586 };
587
588 f().unwrap_or(SQLITE_DENY)
589 }
590
591 unsafe extern "C" fn trace_callback(
592 _typ: c_uint,

Callers

nothing calls this directly

Calls 4

ptr_to_strFunction · 0.85
retrieveMethod · 0.80
fFunction · 0.50
callMethod · 0.45

Tested by

no test coverage detected