mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Global search ignores LIMIT clause when using SQL method https://github.com/siyuan-note/siyuan/issues/8071
This commit is contained in:
parent
62d871373b
commit
4cc8e18342
2 changed files with 33 additions and 3 deletions
|
|
@ -433,14 +433,25 @@ func SelectBlocksRawStmt(stmt string, page, limit int) (ret []*Block) {
|
|||
Val: []byte(strconv.Itoa(limit)),
|
||||
},
|
||||
}
|
||||
slct.Limit.Offset = &sqlparser.SQLVal{
|
||||
Type: sqlparser.IntVal,
|
||||
Val: []byte(strconv.Itoa((page - 1) * limit)),
|
||||
}
|
||||
} else {
|
||||
if nil != slct.Limit.Rowcount && 0 < len(slct.Limit.Rowcount.(*sqlparser.SQLVal).Val) {
|
||||
limit, _ = strconv.Atoi(string(slct.Limit.Rowcount.(*sqlparser.SQLVal).Val))
|
||||
if 0 >= limit {
|
||||
limit = 32
|
||||
}
|
||||
}
|
||||
|
||||
slct.Limit.Rowcount = &sqlparser.SQLVal{
|
||||
Type: sqlparser.IntVal,
|
||||
Val: []byte(strconv.Itoa(limit)),
|
||||
}
|
||||
slct.Limit.Offset = &sqlparser.SQLVal{
|
||||
Type: sqlparser.IntVal,
|
||||
Val: []byte(strconv.Itoa((page - 1) * 32)),
|
||||
Val: []byte(strconv.Itoa((page - 1) * limit)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue