Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement reading of BLOBs #231

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Implement reading of BLOBs #231

wants to merge 2 commits into from

Conversation

vrurg
Copy link
Contributor

@vrurg vrurg commented Jun 13, 2022

No writing yet.

A blob is returned as a Supply emitting Buf instances. I.e. for a row in hash format sending the actual BLOB data into a file would be:

    react whenever %row<BLOB_COL> {
        $file.write($_);
    }

No writing yet.

A blob is returned as a `Supply` emitting `Buf` instances. I.e. for a
row in hash format sending the actual BLOB data into a file would be:

    react whenever %row<BLOB_COL> {
        $file.write($_);
    }
@vrurg
Copy link
Contributor Author

vrurg commented Jun 13, 2022

Resolves #230

The initial commit has been tested with a single row only where only one
LOB descritor was used. But with a multi-row fetch in a multi-threaded
environment each fetched descriptor must be duplicated before use.

With this commit multi-row fetch still dies with SEGV likely due to
https://docs.oracle.com/database/121/LNOCI/oci02bas.htm#GUID-83F4D3B1-56A7-4EEE-A905-BB84D399713D
@vrurg
Copy link
Contributor Author

vrurg commented Jun 14, 2022

This solution turns out to be incomplete. I'm using OCILobRead2 in poll mode, but according to https://docs.oracle.com/database/121/LNOCI/oci02bas.htm#GUID-83F4D3B1-56A7-4EEE-A905-BB84D399713D this is not allowed. In my tests it does actually ends up with a SEGV. So, perhaps callback implementation must be used.

Unfortunately, I'm out of my spare time for this for now. So, if there is a volunteer to finish this work I would appreciate their efforts!

@abraxxa
Copy link
Contributor

abraxxa commented Jun 14, 2022

I can‘t find the text, saying that OCILobRead2 isn‘t allowed in poll mode. The linked docs even mention it as an example for poll mode usage.

@vrurg
Copy link
Contributor Author

vrurg commented Jun 14, 2022

@abraxxa Ah, I was in a rush and missed the key part: not allowed in a multi-threaded application: "In such cases, OCI requires that the application ensure that the same OCI call is repeated on the connection and nothing else is done on the connection in the interim. Performing any other OCI call on such a connection (when OCI has handed control back to the caller) can result in unexpected behavior."

I'm confirming this by experiencing more or less random SEGVs on an application which is never able to fetch more than 20 rows on a single run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants