bugfix for LimitAndOffsetSQL

This commit is contained in:
Sen Zhang 2017-08-24 13:56:42 +08:00
parent c4ecc70bfc
commit 160e1c67c3

View File

@ -126,7 +126,6 @@ func (commonDialect) LimitAndOffsetSQL(limit, offset interface{}) (sql string) {
if limit != nil { if limit != nil {
if parsedLimit, err := strconv.ParseInt(fmt.Sprint(limit), 0, 0); err == nil && parsedLimit >= 0 { if parsedLimit, err := strconv.ParseInt(fmt.Sprint(limit), 0, 0); err == nil && parsedLimit >= 0 {
sql += fmt.Sprintf(" LIMIT %d", parsedLimit) sql += fmt.Sprintf(" LIMIT %d", parsedLimit)
}
if offset != nil { if offset != nil {
if parsedOffset, err := strconv.ParseInt(fmt.Sprint(offset), 0, 0); err == nil && parsedOffset >= 0 { if parsedOffset, err := strconv.ParseInt(fmt.Sprint(offset), 0, 0); err == nil && parsedOffset >= 0 {
@ -134,6 +133,7 @@ func (commonDialect) LimitAndOffsetSQL(limit, offset interface{}) (sql string) {
} }
} }
} }
}
return return
} }