|
From: Bob T. <bt...@us...> - 2005-03-30 15:16:11
|
Update of /cvsroot/benson/benson3/src/perl/Benson/lib/Benson/Handlers/Network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11413/src/perl/Benson/lib/Benson/Handlers/Network Modified Files: Acknowledge.pm Alertlist.pm Submit.pm Update.pm Log Message: Only opening up one db handle per process...slight better. Index: Acknowledge.pm =================================================================== RCS file: /cvsroot/benson/benson3/src/perl/Benson/lib/Benson/Handlers/Network/Acknowledge.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Acknowledge.pm 22 Dec 2001 01:51:24 -0000 1.3 --- Acknowledge.pm 30 Mar 2005 15:15:33 -0000 1.4 *************** *** 22,32 **** # Database Connection Code # ! $dbh = DBI->connect($s->DBIConnectString, $s->DBIUsername, $s->DBIPassword); ! $s->trace("Database handle for ".$s->DBIConnectString." is ".$dbh, 3); ! if($dbh eq undef) { ! $s->log("(DBI error) Connection to the database ".$s->DBIConnectString." failed.", FATAL); ! return ERROR; ! } # --- 22,34 ---- # Database Connection Code # ! # $dbh = DBI->connect($s->DBIConnectString, $s->DBIUsername, $s->DBIPassword); ! # $s->trace("Database handle for ".$s->DBIConnectString." is ".$dbh, 3); ! # if($dbh eq undef) { ! # $s->log("(DBI error) Connection to the database ".$s->DBIConnectString." failed.", FATAL); ! # return ERROR; ! # } ! ! $dbh = $s->dbhandle; # *************** *** 57,61 **** # Disconnect from the database # ! $dbh->disconnect(); return OK; } --- 59,63 ---- # Disconnect from the database # ! # $dbh->disconnect(); return OK; } Index: Alertlist.pm =================================================================== RCS file: /cvsroot/benson/benson3/src/perl/Benson/lib/Benson/Handlers/Network/Alertlist.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** Alertlist.pm 12 Feb 2002 02:44:33 -0000 1.8 --- Alertlist.pm 30 Mar 2005 15:15:33 -0000 1.9 *************** *** 49,59 **** # Database Connection Code # ! my $dbh = DBI->connect($s->DBIConnectString, $s->DBIUsername, $s->DBIPassword); ! $s->trace("Database handle for ".$s->DBIConnectString." is ".$dbh, 3); ! if($dbh eq undef) { ! $s->log("(DBI error) Connection to the database ".$s->DBIConnectString." failed.", FATAL); ! return \%header; ! } # --- 49,61 ---- # Database Connection Code # ! # my $dbh = DBI->connect($s->DBIConnectString, $s->DBIUsername, $s->DBIPassword); ! # $s->trace("Database handle for ".$s->DBIConnectString." is ".$dbh, 3); ! # if($dbh eq undef) { ! # $s->log("(DBI error) Connection to the database ".$s->DBIConnectString." failed.", FATAL); ! # return \%header; ! # } ! ! my $dbh = $s->dbhandle; # *************** *** 88,92 **** # We are finished with database, kill the connection. # ! $dbh->disconnect(); # --- 90,94 ---- # We are finished with database, kill the connection. # ! # $dbh->disconnect(); # Index: Submit.pm =================================================================== RCS file: /cvsroot/benson/benson3/src/perl/Benson/lib/Benson/Handlers/Network/Submit.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** Submit.pm 2 Aug 2004 19:18:26 -0000 1.6 --- Submit.pm 30 Mar 2005 15:15:33 -0000 1.7 *************** *** 87,100 **** my $rc = 0; ! $dbh = DBI->connect($s->DBIConnectString, ! $s->DBIUsername, ! $s->DBIPassword); ! if($dbh eq undef) { ! $s->log("(DBI error) Connection to the database ".$s->DBIConnectString." failed.", FATAL); ! return 1; ! } $rc = insert_into_database($a); # FIXME: We don't check. ! $dbh->disconnect(); if($rc) { # We have failed --- 87,101 ---- my $rc = 0; ! # $dbh = DBI->connect($s->DBIConnectString, ! # $s->DBIUsername, ! # $s->DBIPassword); ! # if($dbh eq undef) { ! # $s->log("(DBI error) Connection to the database ".$s->DBIConnectString." failed.", FATAL); ! # return 1; ! # } ! $dbh = $s->dbhandle; $rc = insert_into_database($a); # FIXME: We don't check. ! # $dbh->disconnect(); if($rc) { # We have failed Index: Update.pm =================================================================== RCS file: /cvsroot/benson/benson3/src/perl/Benson/lib/Benson/Handlers/Network/Update.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** Update.pm 26 Nov 2003 00:14:20 -0000 1.5 --- Update.pm 30 Mar 2005 15:15:33 -0000 1.6 *************** *** 36,46 **** # Database Connection Code # ! $dbh = DBI->connect($s->DBIConnectString, $s->DBIUsername, $s->DBIPassword); ! $s->trace("Database handle for ".$s->DBIConnectString." is ".$dbh, 3); ! if($dbh eq undef) { ! $s->log("(DBI error) Connection to the database ".$s->DBIConnectString." failed.", FATAL); ! return ERROR; ! } # --- 36,48 ---- # Database Connection Code # ! # $dbh = DBI->connect($s->DBIConnectString, $s->DBIUsername, $s->DBIPassword); ! # $s->trace("Database handle for ".$s->DBIConnectString." is ".$dbh, 3); ! # if($dbh eq undef) { ! # $s->log("(DBI error) Connection to the database ".$s->DBIConnectString." failed.", FATAL); ! # return ERROR; ! # } ! ! $dbh = $s->dbhandle; # *************** *** 90,94 **** # Disconnect from the database # ! $dbh->disconnect(); return OK; } --- 92,96 ---- # Disconnect from the database # ! # $dbh->disconnect(); return OK; } |