The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
CHANGES 06
META.json 22
META.yml 22
README 11
lib/Apache/Session/Store/DBI.pm 121121
lib/Apache/Session.pm 11
t/99mysql.t 517
t/99mysqllock.t 69
8 files changed (This is a version diff) 138159
@@ -3,6 +3,12 @@ If you use perl older than 5.6 - write to alexchorny[AT]gmail.com
 and tell me what version do you use, why and will you need newer versions
 of Apache::Session.
 
+1.93  2014-04-12
+  - even more test fixes
+
+1.92  2014-03-08
+  - more test fixes
+
 1.91  2014-01-07 by Alexandr Ciornii, Perl 26th birthday version
   - Add a test for RT#50896
   - 99mysql.t will work more correctly in some corner cases
@@ -40,7 +40,7 @@
    "provides" : {
       "Apache::Session" : {
          "file" : "lib/Apache/Session.pm",
-         "version" : "1.91"
+         "version" : "1.93"
       },
       "Apache::Session::DB_File" : {
          "file" : "lib/Apache/Session/DB_File.pm",
@@ -168,5 +168,5 @@
          "url" : "http://github.com/chorny/Apache-Session"
       }
    },
-   "version" : "1.91"
+   "version" : "1.93"
 }
@@ -20,7 +20,7 @@ name: Apache-Session
 provides:
   Apache::Session:
     file: lib/Apache/Session.pm
-    version: 1.91
+    version: 1.93
   Apache::Session::DB_File:
     file: lib/Apache/Session/DB_File.pm
     version: 1.01
@@ -118,4 +118,4 @@ requires:
 resources:
   license: http://dev.perl.org/licenses/
   repository: http://github.com/chorny/Apache-Session
-version: 1.91
+version: 1.93
@@ -7,7 +7,7 @@
 DESCRIPTION
 -----------
 
-This is Apache::Session 1.91
+This is Apache::Session 1.93
 
 These modules provide persistent storage for arbitrary data, in arbitrary
 backing stores.  The details of interacting with the backing store are
@@ -1,121 +1,121 @@
-#############################################################################
-#
-# Apache::Session::Store::DBI
-# A base class for the MySQL, Postgres, and other DBI stores
-# Copyright(c) 2000, 2004 Jeffrey William Baker (jwbaker@acm.org)
-# Distribute under the Perl License
-#
-############################################################################
-
-package Apache::Session::Store::DBI;
-
-use strict;
-use DBI;
-
-use vars qw($VERSION);
-
-$VERSION = '1.02';
-
-$Apache::Session::Store::DBI::TableName = "sessions";
-
-sub new {
-    my $class = shift;
-
-    return bless { table_name => $Apache::Session::Store::DBI::TableName }, $class;
-}
-
-sub insert {
-    my $self    = shift;
-    my $session = shift;
- 
-    $self->connection($session);
-
-    local $self->{dbh}->{RaiseError} = 1;
-
-    if (!defined $self->{insert_sth}) {
-        $self->{insert_sth} = 
-            $self->{dbh}->prepare_cached(qq{
-                INSERT INTO $self->{'table_name'} (id, a_session) VALUES (?,?)});
-    }
-
-    $self->{insert_sth}->bind_param(1, $session->{data}->{_session_id});
-    $self->{insert_sth}->bind_param(2, $session->{serialized});
-    
-    $self->{insert_sth}->execute;
-
-    $self->{insert_sth}->finish;
-}
-
-
-sub update {
-    my $self    = shift;
-    my $session = shift;
- 
-    $self->connection($session);
-
-    local $self->{dbh}->{RaiseError} = 1;
-
-    if (!defined $self->{update_sth}) {
-        $self->{update_sth} = 
-            $self->{dbh}->prepare_cached(qq{
-                UPDATE $self->{'table_name'} SET a_session = ? WHERE id = ?});
-    }
-
-    $self->{update_sth}->bind_param(1, $session->{serialized});
-    $self->{update_sth}->bind_param(2, $session->{data}->{_session_id});
-    
-    $self->{update_sth}->execute;
-
-    $self->{update_sth}->finish;
-}
-
-sub materialize {
-    my $self    = shift;
-    my $session = shift;
-
-    $self->connection($session);
-
-    local $self->{dbh}->{RaiseError} = 1;
-
-    if (!defined $self->{materialize_sth}) {
-        $self->{materialize_sth} = 
-            $self->{dbh}->prepare_cached(qq{
-                SELECT a_session FROM $self->{'table_name'} WHERE id = ?});
-    }
-    
-    $self->{materialize_sth}->bind_param(1, $session->{data}->{_session_id});
-    
-    $self->{materialize_sth}->execute;
-    
-    my $results = $self->{materialize_sth}->fetchrow_arrayref;
-
-    if (!(defined $results)) {
-        die "Object does not exist in the data store";
-    }
-
-    $self->{materialize_sth}->finish;
-
-    $session->{serialized} = $results->[0];
-}
-
-sub remove {
-    my $self    = shift;
-    my $session = shift;
-
-    $self->connection($session);
-
-    local $self->{dbh}->{RaiseError} = 1;
-
-    if (!defined $self->{remove_sth}) {
-        $self->{remove_sth} = 
-            $self->{dbh}->prepare_cached(qq{
-                DELETE FROM $self->{'table_name'} WHERE id = ?});
-    }
-
-    $self->{remove_sth}->bind_param(1, $session->{data}->{_session_id});
-    
-    $self->{remove_sth}->execute;
-    $self->{remove_sth}->finish;
-}
-
-1;
+#############################################################################
+#
+# Apache::Session::Store::DBI
+# A base class for the MySQL, Postgres, and other DBI stores
+# Copyright(c) 2000, 2004 Jeffrey William Baker (jwbaker@acm.org)
+# Distribute under the Perl License
+#
+############################################################################
+
+package Apache::Session::Store::DBI;
+
+use strict;
+use DBI;
+
+use vars qw($VERSION);
+
+$VERSION = '1.02';
+
+$Apache::Session::Store::DBI::TableName = "sessions";
+
+sub new {
+    my $class = shift;
+
+    return bless { table_name => $Apache::Session::Store::DBI::TableName }, $class;
+}
+
+sub insert {
+    my $self    = shift;
+    my $session = shift;
+ 
+    $self->connection($session);
+
+    local $self->{dbh}->{RaiseError} = 1;
+
+    if (!defined $self->{insert_sth}) {
+        $self->{insert_sth} = 
+            $self->{dbh}->prepare_cached(qq{
+                INSERT INTO $self->{'table_name'} (id, a_session) VALUES (?,?)});
+    }
+
+    $self->{insert_sth}->bind_param(1, $session->{data}->{_session_id});
+    $self->{insert_sth}->bind_param(2, $session->{serialized});
+    
+    $self->{insert_sth}->execute;
+
+    $self->{insert_sth}->finish;
+}
+
+
+sub update {
+    my $self    = shift;
+    my $session = shift;
+ 
+    $self->connection($session);
+
+    local $self->{dbh}->{RaiseError} = 1;
+
+    if (!defined $self->{update_sth}) {
+        $self->{update_sth} = 
+            $self->{dbh}->prepare_cached(qq{
+                UPDATE $self->{'table_name'} SET a_session = ? WHERE id = ?});
+    }
+
+    $self->{update_sth}->bind_param(1, $session->{serialized});
+    $self->{update_sth}->bind_param(2, $session->{data}->{_session_id});
+    
+    $self->{update_sth}->execute;
+
+    $self->{update_sth}->finish;
+}
+
+sub materialize {
+    my $self    = shift;
+    my $session = shift;
+
+    $self->connection($session);
+
+    local $self->{dbh}->{RaiseError} = 1;
+
+    if (!defined $self->{materialize_sth}) {
+        $self->{materialize_sth} = 
+            $self->{dbh}->prepare_cached(qq{
+                SELECT a_session FROM $self->{'table_name'} WHERE id = ?});
+    }
+    
+    $self->{materialize_sth}->bind_param(1, $session->{data}->{_session_id});
+    
+    $self->{materialize_sth}->execute;
+    
+    my $results = $self->{materialize_sth}->fetchrow_arrayref;
+
+    if (!(defined $results)) {
+        die "Object does not exist in the data store";
+    }
+
+    $self->{materialize_sth}->finish;
+
+    $session->{serialized} = $results->[0];
+}
+
+sub remove {
+    my $self    = shift;
+    my $session = shift;
+
+    $self->connection($session);
+
+    local $self->{dbh}->{RaiseError} = 1;
+
+    if (!defined $self->{remove_sth}) {
+        $self->{remove_sth} = 
+            $self->{dbh}->prepare_cached(qq{
+                DELETE FROM $self->{'table_name'} WHERE id = ?});
+    }
+
+    $self->{remove_sth}->bind_param(1, $session->{data}->{_session_id});
+    
+    $self->{remove_sth}->execute;
+    $self->{remove_sth}->finish;
+}
+
+1;
@@ -325,7 +325,7 @@ package Apache::Session;
 use strict;
 use vars qw($VERSION);
 
-$VERSION = '1.91';
+$VERSION = '1.93';
 $VERSION = eval $VERSION;
 
 #State constants
@@ -10,6 +10,10 @@ plan skip_all => "Optional modules (Test::Database, DBD::mysql, DBI) not install
                require DBI;
               };
 
+my $dbd_mysq_ver = DBD::mysql->VERSION();
+plan skip_all => "Version $dbd_mysq_ver of DBD::mysql has serious problems on Windows"
+  if ($^O eq 'MSWin32' && $dbd_mysq_ver >= '4.021' && $dbd_mysq_ver <= '4.023');
+
 if ($ENV{TRAVIS}) {
     my $cfg = << 'EOT';
     driver_dsn  = dbi:mysql:
@@ -23,17 +27,22 @@ my @db_handles = Test::Database->handles('mysql');
 plan skip_all => "No mysql handle reported by Test::Database"
   unless @db_handles;
 
-plan tests => 23;
-
-my $package = 'Apache::Session::MySQL';
-use_ok $package;
-
 my $mysql = $db_handles[0];
 my $dsn = $mysql->dsn();
 my $uname = $mysql->username();
 my $upass = $mysql->password();
+diag "DBD::mysql version ".DBD::mysql->VERSION();
+
+plan skip_all => "Test::Database handle->driver is undef. Probably it was not possible to establish connection."
+  if !defined($mysql->driver);
+
 diag "Mysql version ".$mysql->driver->version;
 
+plan tests => 23;
+
+my $package = 'Apache::Session::MySQL';
+use_ok $package;
+
 my @tables_used = qw/sessions s/;
 sub drop_tables {
     my $dbh = shift;
@@ -43,7 +52,10 @@ sub drop_tables {
       my $ary_ref = $dbh->selectcol_arrayref('SHOW TABLES');
       $dblist = join(', ', @$ary_ref);
       diag "Found foreign key constraint, trying to drop all tables from DB";
+      
+      $dbh->do("SET foreign_key_checks = 0");
       $dbh->do("DROP TABLE IF EXISTS $dblist");
+      $dbh->do("SET foreign_key_checks = 1");
     }
 }
 
@@ -22,16 +22,20 @@ my @db_handles = Test::Database->handles('mysql');
 plan skip_all => "No mysql handle reported by Test::Database"
   unless @db_handles;
 
-plan tests => 4;
-
-my $package = 'Apache::Session::Lock::MySQL';
-use_ok $package;
-
 my $mysql = $db_handles[0];
 my $dsn = $mysql->dsn();
 my $uname = $mysql->username();
 my $upass = $mysql->password();
 
+my $dbh  = DBI->connect($dsn, $uname, $upass);
+plan skip_all => "Cannot connect to DB specified in Test::Database config"
+  unless $dbh;
+
+plan tests => 4;
+
+my $package = 'Apache::Session::Lock::MySQL';
+use_ok $package;
+
 my $session = {
     args => {
         LockDataSource => $dsn,
@@ -44,7 +48,6 @@ my $session = {
 };
 
 my $lock = $package->new;
-my $dbh  = DBI->connect($dsn, $uname, $upass, {RaiseError => 1});
 my $sth  = $dbh->prepare(q{SELECT GET_LOCK('Apache-Session-09876543210987654321098765432109', 0)});
 my $sth2 = $dbh->prepare(q{SELECT RELEASE_LOCK('Apache-Session-09876543210987654321098765432109')});