oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.24k stars 1.07k forks source link

Support for bfile #1547

Closed bsolarski closed 4 days ago

bsolarski commented 1 year ago

Are there any plans for support for bfile types?

cjbj commented 1 year ago

It hasn't been high on any list. What's your use case? Do your (other) apps use BFILE?

bsolarski commented 1 year ago

I have a microservice that processes binary files, which in most cases are stored as blobs. Sometimes, however, the files are saved as BFILE and my service cannot read them (BFILE isn't supported) . TO_BLOB returns error ORA-00932: inconsistent datatypes: expected BINARY got FILE. My problem would be solved if I can read the BFILE from the database in a similar way to the BLOB

anthony-tuininga commented 1 year ago

I've marked it as an enhancement request. I'll let @cjbj decide where it goes in the list of priorities!

bsolarski commented 1 year ago

Currently i solved this problem by plsql function which takes bfile and returns blob, so my problem is not critical:

FUNCTION bfile_to_blob (
    p_bfile BFILE
) RETURN BLOB IS
    z_bfile    BFILE := p_bfile;
    z_dest_loc BLOB;
BEGIN
    dbms_lob.createtemporary(z_dest_loc, true);
    dbms_lob.open(z_bfile, dbms_lob.lob_readonly);
    dbms_lob.loadfromfile(dest_lob => z_dest_loc, src_lob => z_bfile, amount => dbms_lob.getlength(z_bfile));
    dbms_lob.close(z_bfile);
    RETURN z_dest_loc;
END;
sharadraju commented 4 days ago

BFILE Support is available in node-oracledb 6.6