From ce80915c72c37cc700f79e99a712f52c5100815b Mon Sep 17 00:00:00 2001 From: byterock Date: Thu, 6 Nov 2008 20:12:08 +0000 Subject: [PATCH] Update to POD from Chris Underhill git-svn-id: http://svn.perl.org/modules/dbd-oracle/trunk@12054 50811bd7-b8ce-0310-adc1-d9db26280581 --- Changes | 1 + Oracle.pm | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 8aa00e54..62f3ad4c 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,5 @@ =head1 Changes in DBD-Oracle 1.23(svn rev #####) + Update to POD from Chris Underhill Added README.win64.txt with content from Alex Buttery Fix for rt.cpan.org Ticket #=21920 Bug with Oracle DBD for Mac OS X Instant Client From boingolover Added a few more constants to get rid of magic numbers from John Scoles diff --git a/Oracle.pm b/Oracle.pm index 8eb9e0ff..86eb42a1 100644 --- a/Oracle.pm +++ b/Oracle.pm @@ -3568,7 +3568,9 @@ than could be stored in memory at a given time. my $chunk_size = 1034; # Arbitrary chunk size, for example my $offset = 1; # Offsets start at 1, not 0 - while( my $data = $dbh->ora_lob_read( $char_locator, $offset, $chunk_size ) ) { + while(1) { + my $data = $dbh->ora_lob_read( $char_locator, $offset, $chunk_size ); + last unless length $data; print STDOUT $data; $offset += $chunk_size; } @@ -3579,6 +3581,18 @@ Locator returned, and not modifying the LOB it refers to, the select statement does not require the "FOR UPDATE" clause. +A word of catution when using the data retruned from an ora_lob_read in a condtional statement. +for example if the code below; + + while( my $data = $dbh->ora_lob_read( $char_locator, $offset, $chunk_size ) ) { + print STDOUT $data; + $offset += $chunk_size; + } + +was used with a chunk size of 4096 against a blob that requires more than 1 chunk to return +the data and the last chunk is one byte long and contains a zero (ASCII 48) you will miss this last byte +as $data will contain 0 which PERL will see as false and not print it out. + =head3 Example: Truncating existing large data In this example, we truncate the data already present in a