




 
You can define your own foreign calls and use them on the underlying OCI descriptors. For this, you need to access the OCI handles using 
ora-lob-lob-locator
, and maybe 
ora-lob-env-handle
 and 
ora-lob-svc-ctx-handle
. These accessors return foreign pointers that can be passed to foreign functions in the usual way.
When the foreign functions deal only with the data, rather than with LOB objects, use the functions 
ora-lob-read-foreign-buffer
, 
ora-lob-write
-
foreign-buffer
 and 
ora-lob-get-buffer
.
;;; You have a C function my_lob_processor
;;; int my_lob_processor(OCILobLocator *lob,
;;; OCISvcCtx *Context,
;;; int other_arg)
(fli:define-foreign-function my-lob-processor
((lob sql:p-oci-lob-locator)
(env sql:p-oci-svc-ctx)
(other-arg :int))
:result-type :int)
Assuming you have the LOB locator in the variable lob , call the foreign function on it:
(my-lob-processor (sql:ora-lob-lob lob )
(sql:ora-lob-svc-ctx-handle lob )
36)
There are three handles in the LOB: the LOB descriptor itself, the environment and the context. The pointer types, the reader and the corresponding C type for each handle are shown in Handles in the LOB locator below..
The 
p-oci-lob-locator
 pointer type is used for internal LOBs (that is, BLOB, CLOB and NCLOB). The 
p-oci-file
 pointer type is used for file LOBs (CFILE and BFILE). For functions that take both, the type 
p-oci-lob-or-file
 is defined as the union of these two types