🎨 改进索引订正,考虑大小写库

This commit is contained in:
Liang Ding 2023-01-19 17:36:55 +08:00
parent 772984fe1b
commit f84efb9efa
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 51 additions and 31 deletions

View file

@ -597,8 +597,8 @@ func GetBlock(id string) (ret *Block) {
return
}
func GetRootUpdated() (ret map[string]string, err error) {
rows, err := query("SELECT root_id, updated FROM blocks WHERE type = 'd'")
func GetRootUpdated(blocksTable string) (ret map[string]string, err error) {
rows, err := query("SELECT root_id, updated FROM `" + blocksTable + "` WHERE type = 'd'")
if nil != err {
logging.LogErrorf("sql query failed: %s", err)
return
@ -614,8 +614,8 @@ func GetRootUpdated() (ret map[string]string, err error) {
return
}
func GetDuplicatedRootIDs() (ret []string) {
rows, err := query("SELECT DISTINCT root_id FROM blocks GROUP BY id HAVING COUNT(*) > 1")
func GetDuplicatedRootIDs(blocksTable string) (ret []string) {
rows, err := query("SELECT DISTINCT root_id FROM `" + blocksTable + "` GROUP BY id HAVING COUNT(*) > 1")
if nil != err {
logging.LogErrorf("sql query failed: %s", err)
return