IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 7, 2009, 12:45:24 PM (17 years ago)
Author:
eugene
Message:

update from mainline

Location:
branches/eam_branches/20090715
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090715

  • branches/eam_branches/20090715/arclog/arclog.pl

    r20224 r25022  
    1919use Pod::Usage qw( pod2usage );
    2020
    21 my ($email);
     21my ($debug, $email);
    2222
    2323GetOptions(
    24     'email|s=s'    => \$email,
     24    'debug|d'   => \$debug,
     25    'email|s=s' => \$email,
    2526) || pod2usage( 2 );
    2627
     
    4041die "can not open logdb" unless $dbh;
    4142
    42 $dbh->do("CREATE TABLE IF NOT EXISTS log(record TEXT, PRIMARY KEY(record))")
     43$dbh->do("CREATE TABLE IF NOT EXISTS log(stamp TEXT, record TEXT, PRIMARY KEY(record))")
    4344    or die "db error";
    4445
     
    162163    $a->{time} cmp $b->{time}
    163164} @records;
    164 my $query = $dbh->prepare("INSERT OR IGNORE INTO log VALUES(?)")
     165my $query = $dbh->prepare("INSERT OR IGNORE INTO log(stamp, record) VALUES(DATETIME('now'), ?)")
    165166        or die "database error: $!";
    166167
     
    176177        = @$rec{qw( host time device event elapse_time errors )};
    177178    # pack record
    178     $query->execute("$host|$time|$device|$event|$elapse_time|$errors")
     179    my $rec = "$host|$time|$device|$event|$elapse_time|$errors";
     180    $query->execute($rec)
    179181        or die "database error: $!";
     182    warn "inserting $rec\n" if $debug;
    180183
    181184    # do not print filtered records
Note: See TracChangeset for help on using the changeset viewer.