This commit is contained in:
Liang Ding 2023-01-08 22:47:43 +08:00
parent dc4b5accfb
commit 88f716b5d6
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
7 changed files with 90 additions and 48 deletions

View file

@ -581,6 +581,21 @@ func GetBlock(id string) (ret *Block) {
return
}
func GetBlockRedundant(id string) (ret []*Block) {
rows, err := query("SELECT * FROM blocks WHERE id = ?", id)
if nil != err {
logging.LogErrorf("sql query failed: %s", err)
return
}
defer rows.Close()
for rows.Next() {
if block := scanBlockRows(rows); nil != block {
ret = append(ret, block)
}
}
return
}
func GetAllRootBlocks() (ret []*Block) {
stmt := "SELECT * FROM blocks WHERE type = 'd'"
rows, err := query(stmt)