Warning about retrieving lobs via ora_lob_read with zero length lobs

[email protected] ("Martin J. Evans")
Newsgroups perl.dbi.users
Organization Easysoft Limited
Message-ID <[email protected]>
Hi,

This is just to warn you about a problem I recently hit with
DBD::Oracle. I originally reported it at
http://rt.cpan.org/Public/Bug/Display.html?id=55028 as "DBD
INVALID_HANDLE" and since following the advice to use empty_clob I get a
segfault.

My problem was I had a procedure which can return an clob but sometimes
the clob needs to be empty. Initially, I just set it to '' but with
DBD::Oracle 1.24a I get an invalid handle error when I do that.
Following the suggestion to set it to empty_clob seemed to be the answer
but I then ran into a segfault in the following code:

# $ll is the lob locator returned by DBD::Oracle
my $len = $dbh->ora_lob_length($ll);
$lob = $dbh->ora_lob_read($ll, 1, $len);

It appears attempting to retrieve an empty clob when the $len above is 0
results in the segfault. It was an easy workaround in my code to check
the length first but I thought it was worth a mention. I updated the rt
but it is currently closed.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.