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

Function get_database_json

script/init_db.py:302–324  ·  view source on GitHub ↗
(is_talbe=True)

Source from the content-addressed store, hash-verified

300@param is_talbe 是否按表名索引,default.db按表名返回,其他数据库防止重复,按表名_数据库名返回
301"""
302def get_database_json(is_talbe=True):
303 all_tabs = {}
304 init_db_dict = json.loads(public.readFile(DATABASES_PATH))
305 for db_keys in init_db_dict.keys():
306 for table in init_db_dict[db_keys].keys():
307 nkey = '{}@{}'.format(table, db_keys)
308 if is_talbe: nkey = table
309
310 if not nkey in all_tabs:
311 all_tabs[nkey] = {}
312 else:
313 #表名重复处理
314 nkey = '{}@{}'.format(table, db_keys)
315 if not nkey in all_tabs:
316 all_tabs[nkey] = {}
317
318 all_tabs[nkey]['db'] = db_keys
319 all_tabs[nkey]['table'] = table
320 all_tabs[nkey]['sql'] = init_db_dict[db_keys][table]['sql']
321 all_tabs[nkey]['fields'] = init_db_dict[db_keys][table]['fields']
322
323
324 return all_tabs
325
326
327"""

Callers 6

get_table_byjsonFunction · 0.70
sync_db_allFunction · 0.70
repair_columnFunction · 0.70
test_sqlFunction · 0.70
repair_lack_fieldFunction · 0.70
repair_all_dbFunction · 0.70

Calls 4

readFileMethod · 0.80
loadsMethod · 0.45
keysMethod · 0.45
formatMethod · 0.45

Tested by 1

test_sqlFunction · 0.56