Author: hmbrand
Date: Wed Apr 28 05:59:45 2010
New Revision: 13933

Modified:
   dbi/trunk/Changes
   dbi/trunk/lib/DBD/File.pm

Log:
Thread owner check already done on DBI level.

You're right. I didn't check this before and I didn't check whether this
feature is in DBI::PurePerl (grepping for 'thread' in lib/DBI/PurePerl.pm
didn't find anything, but I didn't review the code). I also miss a test
which proves that it works.

For this release, the patch which takes the p_thread stuff out of DBD::File
is attached. After it, some action seems required ...

Jens

Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Wed Apr 28 05:59:45 2010
@@ -14,7 +14,7 @@
     thanks to Vernon Lyon.
   Fixed DBI->trace(0, *STDERR); (H.Merijn Brand)
     which tried to open a file named "*main::STDERR" in perl-5.10.x
-  Fixes in DBD::File and DBD::DBM for use under threads (Jens Rehsack)
+  Fixes in DBD::DBM for use under threads (Jens Rehsack)
 
   Changed "Issuing rollback() due to DESTROY without explicit disconnect"
     warning to not be issued if ReadOnly set for that dbh.

Modified: dbi/trunk/lib/DBD/File.pm
==============================================================================
--- dbi/trunk/lib/DBD/File.pm   (original)
+++ dbi/trunk/lib/DBD/File.pm   Wed Apr 28 05:59:45 2010
@@ -123,9 +123,6 @@
 package DBD::File::dr;
 
 use strict;
-use Config;
-
-our $threadid = 0;       # holds private thread id of driver
 
 $DBD::File::dr::imp_data_size = 0;
 
@@ -174,8 +171,7 @@
            sql_statement_version => 1, # S:S version
            };
        }
-    $this->STORE (Active     => 1);
-    $this->STORE (p_threadid => $threadid);
+    $this->STORE (Active => 1);
     return set_versions ($this);
     } # connect
 
@@ -231,12 +227,6 @@
 {
     } # disconnect_all
 
-sub CLONE
-{
-    $Config{usethreads} && $INC{"threads.pm"} and
-       $threadid = threads->tid ();
-    } # CLONE
-
 sub DESTROY
 {
     undef;
@@ -260,10 +250,6 @@
 {
     my ($dbh, $statement, @attribs) = @_;
 
-    my $ownerid = $dbh->FETCH ("p_threadid");
-    $ownerid == $DBD::File::dr::threadid or
-       croak "database handle is owned by thread $ownerid and this is 
$DBD::File::dr::threadid";
-
     # create a 'blank' sth
     my $sth = DBI::_new_sth ($dbh, {Statement => $statement});
 
@@ -298,7 +284,6 @@
            $sth->STORE ("f_stmt", $stmt);
            $sth->STORE ("f_params", []);
            $sth->STORE ("NUM_OF_PARAMS", scalar ($stmt->params ()));
-           $sth->STORE ("p_threadid", $DBD::File::dr::threadid);
            }
        }
     return $sth;

Reply via email to