Skip to content

Commit

Permalink
Update to POD from Chris Underhill
Browse files Browse the repository at this point in the history
  

git-svn-id: http://svn.perl.org/modules/dbd-oracle/trunk@12054 50811bd7-b8ce-0310-adc1-d9db26280581
  • Loading branch information
byterock committed Nov 6, 2008
1 parent b00a76b commit ce80915
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 15 additions & 1 deletion Oracle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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
Expand Down

0 comments on commit ce80915

Please sign in to comment.