Build precise queries to find exactly what you need
Press ESC to close
@bockfot2000
Favorites0
Views
Projects0
Below is a patch to make the script working with a PostgreSQL backend, and a quick-fix for instances where query returns 0E0: + my $dsn = "DBI:Pg:database=$sqlDB;host=localhost"; + $sql_query = "SELECT SUM(JobErrors) AS errors, COUNT(*) AS count, Job.JobId, Job.JobStatus, Log.LogText + FROM Job LEFT JOIN Log on Job.JobId = Log.JobId + WHERE (Name='$opt_job') AND (JobStatus='T') AND (EndTime IS NOT NULL) + AND ((EndTime = '$date_stop')) + GROUP BY Job.JobId, Job.JobStatus, Log.LogText;"; - my @job_stats = sql_exec(); + my $sth = $dbh->prepare($sql_query); + my $rv = $sth->execute() or die "Error executing query: '$sql_query': $DBI::errstrn"; + if ($rv fetchrow_array(); + $errors = $job_stats[0]; + $count = $job_stats[1]; + $jobid = $job_stats[2]; + $joblog = $job_stats[3]; + }
Reviewed 12 years ago