-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
bugIt is confirmed a bug, but don't worry, we'll handle it.It is confirmed a bug, but don't worry, we'll handle it.help wanted
Description
What version of Go
and system type/arch are you using?
go 1.21.6, windows11/amd64
What version of GoFrame
are you using?
2.6.3
Can this bug be re-produced with the latest release?
yes
What did you do?
// when i run these codes there is a bug happen
//my database is sql server , the method name "Page(page,linit)" generate sql of paging is by mysql , not sql server
// i tracked the source code line is
/* LIMIT.
if !isCountStatement {
if m.limit != 0 {
if m.start >= 0 {
conditionExtra += fmt.Sprintf(" LIMIT %d,%d", m.start, m.limit)
} else {
conditionExtra += fmt.Sprintf(" LIMIT %d", m.limit)
}
} else if limit1 {
conditionExtra += " LIMIT 1"
}
if m.offset >= 0 {
conditionExtra += fmt.Sprintf(" OFFSET %d", m.offset)
}
*/
/*of method name "func (m *Model) formatCondition(
ctx context.Context, limit1 bool, isCountStatement bool,
) (conditionWhere string, conditionExtra string, conditionArgs []interface{}) "
of file "gdb_model_select.go" of "package gdb"
*/
model.OrderDesc("start_time").Page(req.PageNo, req.PageSize).ScanAndCount(&res.CarDistanceAlarms, &res.RecordCount, true)
What did you expect to see?
generate sql of paging should by current database type example sqlserver is "select * from student order by sno offset ((@pageIndex-1)*@pageSize) rows
fetch next @pageSize rows only;"
What did you see instead?
sql server database type generate sql of paging is "ORDER BY "start_time" DESC LIMIT 0,10" which is incorrect
Metadata
Metadata
Assignees
Labels
bugIt is confirmed a bug, but don't worry, we'll handle it.It is confirmed a bug, but don't worry, we'll handle it.help wanted