mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 00:20:12 +01:00
🎨 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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
noLimit := !strings.Contains(strings.ToLower(stmt), " limit ")
|
noLimit := !containsLimitClause(stmt)
|
||||||
var count, errCount int
|
var count, errCount int
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
columns := make([]interface{}, len(cols))
|
columns := make([]interface{}, len(cols))
|
||||||
|
|
@ -152,7 +152,7 @@ func selectAssetContentsRawStmt(stmt string, limit int) (ret []*AssetContent) {
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
noLimit := !strings.Contains(strings.ToLower(stmt), " limit ")
|
noLimit := !containsLimitClause(stmt)
|
||||||
var count, errCount int
|
var count, errCount int
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
count++
|
count++
|
||||||
|
|
|
||||||
|
|
@ -503,7 +503,7 @@ func queryRawStmt(stmt string, limit int) (ret []map[string]interface{}, err err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
noLimit := !strings.Contains(strings.ToLower(stmt), " limit ")
|
noLimit := !containsLimitClause(stmt)
|
||||||
var count, errCount int
|
var count, errCount int
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
columns := make([]interface{}, len(cols))
|
columns := make([]interface{}, len(cols))
|
||||||
|
|
@ -609,7 +609,7 @@ func selectBlocksRawStmt(stmt string, limit int) (ret []*Block) {
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
noLimit := !strings.Contains(strings.ToLower(stmt), " limit ")
|
noLimit := !containsLimitClause(stmt)
|
||||||
var count, errCount int
|
var count, errCount int
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
count++
|
count++
|
||||||
|
|
@ -836,3 +836,8 @@ func GetContainerText(container *ast.Node) string {
|
||||||
})
|
})
|
||||||
return buf.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
Add a link
Reference in a new issue