Skip to content

Commit

Permalink
ignore show field sql when defined sql is blank to prevent errors
Browse files Browse the repository at this point in the history
  • Loading branch information
collinsp committed Apr 21, 2015
1 parent 504cef3 commit 207daae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/DBIx/OptimalQuery.pm
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,11 @@ sub create_select {
#$select_sql->[0] = 'to_char('.$select_sql->[0].')';
}

push @{ $cursor->{select_field_order} }, $show;
push @{ $cursor->{select_sql} }, $select_sql->[0].' AS '.$show;
push @{ $cursor->{select_binds} }, @$select_sql[1 .. $#$select_sql];
if ($select_sql->[0] ne '') {
push @{ $cursor->{select_field_order} }, $show;
push @{ $cursor->{select_sql} }, $select_sql->[0].' AS '.$show;
push @{ $cursor->{select_binds} }, @$select_sql[1 .. $#$select_sql];
}
}

return undef;
Expand Down

0 comments on commit 207daae

Please sign in to comment.