MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / check_default_error

Function check_default_error

script/init_db.py:584–598  ·  view source on GitHub ↗

@name 检查默认数据库是否损坏

(sfile)

Source from the content-addressed store, hash-verified

582
583
584def check_default_error(sfile):
585 """
586 @name 检查默认数据库是否损坏
587 """
588 try:
589 default_db_obj = get_db_obj(sfile)
590 res = default_db_obj.query("SELECT name FROM sqlite_master WHERE type='table' AND name not in ('sqlite_sequence','sqlite_master');")
591 if type(res) == str:
592 if res.find('unable to open database file') >= 0:
593 #磁盘满了,非数据库损耗
594 return False
595 if res.find('error:') >= 0:
596 return True
597 except:pass
598 return False
599
600
601

Callers 1

repair_db_byfileFunction · 0.85

Calls 3

get_db_objFunction · 0.85
queryMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected