my $sql = "INSERT INTO ERRORS (TSTAMP,CMND_ID,ALERT_ID,SEND_ID,DESTIN
+ATION,MESSAGE,STATE,SVR_HOST) VALUES (\'$tstamp\',\'$cmnd_id\',\'$alert_id\',\'$send
+_id\',\'$destination\',\'$message\',\'$state\',\'$svr_host\')\;\n";
my $statement = $db_handle->prepare($sql)
or die "Couldn't prepare query '$sql': $DBI::errstr\n";
$statement->execute()
or die "Couldn't execute query '$sql': $DBI::errstr\n";
####
my $sql = qq{"INSERT INTO ERRORS (TSTAMP,CMND_ID,ALERT_ID,SEND_ID,DESTINATION,MESSAGE,STATE,SVR_HOST) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);
my $statement = $dbh->prepare($sql);
$statement->execute($tstamp, $cmnd_id, ...);
####
if($line =~ /^SendCleared~(.*)~(.*)~(.*)~(.*)~(.*)~(.*)/){
my $tstamp = $1;
my $cmnd_id = $2;
my $alert_id = $3;
my $send_id = $4;
my $state = $5;
my $svr_host = $6;
####
my ($tstamp, $cmnd_id, ...) = split m/~/, $line;
####
# assume %q contains the quries
my ($query, @args) = split $line, '~';
$q{$query}->execute(@args); # assuming the log files are well formed