Changeset 151 for branches


Ignore:
Timestamp:
02/04/05 11:04:55 (20 years ago)
Author:
Kris Deugau
Message:

/branches/stable

More bugfixes and error-trapping to make sure we don't just
crash and burn with a cryptic error code when the billing DB is down.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/cgi-bin/CustIDCK.pm

    r114 r151  
    3838    local $SIG{ALRM} = sub { die "failed connection to billing!!" };
    3939    alarm 3;    # 3-second timeout.  This may be too aggressive.
    40     $dbh = DBI->connect ("DBI:Pg:host=billing;dbname=custids", "cidcheck", "c1dch4ck");
     40
     41    eval {
     42      $dbh = DBI->connect ("DBI:Pg:host=billing;dbname=custids", "cidcheck", "c1dch4ck");
     43      die "failed connection to billing!!" if !$dbh;
     44# Not certain if this is needed here.  It doesn't seem to be.
     45#      $dbh->ping;      # Gotta do this to "force" a "failure".  NRGH.
     46    };
    4147    alarm 0;    # cancel the alarm
     48    $dbh->ping; # Gotta do this to "force" a "failure".  NRGH.
    4249  };
    4350  alarm 0;      # avoid race conditions.  May not be needed here.  (Hah!)
     
    4855  }
    4956
    50   my $sth = $dbh->prepare("SELECT custid FROM custid WHERE custid = '$custid';");
     57  # We should have a valid DB connection by now.
     58  my $sth = $dbh->prepare("SELECT custid FROM custid WHERE custid = '$custid'");
    5159  $sth->execute;
    5260  if ($dbh->err) {
Note: See TracChangeset for help on using the changeset viewer.