Oracle® Objects for OLE Developer's Guide 11g Release 2 (11.2) for Microsoft Windows Part Number E17727-03 |
|
|
PDF · Mobi · ePub |
The OraBFile
interface in OO4O provides methods for performing operations on the BFILE
LOB data type in the database.
The BFILE
types are large binary data objects stored in operating system files (external) outside of the database tablespaces.
See "Schema Objects Used in LOB Data Type Examples" for schema objects that are used in the OraLOB/BFILE
examples.
NOTE: To add the required tables for the following examples, run the lob.sql
file in the \OO4O\VB\SAMPLES\LOB
directory.
Example: Accessing the BFILE Value
BFILE
data can be read using the Read
method. The OraBFILE
object allows piecewise read operations. Before reading the BFILE
content, the BFILE
file should be opened using the Open
method.
Dim PartColl as OraBFile Dim buffer As Variant 'Create a Dynaset containing a BLOB and a CLOB column set part = OraDatabase.CreateDynaset ("select * from part",0) Set PartColl = part.Fields("part_collateral").Value 'open the bfile for read operation PartColl.Open 'read the entire bfile amount_read = PartColl.Read(buffer) 'close the bfile PartColl.Close
Example: Reading and Inserting BFILEs Using Dynasets
To modify the directory and file names of the BFILE
value of an OraBFILE
object, first obtain a lock and then use the DirectoryName
and FileName
properties.
To insert a new row containing a BFILE
column, initialize the BFILE
column with new directory and file name values using the DirectoryName
and FileName
properties.
Dim PartColl as OraBFile Dim buffer As Variant 'Create a Dynaset containing a BLOB and a CLOB column set part = OraDatabase.CreateDynaset ("select * from part",0) Set PartColl = part.Fields("part_collateral").Value 'insert a new BFILE in the part_collateral column part.AddNew 'Directory objects will be upper-case by default PartColl.DirectoryName = "NEWDIRECTORYNAME" PartColl.FileName = "NewPartCollatoral" part.Update 'move to the newly added row part.MoveLast 'open the Bfile for read operation PartColl.Open 'read the entire bfile amount_read = PartColl.Read(buffer) 'close the Bfile PartColl.Close
See Also:
Oracle Database SecureFiles and Large Objects Developer's Guide for a detailed description of Oracle BFILE
types