Skip to content

Commit

Permalink
fix: limit=0 results (#5735)
Browse files Browse the repository at this point in the history
  • Loading branch information
robhafner committed Oct 3, 2022
1 parent 3670b0c commit 3e755c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sqlserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ func (dialector Dialector) ClauseBuilders() map[string]clause.ClauseBuilder {
builder.WriteString(" ROWS")
}

if limit.Limit > 0 {
if limit.Limit != nil && *limit.Limit >= 0 {
if limit.Offset == 0 {
builder.WriteString("OFFSET 0 ROW")
}
builder.WriteString(" FETCH NEXT ")
builder.WriteString(strconv.Itoa(limit.Limit))
builder.WriteString(strconv.Itoa(*limit.Limit))
builder.WriteString(" ROWS ONLY")
}
}
Expand Down

0 comments on commit 3e755c0

Please sign in to comment.