r19996 - in /branches/upstream/libapache-dbi-perl/current: Changes META.yml README TODO lib/Apache/AuthDBI.pm lib/Apache/DBI.pm

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Fri May 16 13:08:15 UTC 2008


Author: gregoa
Date: Fri May 16 13:08:15 2008
New Revision: 19996

URL: http://svn.debian.org/wsvn/?sc=1&rev=19996
Log:
[svn-upgrade] Integrating new upstream version, libapache-dbi-perl (1.07)

Modified:
    branches/upstream/libapache-dbi-perl/current/Changes
    branches/upstream/libapache-dbi-perl/current/META.yml
    branches/upstream/libapache-dbi-perl/current/README
    branches/upstream/libapache-dbi-perl/current/TODO
    branches/upstream/libapache-dbi-perl/current/lib/Apache/AuthDBI.pm
    branches/upstream/libapache-dbi-perl/current/lib/Apache/DBI.pm

Modified: branches/upstream/libapache-dbi-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libapache-dbi-perl/current/Changes?rev=19996&op=diff
==============================================================================
--- branches/upstream/libapache-dbi-perl/current/Changes (original)
+++ branches/upstream/libapache-dbi-perl/current/Changes Fri May 16 13:08:15 2008
@@ -1,4 +1,17 @@
 Revision history for ApacheDBI.
+
+1.07 05/09/2008
+  - http://rt.cpan.org/Public/Bug/Display.html?id=31003
+    Submitted by: diafour at gmail.com 
+    Tweaked by: Philip M. Gollucci <pgollucci at p6m7g8.com>
+
+  - http://rt.cpan.org/Public/Bug/Display.html?id=29209
+    PerlCleanupHandler doesn't get called with MP2
+    Submitted by: nick.aevum.de <nick at aevum.de> 
+
+  - http://rt.cpan.org/Public/Bug/Display.html?id=28824
+    Documentation Additions
+    Submitted by: [Perrin Hawkins <perrin at elem.com>]
 
 1.06 03/23/2007
   - MP2/AuthDBI: Fixed Apache::AuthDBI::debug() to 

Modified: branches/upstream/libapache-dbi-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libapache-dbi-perl/current/META.yml?rev=19996&op=diff
==============================================================================
--- branches/upstream/libapache-dbi-perl/current/META.yml (original)
+++ branches/upstream/libapache-dbi-perl/current/META.yml Fri May 16 13:08:15 2008
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Apache-DBI
-version:      1.06
+version:      1.07
 version_from: lib/Apache/DBI.pm
 installdirs:  site
 requires:

Modified: branches/upstream/libapache-dbi-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libapache-dbi-perl/current/README?rev=19996&op=diff
==============================================================================
--- branches/upstream/libapache-dbi-perl/current/README (original)
+++ branches/upstream/libapache-dbi-perl/current/README Fri May 16 13:08:15 2008
@@ -1,7 +1,7 @@
 DESCRIPTION:
 ------------
 
-This is version 1.06 of Apache::AuthDBI and Apache::DBI.
+This is version 1.07 of Apache::AuthDBI and Apache::DBI.
 
 These modules are supposed to be used with the Apache server together with 
 an embedded perl interpreter like mod_perl. They provide support for basic 

Modified: branches/upstream/libapache-dbi-perl/current/TODO
URL: http://svn.debian.org/wsvn/branches/upstream/libapache-dbi-perl/current/TODO?rev=19996&op=diff
==============================================================================
--- branches/upstream/libapache-dbi-perl/current/TODO (original)
+++ branches/upstream/libapache-dbi-perl/current/TODO Fri May 16 13:08:15 2008
@@ -1,9 +1,9 @@
 
-Showstoppers for 1.06:
+Showstoppers for 1.07:
 ----------------------
-Migrate test suite to 1.06
+Migrate test suite to 1.07
 
-Nice to have for 1.06:
+Nice to have for 1.07:
 -----------------------
 Add tests for other DBDs starting with PostgreSQL.
 

Modified: branches/upstream/libapache-dbi-perl/current/lib/Apache/AuthDBI.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libapache-dbi-perl/current/lib/Apache/AuthDBI.pm?rev=19996&op=diff
==============================================================================
--- branches/upstream/libapache-dbi-perl/current/lib/Apache/AuthDBI.pm (original)
+++ branches/upstream/libapache-dbi-perl/current/lib/Apache/AuthDBI.pm Fri May 16 13:08:15 2008
@@ -1,7 +1,7 @@
-# $Id: AuthDBI.pm 9303 2007-03-23 08:56:44Z pgollucci at p6m7g8.com $
+# $Id: AuthDBI.pm 11230 2008-05-09 22:46:56Z pgollucci at p6m7g8.com $
 package Apache::AuthDBI;
 
-$Apache::AuthDBI::VERSION = '1.06';
+$Apache::AuthDBI::VERSION = '1.07';
 
 # 1: report about cache miss
 # 2: full debug output
@@ -13,8 +13,10 @@
 BEGIN {
   my @constants = qw( OK AUTH_REQUIRED FORBIDDEN DECLINED SERVER_ERROR );
   if (MP2) {
-		require Apache2::Access;
+	require Apache2::Access;
     require Apache2::Const;
+    require Apache2::RequestRec;
+    require Apache2::Log;
     import Apache2::Const @constants;
   }
   else {

Modified: branches/upstream/libapache-dbi-perl/current/lib/Apache/DBI.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libapache-dbi-perl/current/lib/Apache/DBI.pm?rev=19996&op=diff
==============================================================================
--- branches/upstream/libapache-dbi-perl/current/lib/Apache/DBI.pm (original)
+++ branches/upstream/libapache-dbi-perl/current/lib/Apache/DBI.pm Fri May 16 13:08:15 2008
@@ -1,4 +1,4 @@
-# $Id: DBI.pm 9303 2007-03-23 08:56:44Z pgollucci at p6m7g8.com $
+# $Id: DBI.pm 11230 2008-05-09 22:46:56Z pgollucci at p6m7g8.com $
 package Apache::DBI;
 use strict;
 
@@ -9,6 +9,7 @@
     if (MP2) {
         require mod_perl2;
         require Apache2::Module;
+        require Apache2::RequestUtil;
         require Apache2::ServerUtil;
     }
     elsif (defined $modperl::VERSION && $modperl::VERSION > 1 &&
@@ -21,7 +22,7 @@
 
 require_version DBI 1.00;
 
-$Apache::DBI::VERSION = '1.06';
+$Apache::DBI::VERSION = '1.07';
 
 # 1: report about new connect
 # 2: full debug output
@@ -137,18 +138,21 @@
     # script has finished if AutoCommit is off.  however, cleanup can only
     # be determined at end of handle life as begin_work may have been called
     # to temporarily turn off AutoCommit.
-    if (!$Rollback{$Idx} and Apache->can('push_handlers')) {
-        debug(2, "$prefix push PerlCleanupHandler");
+    if (!$Rollback{$Idx}) {
+        my $r;
         if (MP2) {
-            my $s = Apache2::ServerUtil->server;
-            $s->push_handlers("PerlCleanupHandler", sub { cleanup($Idx) });
-        }
-        else {
-            Apache->push_handlers("PerlCleanupHandler", sub { cleanup($Idx) });
-        }
-        # make sure, that the rollback is called only once for every
-        # request, even if the script calls connect more than once
-        $Rollback{$Idx} = 1;
+            $r = Apache2::RequestUtil->request;
+        }
+        elsif (Apache->can('push_handlers')) {
+            $r = 'Apache';
+        }
+        if ($r) {
+            debug(2, "$prefix push PerlCleanupHandler");
+            $r->push_handlers("PerlCleanupHandler", sub { cleanup($Idx) });
+            # make sure, that the rollback is called only once for every
+            # request, even if the script calls connect more than once
+            $Rollback{$Idx} = 1;
+        }
     }
 
     # do we need to ping the database ?
@@ -373,9 +377,9 @@
  http://dbi.perl.org/
 
 When loading the DBI module (do not confuse this with the Apache::DBI module)
-it looks if the environment variable GATEWAY_INTERFACE starts with 'CGI-Perl'
+it checks if the environment variable 'MOD_PERL' has been set
 and if the module Apache::DBI has been loaded. In this case every connect
-request will be forwarded to the Apache::DBI module. This looks if a database
+request will be forwarded to the Apache::DBI module. This checks if a database
 handle from a previous connect request is already stored and if this handle is
 still valid using the ping method. If these two conditions are fulfilled it
 just returns the database handle. The parameters defining the connection have
@@ -386,14 +390,18 @@
 because the Apache::DBI module overloads the disconnect method.
 
 The Apache::DBI module still has a limitation: it keeps database connections
-persistent on a per process basis. The problem is, if a user accesses several
-times a database, the http requests will be handled very likely by different
-servers. Every server needs to do its own connect. It would be nice, if all
-servers could share the database handles. Currently this is not possible,
-because of the distinct name-space of every process. Also it is not possible
-to create a database handle upon startup of the httpd and then inheriting this
+persistent on a per process basis. The problem is, if a user accesses a database
+several times, the http requests will be handled very likely by different
+processes. Every process needs to do its own connect. It would be nice if all
+servers could share the database handles, but currently this is not possible
+because of the distinct memory-space of each process. Also it is not possible
+to create a database handle upon startup of the httpd and then inherit this
 handle to every subsequent server. This will cause clashes when the handle is
-used by two processes at the same time.
+used by two processes at the same time.  Apache::DBI has built-in protection
+against this.  It will not make a connection persistent if it sees that it is
+being opened during the server startup.  This allows you to safely open a connection
+for grabbing data needed at startup and disconnect it normally before the end of
+startup.
 
 With this limitation in mind, there are scenarios, where the usage of
 Apache::DBI is depreciated. Think about a heavy loaded Web-site where every
@@ -402,15 +410,15 @@
 time this would kill the web server.
 
 Another problem are timeouts: some databases disconnect the client after a
-certain time of inactivity. The module tries to validate the database handle
-using the ping-method of the DBI-module. This method returns true as default.
-If the database handle is not valid and the driver has no implementation for
-the ping method, you will get an error when accessing the database. As a
-work-around you can try to replace the ping method by any database command,
-which is cheap and safe or you can deactivate the usage of the ping method
-(see CONFIGURATION below).
-
-Here is generalized ping method, which can be added to the driver module:
+certain period of inactivity. The module tries to validate the database handle
+using the C<ping()> method of the DBI-module. This method returns true by default.
+Most DBI drivers have a working C<ping()> method, but if the driver you're using
+doesn't have one and the database handle is no longer valid, you will get an error
+when accessing the database. As a work-around you can try to add your own C<ping()>
+method using any database command which is cheap and safe, or you can deactivate the
+usage of the ping method (see CONFIGURATION below).
+
+Here is a generalized ping method, which can be added to the driver module:
 
    package DBD::xxx::db; # ====== DATABASE ======
    use strict;
@@ -430,12 +438,12 @@
 Transactions: a standard DBI script will automatically perform a rollback
 whenever the script exits. In the case of persistent database connections,
 the database handle will not be destroyed and hence no automatic rollback
-occurs. At a first glance it seems even to be possible, to handle a transaction
+will occur. At a first glance it even seems possible to handle a transaction
 over multiple requests. But this should be avoided, because different
-requests are handled by different servers and a server does not know the state
-of a specific transaction which has been started by another server. In general
+requests are handled by different processes and a process does not know the state
+of a specific transaction which has been started by another process. In general,
 it is good practice to perform an explicit commit or rollback at the end of
-every script. In order to avoid inconsistencies in the database in case
+every request. In order to avoid inconsistencies in the database in case
 AutoCommit is off and the script finishes without an explicit rollback, the
 Apache::DBI module uses a PerlCleanupHandler to issue a rollback at the
 end of every request. Note, that this CleanupHandler will only be used, if
@@ -447,8 +455,8 @@
 This module plugs in a menu item for Apache::Status or Apache2::Status.
 The menu lists the current database connections. It should be considered
 incomplete because of the limitations explained above. It shows the current
-database connections for one specific server, the one which happens to serve
-the current request.  Other servers might have other database connections.
+database connections for one specific process, the one which happens to serve
+the current request.  Other processes might have other database connections.
 The Apache::Status/Apache2::Status module has to be loaded before the
 Apache::DBI module !
 
@@ -461,7 +469,7 @@
 
 It is important, to load this module before any other modules using DBI !
 
-A common usage is to load the module in a startup file via the PerlRequire
+A common usage is to load the module in a startup file called via the PerlRequire
 directive. See eg/startup.pl and eg/startup2.pl for examples.
 
 There are two configurations which are server-specific and which can be done
@@ -494,7 +502,7 @@
 
 =head2 MOD_PERL 2.0
 
-Apache::DBI version 0.96 and should work under mod_perl 2.0 RC5 and later
+Apache::DBI version 0.96 and later should work under mod_perl 2.0 RC5 and later
 with httpd 2.0.49 and later.
 
 Apache::DBI versions less than 1.00 are NO longer supported.  Additionally, 
@@ -503,12 +511,23 @@
 =head2 MOD_PERL 1.0
 Note that this module needs mod_perl-1.08 or higher, apache_1.3.0 or higher
 and that mod_perl needs to be configured with the appropriate call-back hooks:
+  
+  PERL_CHILD_INIT=1 PERL_STACKED_HANDLERS=1
 
 Apache::DBI v0.94 was the last version before dual mod_perl 2.x support was begun.
 It still recommened that you use the latest version of Apache::DBI because Apache::DBI
 versions less than 1.00 are NO longer supported.
 
-  PERL_CHILD_INIT=1 PERL_STACKED_HANDLERS=1.
+=head1 DO YOU NEED THIS MODULE?
+
+Note that this module is intended for use in porting existing DBI code to mod_perl,
+or writing code that can run under both mod_perl and CGI.  If you are using a
+database abstraction layer such as Class::DBI or DBIx::Class that already manages persistent connections for you, there is no need to use this module
+in addition.  (Another popular choice, Rose::DB::Object, can cooperate with
+Apache::DBI or use your own custom connection handling.)  If you are developing
+new code that is strictly for use in mod_perl, you may choose to use
+C<< DBI->connect_cached() >> instead, but consider adding an automatic rollback
+after each request, as described above.
 
 =head1 SEE ALSO
 




More information about the Pkg-perl-cvs-commits mailing list