[svn:dbi] r14580 - in dbi/branches/sqlengine/lib: DBD DBI/DBD

[email protected] Wed, 15 Dec 2010 14:29:52 -0800 (PST)
Newsgroups perl.dbi.changes
Message-ID <[email protected]>
Author: REHSACK
Date: Wed Dec 15 14:29:51 2010
New Revision: 14580

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

Log:
add comments about how it deals with Gofer


Modified: dbi/branches/sqlengine/lib/DBD/File.pm
==============================================================================
--- dbi/branches/sqlengine/lib/DBD/File.pm	(original)
+++ dbi/branches/sqlengine/lib/DBD/File.pm	Wed Dec 15 14:29:51 2010
@@ -225,9 +225,11 @@
 	}
 
     if (0 == $phase) {
+	# check whether we're running in a Gofer server or not (see
+	# validate_FETCH_attr for details)
+	$dbh->{f_in_gofer} = (defined $INC{"DBD/Gofer.pm"} && (caller(5))[0] eq "DBI::Gofer::Execute");
 	# f_ext should not be initialized
 	# f_map is deprecated (but might return)
-	$dbh->{f_in_gofer} = (defined $INC{"DBD/Gofer.pm"} && (caller(5))[0] eq "DBI::Gofer::Execute");
 	$dbh->{f_dir}      = Cwd::abs_path (File::Spec->curdir ());
 	$dbh->{f_meta}     = {};
 	$dbh->{f_meta_map} = {}; # choose new name because it contains other keys
@@ -274,6 +276,13 @@
 {
     my ($dbh, $attrib) = @_;
 
+    # If running in a Gofer server, access to our tied compatibility hash
+    # would force Gofer to serialize the tieing object including it's
+    # private $dbh reference used to do the driver function calls.
+    # This will result in nasty exceptions. So return a copy of the
+    # f_meta structure instead, which is the source of for the compatibility
+    # tie-hash. It's not as good as liked, but the best we can do in this
+    # situation.
     if ($dbh->{f_in_gofer}) {
 	(my $drv_class = $dbh->{ImplementorClass}) =~ s/::db$//;
 	my $drv_prefix = DBI->driver_prefix ($drv_class);

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	Wed Dec 15 14:29:51 2010
@@ -448,6 +448,8 @@
     # Driver private attributes are lower cased
     if ( $attrib eq ( lc $attrib ) )
     {
+	# first let the implementation deliver an alias for the attribute to fetch
+	# after it validates the legitimation of the fetch request
         $attrib = $dbh->func( $attrib, "validate_FETCH_attr" ) or return;
 
         my $attr_prefix;