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

Function check_exists_table

script/init_db.py:107–118  ·  view source on GitHub ↗
(db_obj, table)

Source from the content-addressed store, hash-verified

105
106# 检查表是否存在
107def check_exists_table(db_obj, table):
108 res = db_obj.query("SELECT * FROM sqlite_master WHERE type='table' AND name='{}';".format(table))
109 if 'unable to open database file' in res:
110 return True
111
112 if not isinstance(res, list):
113
114 print_x('{} 读取失败,可能原因表已损坏'.format(table))
115 return False
116 if len(res) > 0:
117 return True
118 return False
119
120
121# 同步单个表

Callers 3

sync_db_tableFunction · 0.85
test_sqlFunction · 0.85
repair_lack_fieldFunction · 0.85

Calls 3

print_xFunction · 0.70
queryMethod · 0.45
formatMethod · 0.45

Tested by 1

test_sqlFunction · 0.68