Subject: Bizarre DBD::Oracle Segfault

From: Stephen Clouse <[email-masked]>
Date: Tue, 10 Apr 2001 21:38:59 -0500

I sent an email to the dbi-users list about a number of DBD::Oracle CLOB 
handling problems waaaaaaaaaaaaaaay back (end of January or so) that today
someone dug up and inquired if I had ever found fixes for what I had pointed
out.

The problems outlined that day turned out to be the test script itself, which
was doing so much bizarre stuff on one statement that DBD::Oracle just went to
sleep instead (and so was the actual program that instigated the writing of the 
test script).

Well, all but one problem was the script.  This, the most serious one, continues
to linger:

my $st = $db->prepare('INSERT INTO foo (col1, col2, col3) VALUES (?,?,?)');
$st->bind_param(3,undef,{ ora_type => ORA_CLOB });
$st->execute('A','A',undef);

On Linux, DBI 1.15, Oracle 8.1.6, and DBD::Oracle 1.06, this segfaults on the
execute.  Unfortunately this manifests itself too deep in Oracle for me to
debug.

The bizarre part is, either of the two snippets below will work:

my $st = $db->prepare('INSERT INTO foo (col1, col2, col3) VALUES (?,?,?)');
$st->bind_param(3,undef,{ ora_type => ORA_CLOB });
$st->execute('A','A','');
$st->execute('B','B',undef);

my $st = $db->prepare('INSERT INTO foo (col1, col2, col3) VALUES (?,?,?)');
$st->bind_param(3,undef,{ ora_type => ORA_CLOB });
$st->execute('A','A',$lobvalue);
$st->execute('B','B',undef);

It's only when binding undef as the LOB value in the very first execute of a
statement that the segfault occurs.  At any other time, it's kosher.  That
qualifies as bizarre in my book.

Your guess is better than mine.

- -- 
Stephen Clouse <[email-masked]>
Senior Programmer, IQ Coordinator Project Lead
The IQ Group, Inc. <http://www.theiqgroup.com/>