log.pl
branchpgsql
changeset 111 1898ce7c3fd3
parent 104 0f38b3fd6c84
equal deleted inserted replaced
110:86504771a173 111:1898ce7c3fd3
    54 #| stamp | timestamp(14) | YES  |     | NULL    |                |
    54 #| stamp | timestamp(14) | YES  |     | NULL    |                |
    55 #+-------+---------------+------+-----+---------+----------------+
    55 #+-------+---------------+------+-----+---------+----------------+
    56 
    56 
    57 my $ME = basename $0;
    57 my $ME = basename $0;
    58 
    58 
    59 my $DSN  = "DBI:mysql:logbuch:pu.schlittermann.de";
    59 my $DSN  = $config::dbDSN;
    60 my $USER = "logbuch";
    60 my $USER = $config::dbUser;
    61 my $PW   = "HIDDEN";
    61 my $PW   = $config::dbPass;
    62 
    62 
    63 my $EDITOR   = $ENV{VISUAL} || $ENV{EDITOR} || "vim";
    63 my $EDITOR   = $ENV{VISUAL} || $ENV{EDITOR} || "vim";
    64 my $MAGIC    = "#--- all changes below are ignored ---#\n";
    64 my $MAGIC    = "#--- all changes below are ignored ---#\n";
    65 my $NODENAME = (split /\./, hostname)[0];
    65 my $NODENAME = (split /\./, hostname)[0];
    66 
    66 
   250         truncate $fh, $pos;
   250         truncate $fh, $pos;
   251         seek $fh, 0, 2;
   251         seek $fh, 0, 2;
   252 
   252 
   253         if ($opt_db and $Dbh) {
   253         if ($opt_db and $Dbh) {
   254             my $sth = $Dbh->prepare("
   254             my $sth = $Dbh->prepare("
   255 		    INSERT INTO log (host, date, user, mailto, text)
   255 		    INSERT INTO log (host, date, \"user\", mailto, text)
   256 		    VALUES(?, now(), ?, ?, ?)");
   256 		    VALUES(?, now(), ?, ?, ?)");
   257             $sth->execute(full_hostname(), $user, $mailto, $text);
   257             $sth->execute(full_hostname(), $user, $mailto, $text);
   258             print STDERR "Database entry inserted\n";
   258             print STDERR "Database entry inserted\n";
   259         }
   259         }
   260 
   260