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

Method blobopen

crates/stdlib/src/_sqlite3.rs:1053–1085  ·  view source on GitHub ↗
(
            zelf: PyRef<Self>,
            args: BlobOpenArgs,
            vm: &VirtualMachine,
        )

Source from the content-addressed store, hash-verified

1051
1052 #[pymethod]
1053 fn blobopen(
1054 zelf: PyRef<Self>,
1055 args: BlobOpenArgs,
1056 vm: &VirtualMachine,
1057 ) -> PyResult<PyRef<Blob>> {
1058 let table = args.table.to_cstring(vm)?;
1059 let column = args.column.to_cstring(vm)?;
1060 let name = args.name.to_cstring(vm)?;
1061
1062 let db = zelf.db_lock(vm)?;
1063
1064 let mut blob = null_mut();
1065 let ret = unsafe {
1066 sqlite3_blob_open(
1067 db.db,
1068 name.as_ptr(),
1069 table.as_ptr(),
1070 column.as_ptr(),
1071 args.row,
1072 (!args.readonly) as c_int,
1073 &mut blob,
1074 )
1075 };
1076 db.check(ret, vm)?;
1077 drop(db);
1078
1079 let blob = SqliteBlob { blob };
1080 let blob = Blob {
1081 connection: zelf,
1082 inner: PyMutex::new(Some(BlobInner { blob, offset: 0 })),
1083 };
1084 Ok(blob.into_ref(&vm.ctx))
1085 }
1086
1087 #[pymethod]
1088 fn close(&self, vm: &VirtualMachine) -> PyResult<()> {

Calls 7

newFunction · 0.85
db_lockMethod · 0.80
SomeClass · 0.50
to_cstringMethod · 0.45
as_ptrMethod · 0.45
checkMethod · 0.45
into_refMethod · 0.45