|
@@ -220,7 +220,7 @@ func GetBlockTreeRootByPath(boxID, path string) (ret *BlockTree) {
|
|
|
func GetBlockTreeRootByHPath(boxID, hPath string) (ret *BlockTree) {
|
|
|
ret = &BlockTree{}
|
|
|
hPath = gulu.Str.RemoveInvisible(hPath)
|
|
|
- sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ?"
|
|
|
+ sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ? AND type = 'd'"
|
|
|
err := db.QueryRow(sqlStmt, boxID, hPath).Scan(&ret.ID, &ret.RootID, &ret.ParentID, &ret.BoxID, &ret.Path, &ret.HPath, &ret.Updated, &ret.Type)
|
|
|
if nil != err {
|
|
|
ret = nil
|
|
@@ -235,7 +235,7 @@ func GetBlockTreeRootByHPath(boxID, hPath string) (ret *BlockTree) {
|
|
|
|
|
|
func GetBlockTreeRootsByHPath(boxID, hPath string) (ret []*BlockTree) {
|
|
|
hPath = gulu.Str.RemoveInvisible(hPath)
|
|
|
- sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ?"
|
|
|
+ sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ? AND type = 'd'"
|
|
|
rows, err := db.Query(sqlStmt, boxID, hPath)
|
|
|
if nil != err {
|
|
|
logging.LogErrorf("sql query [%s] failed: %s", sqlStmt, err)
|
|
@@ -256,7 +256,7 @@ func GetBlockTreeRootsByHPath(boxID, hPath string) (ret []*BlockTree) {
|
|
|
func GetBlockTreeRootByHPathPreferredParentID(boxID, hPath, preferredParentID string) (ret *BlockTree) {
|
|
|
hPath = gulu.Str.RemoveInvisible(hPath)
|
|
|
var roots []*BlockTree
|
|
|
- sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ? AND parent_id = ?"
|
|
|
+ sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ? AND parent_id = ? AND type = 'd'"
|
|
|
rows, err := db.Query(sqlStmt, boxID, hPath, preferredParentID)
|
|
|
if nil != err {
|
|
|
logging.LogErrorf("sql query [%s] failed: %s", sqlStmt, err)
|