---
Changes | 3 +++
Pg.pm | 74 ++++++++++++++++++++++++++++++++++-------------------------------
2 files changed, 42 insertions(+), 35 deletions(-)
diff --git a/Changes b/Changes
index c2d484f..c16483b 100644
--- a/Changes
+++ b/Changes
@@ -51,6 +51,9 @@ Version 3.0.0?
- Adjust test to use 3 digit exponential values (CPAN bug #59449)
+ - Avoid reinstalling driver methods in threads (CPAN bug #83638)
+ [Dagfinn Ilmari Mannsåker]
+
Version 2.19.3 Released August 21, 2012 (git commit be018f10fdaf4163f98affcb7244046e8f47420d)
- Fix bug in pg_st_split_statement causing segfaults
diff --git a/Pg.pm b/Pg.pm
index 7f73e06..7ddffda 100644
--- a/Pg.pm
+++ b/Pg.pm
@@ -107,6 +107,7 @@ use 5.008004;
return 'pg_catalog.';
}
+ my $methods_are_installed = 0;
sub driver {
return $drh if defined $drh;
my($class, $attr) = @_;
@@ -122,41 +123,44 @@ use 5.008004;
'Attribution' => "DBD::Pg $VERSION by Greg Sabino Mullane and others",
});
-
- DBD::Pg::db->install_method('pg_cancel');
- DBD::Pg::db->install_method('pg_endcopy');
- DBD::Pg::db->install_method('pg_getline');
- DBD::Pg::db->install_method('pg_getcopydata');
- DBD::Pg::db->install_method('pg_getcopydata_async');
- DBD::Pg::db->install_method('pg_notifies');
- DBD::Pg::db->install_method('pg_putcopydata');
- DBD::Pg::db->install_method('pg_putcopyend');
- DBD::Pg::db->install_method('pg_ping');
- DBD::Pg::db->install_method('pg_putline');
- DBD::Pg::db->install_method('pg_ready');
- DBD::Pg::db->install_method('pg_release');
- DBD::Pg::db->install_method('pg_result'); ## NOT duplicated below!
- DBD::Pg::db->install_method('pg_rollback_to');
- DBD::Pg::db->install_method('pg_savepoint');
- DBD::Pg::db->install_method('pg_server_trace');
- DBD::Pg::db->install_method('pg_server_untrace');
- DBD::Pg::db->install_method('pg_type_info');
-
- DBD::Pg::st->install_method('pg_cancel');
- DBD::Pg::st->install_method('pg_result');
- DBD::Pg::st->install_method('pg_ready');
-
- DBD::Pg::db->install_method('pg_lo_creat');
- DBD::Pg::db->install_method('pg_lo_open');
- DBD::Pg::db->install_method('pg_lo_write');
- DBD::Pg::db->install_method('pg_lo_read');
- DBD::Pg::db->install_method('pg_lo_lseek');
- DBD::Pg::db->install_method('pg_lo_tell');
- DBD::Pg::db->install_method('pg_lo_close');
- DBD::Pg::db->install_method('pg_lo_unlink');
- DBD::Pg::db->install_method('pg_lo_import');
- DBD::Pg::db->install_method('pg_lo_import_with_oid');
- DBD::Pg::db->install_method('pg_lo_export');
+ if (!$methods_are_installed) {
+ DBD::Pg::db->install_method('pg_cancel');
+ DBD::Pg::db->install_method('pg_endcopy');
+ DBD::Pg::db->install_method('pg_getline');
+ DBD::Pg::db->install_method('pg_getcopydata');
+ DBD::Pg::db->install_method('pg_getcopydata_async');
+ DBD::Pg::db->install_method('pg_notifies');
+ DBD::Pg::db->install_method('pg_putcopydata');
+ DBD::Pg::db->install_method('pg_putcopyend');
+ DBD::Pg::db->install_method('pg_ping');
+ DBD::Pg::db->install_method('pg_putline');
+ DBD::Pg::db->install_method('pg_ready');
+ DBD::Pg::db->install_method('pg_release');
+ DBD::Pg::db->install_method('pg_result'); ## NOT duplicated below!
+ DBD::Pg::db->install_method('pg_rollback_to');
+ DBD::Pg::db->install_method('pg_savepoint');
+ DBD::Pg::db->install_method('pg_server_trace');
+ DBD::Pg::db->install_method('pg_server_untrace');
+ DBD::Pg::db->install_method('pg_type_info');
+
+ DBD::Pg::st->install_method('pg_cancel');
+ DBD::Pg::st->install_method('pg_result');
+ DBD::Pg::st->install_method('pg_ready');
+
+ DBD::Pg::db->install_method('pg_lo_creat');
+ DBD::Pg::db->install_method('pg_lo_open');
+ DBD::Pg::db->install_method('pg_lo_write');
+ DBD::Pg::db->install_method('pg_lo_read');
+ DBD::Pg::db->install_method('pg_lo_lseek');
+ DBD::Pg::db->install_method('pg_lo_tell');
+ DBD::Pg::db->install_method('pg_lo_close');
+ DBD::Pg::db->install_method('pg_lo_unlink');
+ DBD::Pg::db->install_method('pg_lo_import');
+ DBD::Pg::db->install_method('pg_lo_import_with_oid');
+ DBD::Pg::db->install_method('pg_lo_export');
+
+ $methods_are_installed++;
+ }
return $drh;
--
1.8.1.2