🎨 Kernel API /api/query/sql
support ||
operator https://github.com/siyuan-note/siyuan/issues/9662
This commit is contained in:
parent
0bc3332db2
commit
422b8fdecd
2 changed files with 9 additions and 4 deletions
|
@ -46,7 +46,7 @@ func queryAssetContentRawStmt(stmt string, limit int) (ret []map[string]interfac
|
|||
return
|
||||
}
|
||||
|
||||
noLimit := !strings.Contains(strings.ToLower(stmt), " limit ")
|
||||
noLimit := !containsLimitClause(stmt)
|
||||
var count, errCount int
|
||||
for rows.Next() {
|
||||
columns := make([]interface{}, len(cols))
|
||||
|
@ -152,7 +152,7 @@ func selectAssetContentsRawStmt(stmt string, limit int) (ret []*AssetContent) {
|
|||
}
|
||||
defer rows.Close()
|
||||
|
||||
noLimit := !strings.Contains(strings.ToLower(stmt), " limit ")
|
||||
noLimit := !containsLimitClause(stmt)
|
||||
var count, errCount int
|
||||
for rows.Next() {
|
||||
count++
|
||||
|
|
|
@ -503,7 +503,7 @@ func queryRawStmt(stmt string, limit int) (ret []map[string]interface{}, err err
|
|||
return
|
||||
}
|
||||
|
||||
noLimit := !strings.Contains(strings.ToLower(stmt), " limit ")
|
||||
noLimit := !containsLimitClause(stmt)
|
||||
var count, errCount int
|
||||
for rows.Next() {
|
||||
columns := make([]interface{}, len(cols))
|
||||
|
@ -609,7 +609,7 @@ func selectBlocksRawStmt(stmt string, limit int) (ret []*Block) {
|
|||
}
|
||||
defer rows.Close()
|
||||
|
||||
noLimit := !strings.Contains(strings.ToLower(stmt), " limit ")
|
||||
noLimit := !containsLimitClause(stmt)
|
||||
var count, errCount int
|
||||
for rows.Next() {
|
||||
count++
|
||||
|
@ -836,3 +836,8 @@ func GetContainerText(container *ast.Node) string {
|
|||
})
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func containsLimitClause(stmt string) bool {
|
||||
return strings.Contains(strings.ToLower(stmt), " limit ") ||
|
||||
strings.Contains(strings.ToLower(stmt), "\nlimit ")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue