With placeholders it works:
INSERT INTO events
(catalogID,id,uKey,replicationStatus,test,title,status,startDate,startTime,endDate,endTime,duration,statusMes
sage,step,timeslot,instability,persistent,downtime,filename) VALUES
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
'SML' '0' 'DUMMY-T5' 'I' 'check_dummy.pl --environment=T --trendline=2
-r 2' 'Condenced View test' 'CRITICAL' '2010/01/12' '12:4
7:38' '2010/01/12' '12:47:41' '00:00:03' 'CRITICAL - Dummy plugin for
testing the \'Application Monitoring\' (Test): +DUMMY-T2+|
Status=2;1;2;0;3 Compilation=992ms;;;0; Trendline=2.005s;;;;
Execution=2997ms;;;0;' '120' '1263296820' '0' '0' '0' '<NIHIL>'
sub CSV_insert_into_table {
my ($rv, $dbh, $tableName, $columnSequence, $tableValues,
$columnNameAutoincrement, $debug) = @_;
if ( defined $dbh and $rv ) {
my ($column, $placeholders, @values);
foreach my $columnName ( @{$columnSequence} ) {
$column .= $columnName .',';
$placeholders .= '?,';
push ( @values, ( ( $columnName eq $columnNameAutoincrement ) ?
$dbh->quote('0') : $dbh->quote($tableValues->{$columnName}) ) );
}
if ( defined $column and defined $placeholders) {
chop $column; chop $placeholders;
my $sql = "INSERT INTO $tableName ($column) VALUES ($placeholders)";
print "$sql\n\n@values\n\n" if ($debug);
my $sth = $dbh->prepare($sql) or $rv = error_Trap_DBI("Cannot
sth->prepare: $sql", $debug);
$sth->execute(@values) or $rv = error_Trap_DBI("Cannot
sth->execute: @values", $debug);
}
}
return $rv;
}
Message body is not shown because it is too large.