Author: REHSACK
Date: Fri Oct  5 04:27:31 2012
New Revision: 15425

Modified:
   dbi/branches/sqlengine/lib/DBD/DBM.pm
   dbi/branches/sqlengine/lib/DBD/File.pm
   dbi/branches/sqlengine/lib/DBI/DBD/SqlEngine.pm

Log:
fixing the open_file issue remaining after streaming support added
Would be great when someone reviews it (entirely)


Modified: dbi/branches/sqlengine/lib/DBD/DBM.pm
==============================================================================
--- dbi/branches/sqlengine/lib/DBD/DBM.pm       (original)
+++ dbi/branches/sqlengine/lib/DBD/DBM.pm       Fri Oct  5 04:27:31 2012
@@ -343,10 +343,11 @@
     $self->SUPER::init_table_meta( $dbh, $meta, $table );
 }
 
-sub open_file
+sub open_data
 {
-    my ( $self, $meta, $attrs, $flags ) = @_;
-    $self->SUPER::open_file( $meta, $attrs, $flags );
+    my ( $className, $meta, $attrs, $flags ) = @_;
+    $className->SUPER::open_data( $meta, $attrs, $flags );
+
     unless ( $flags->{dropMode} )
     {
         # TIEING

Modified: dbi/branches/sqlengine/lib/DBD/File.pm
==============================================================================
--- dbi/branches/sqlengine/lib/DBD/File.pm      (original)
+++ dbi/branches/sqlengine/lib/DBD/File.pm      Fri Oct  5 04:27:31 2012
@@ -773,37 +773,27 @@
 
 # ====== DBD::File <= 0.40 compat stuff 
========================================
 
+# compat to 0.38 .. 0.40 API
 sub open_file
 {
-    my ($self, $meta, $attrs, $flags) = @_;
+    my ($className, $meta, $attrs, $flags) = @_;
 
-    $meta->{sql_data_source} or
-       croak "Table " . $meta->{table_name} . " not completely initialized";
-    $meta->{sql_data_source}->open_data ($meta, $attrs, $flags);
-
-    return;
+    return $className->SUPER::open_data ($meta, $attrs, $flags);
     } # open_file
 
-# ====== SQL::Eval API 
=========================================================
-
-sub new
+sub open_data
 {
-    my ($className, $data, $attrs, $flags) = @_;
-
-    # open_file must be called before inherited new is invoked
-    # because column name mapping is initialized in constructor ...
-    my ($tblnm, $meta) = $className->get_table_meta ($data->{Database}, 
$attrs->{table}, 1) or
-        croak "Cannot find appropriate file for table '$attrs->{table}'";
+    my ($className, $meta, $attrs, $flags) = @_;
 
     # compat to 0.38 .. 0.40 API
     $meta->{f_open_file_needed}
        ? $className->open_file ($meta, $attrs, $flags)
-       : $meta->{sql_data_source}->open_data ($meta, $attrs, $flags);;
+       : $className->SUPER::open_data ($meta, $attrs, $flags);
 
-    my $self = $className->SUPER::new ($data, $attrs, $flags);
+    return;
+    } # open_data
 
-    return $self;
-    } # new
+# ====== SQL::Eval API 
=========================================================
 
 sub drop ($)
 {

Modified: dbi/branches/sqlengine/lib/DBI/DBD/SqlEngine.pm
==============================================================================
--- dbi/branches/sqlengine/lib/DBI/DBD/SqlEngine.pm     (original)
+++ dbi/branches/sqlengine/lib/DBI/DBD/SqlEngine.pm     Fri Oct  5 04:27:31 2012
@@ -1527,7 +1527,16 @@
       and $meta->{initialized} = 0;
 }    # table_meta_attr_changed
 
-1;
+sub open_data
+{
+    my ($self, $meta, $attrs, $flags) = @_;
+
+    $meta->{sql_data_source} or
+       croak "Table " . $meta->{table_name} . " not completely initialized";
+    $meta->{sql_data_source}->open_data ($meta, $attrs, $flags);;
+
+    return;
+    } # open_data
 
 # ====== SQL::Eval API 
=========================================================
 
@@ -1545,6 +1554,10 @@
     $flags->{createMode} && $data->{sql_stmt}{table_defs}
       and $meta->{table_defs} = $data->{sql_stmt}{table_defs};
 
+    # open_file must be called before inherited new is invoked
+    # because column name mapping is initialized in constructor ...
+    $className->open_data( $meta, $attrs, $flags );
+
     my $tbl = {
                 %{$attrs},
                 meta      => $meta,
@@ -1553,6 +1566,8 @@
     return $className->SUPER::new($tbl);
 }    # new
 
+1;
+
 =pod
 
 =head1 NAME

Reply via email to