Skip to Content.
Sympa Menu

devel - Re: [sympa-dev] problem with postgres

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Olivier Salaun - CRU <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-dev] problem with postgres
  • Date: Fri, 01 Oct 1999 15:11:42 +0200

We've tested database interruption with MySQL and $db->{Active} doesn't
seem to tell anything about the connection state.

Olivier Lacroix proposed a patch (below) to use ping() for testing
database connectivity.

We've validated it, it has been applied on the development version.


While doing these crashtests, I discovered incorrect error handling in
Commands.pm when sympa can't perform a SQL query. Result of
&List::get_first_user is not tested for undef value.


Thanks

Olivier Salaün
*** List.pm.orig Thu Sep 30 10:40:41 1999
--- List.pm Fri Oct 1 12:20:59 1999
***************
*** 968,974 ****
my $statement;

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 968,974 ----
my $statement;

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}

***************
*** 1038,1044 ****
my $statement;

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 1038,1044 ----
my $statement;

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}

***************
*** 1076,1082 ****
my $date_field = sprintf $date_format{'read'}{$Conf{'db_type'}},
'date_subscriber';

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 1076,1082 ----
my $date_field = sprintf $date_format{'read'}{$Conf{'db_type'}},
'date_subscriber';

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}

***************
*** 1124,1130 ****
my $date_field = sprintf $date_format{'read'}{$Conf{'db_type'}},
'date_subscriber';

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 1124,1130 ----
my $date_field = sprintf $date_format{'read'}{$Conf{'db_type'}},
'date_subscriber';

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}

***************
*** 1192,1198 ****
my $statement;

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 1192,1198 ----
my $statement;

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}

***************
*** 1229,1235 ****
my $name = $self->{'name'};

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 1229,1235 ----
my $name = $self->{'name'};

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}

***************
*** 1288,1294 ****
password => 'user_table');

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 1288,1294 ----
password => 'user_table');

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}

***************
*** 1359,1365 ****
);

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 1359,1365 ----
);

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}

***************
*** 1408,1414 ****
);

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 1408,1414 ----
);

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}

***************
*** 1453,1459 ****
my $statement;

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 1453,1459 ----
my $statement;

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}

***************
*** 2883,2889 ****
my ($statement, $sth);

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 2883,2889 ----
my ($statement, $sth);

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}

***************
*** 3077,3083 ****
my ($l, %which, $statement);

## Check database connection
! unless ($dbh and $dbh->{Active}) {
return undef unless &db_connect();
}

--- 3077,3083 ----
my ($l, %which, $statement);

## Check database connection
! unless ($dbh and $dbh->ping) {
return undef unless &db_connect();
}



  • Re: [sympa-dev] problem with postgres, Olivier Salaun - CRU, 10/01/1999

Archive powered by MHonArc 2.6.19+.

Top of Page