[Bps-public-commit] dbix-searchbuilder branch, oracle-full-blobs, created. 1.66-1-g979da85

Alex Vandiver alexmv at bestpractical.com
Fri May 8 16:55:57 EDT 2015


The branch, oracle-full-blobs has been created
        at  979da85dccf8034c06e17bde3e57e71959bbdaa5 (commit)

- Log -----------------------------------------------------------------
commit 979da85dccf8034c06e17bde3e57e71959bbdaa5
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri May 8 16:55:36 2015 -0400

    Checkpoint: retrieve full size of Oracle blobs

diff --git a/lib/DBIx/SearchBuilder/Handle.pm b/lib/DBIx/SearchBuilder/Handle.pm
index 6ed2cc8..9f70a08 100755
--- a/lib/DBIx/SearchBuilder/Handle.pm
+++ b/lib/DBIx/SearchBuilder/Handle.pm
@@ -534,6 +534,16 @@ sub DeleteFromSelect {
     return $rows == 0? '0E0' : $rows;
 }
 
+=head2 Prepare QUERY_STRING
+
+=cut
+
+sub Prepare {
+    my $self        = shift;
+    my $QueryString = shift;
+    return $self->dbh->prepare($QueryString);
+}
+
 =head2 SimpleQuery QUERY_STRING, [ BIND_VALUE, ... ]
 
 Execute the SQL string specified in QUERY_STRING
@@ -546,7 +556,7 @@ sub SimpleQuery {
     my @bind_values;
     @bind_values = (@_) if (@_);
 
-    my $sth = $self->dbh->prepare($QueryString);
+    my $sth = $self->Prepare($QueryString);
     unless ($sth) {
         if ($DEBUG) {
             die "$self couldn't prepare the query '$QueryString'"
diff --git a/lib/DBIx/SearchBuilder/Handle/Oracle.pm b/lib/DBIx/SearchBuilder/Handle/Oracle.pm
index add1ac6..38d2828 100755
--- a/lib/DBIx/SearchBuilder/Handle/Oracle.pm
+++ b/lib/DBIx/SearchBuilder/Handle/Oracle.pm
@@ -44,9 +44,11 @@ sub Connect  {
 	       @_);
   
     my $rv = $self->SUPER::Connect(%args);
-    
-    $self->dbh->{LongTruncOk}=1;
-    $self->dbh->{LongReadLen}=8000;
+
+    # We read LOBs up to 4G out of the database.  We read them in chunks
+    # of 16M (see Prepare, below).
+    $self->dbh->{LongTruncOk} = 1;
+    $self->dbh->{LongReadLen} = 4*1024*1024*1024;
 
     foreach my $setting (qw(DATE TIMESTAMP TIMESTAMP_TZ)) {
         $self->SimpleQuery(
@@ -102,6 +104,24 @@ sub BuildDSN {
     return $self->{'dsn'} = $dsn;
 }
 
+=head2 Prepare QUERYSTRING
+
+Override the Prepare method to retrieve LOBs in chunks of 16M each.
+This allows us to retrieve the full size of large LOBs without impacting
+the database memory footprint, or running afoul of Oracle's memory
+contraints.
+
+=cut
+
+sub Prepare {
+    my $self        = shift;
+    my $QueryString = shift;
+    return $self->dbh->prepare(
+        $QueryString,
+        { ora_clbk_lob => 1, ora_piece_size => 16*1024*1024 }
+    );
+}
+
 
 =head2 Insert
 

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list