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

Already on GitHub? Sign in to your account

If 's' is a temporary lob, use OCILobLocatorAssign instead. #13

Merged
merged 2 commits into from May 25, 2012

Conversation

Projects
None yet
2 participants
Contributor

timon commented May 23, 2012

This allows ruby-oci8 to work with procedures and functions that return temporary lobs.

Owner

kubo commented May 24, 2012

Thank you!
Could you post sample code you have tested?

Contributor

timon commented May 24, 2012

Here's database schema objects:

CREATE OR REPLACE
type erouter_raw_block as object (
    clob_value  clob,
    blob_value  blob,
    is_blob     char(1),
    file_name   varchar2(1024),
    mime_type   varchar2(1024),
    is_error    char(1)
); 

CREATE OR REPLACE
function erouter_raw_text(p_param in varchar2) return erouter_raw_block is
  l_ret erouter_raw_block;
begin
  l_ret := erouter_raw_block(null,null,'N',null,'text/plain','N');
  dbms_lob.createtemporary(l_ret.clob_value,true);
  l_ret.clob_value := 'this is a clob test ' || p_param;
  return l_ret;
end; 

And here's code I run

cursor = @connection.exec("SELECT erouter_raw_text('Hello, world') FROM dual")
rec = cursor.fetch.first
rec.clob_value.read # => "this is a clob test Hello, world"
rec.clob_value.close; cursor.close
Owner

kubo commented May 24, 2012

Thanks a lot!
I'll test and merge it tomorrow.

kubo added a commit that referenced this pull request May 25, 2012

Merge pull request #13 from timon/temp_lob
If 's' is a temporary lob, use OCILobLocatorAssign instead.

@kubo kubo merged commit 8ffca1c into kubo:master May 25, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment