Fixed a couple of Postgres issues

git-svn-id: svn://10.0.0.236/trunk@253832 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ghendricks%novell.com
2008-08-25 23:34:47 +00:00
parent 520114655e
commit de8dce11f1
3 changed files with 8 additions and 2 deletions

View File

@@ -1642,10 +1642,16 @@ sub init {
my $query;
if ($self->{'fields'}){
$query = "SELECT $distinct". join(",", @{$self->{'fields'}});
foreach my $qfield (@{$self->{'fields'}}){
push @groupby, $qfield unless $qfield == '42217354';
}
}
else {
$query = "SELECT $distinct test_". $obj ."s.". $obj. "_id";
}
if (scalar @orderby){
$query .= ',' . join(',', @orderby);
}
$query .= " FROM $suppstring";
$query .= " WHERE " . join(' AND ', (@wherepart, @andlist));
if ($obj eq 'case_run' && $cgi->param('addcases')){

View File

@@ -302,7 +302,7 @@ sub _check_alias {
sub _check_time{
my ($invocant, $time) = @_;
$time = trim($time);
return 0 unless $time;
return '0:0:0' unless $time;
$time =~ m/^(\d+)[:\s](\d+)[:\s](\d+)$/;
ThrowUserError('testopia-format-error', {'field' => 'Estimated Time' })
unless (defined $1 && defined $2 && $2 < 60 && defined $3 && $3 < 60);

View File

@@ -319,7 +319,7 @@ sub populateMiscTables {
$dbh->do("INSERT INTO test_fielddefs (name, description, table_name) VALUES ('target_completion', 'Target Completion Rate', 'test_runs')")
if ! $dbh->selectrow_array("SELECT COUNT(*) FROM test_fielddefs WHERE name = ?", undef, 'target_completion');
return if $dbh->selectrow_array("SELECT COUNT(*) FROM test_case_run_status");
return if $dbh->selectrow_array("SELECT COUNT(*) FROM test_case_status");
print "Populating test_case_run_status table ...\n";
print "Populating test_case_status table ...\n";