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

Method get_database_size_by_id

class/databaseModel/pgsqlModel.py:1110–1129  ·  view source on GitHub ↗

@获取数据库尺寸(批量删除验证) @args json/int 数据库id

(self, args)

Source from the content-addressed store, hash-verified

1108 return data
1109
1110 def get_database_size_by_id(self, args):
1111 """
1112 @获取数据库尺寸(批量删除验证)
1113 @args json/int 数据库id
1114 """
1115 total = 0
1116 db_id = args
1117 if not isinstance(args, int): db_id = args['db_id']
1118
1119 try:
1120 name = public.M('databases').where("id=? AND LOWER(type)=LOWER('PgSql')", db_id).getField('name')
1121 sql_obj = self.get_sql_obj(name)
1122 tables = sql_obj.query("select name,size,type from sys.master_files where type=0 and name = '{}'".format(name))
1123
1124 total = tables[0][1]
1125 if not total: total = 0
1126 except:
1127 pass
1128
1129 return total
1130
1131 def check_del_data(self, args):
1132 """

Callers 2

get_database_sizeMethod · 0.45
get_database_sizeMethod · 0.45

Calls 6

get_sql_objMethod · 0.95
getFieldMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
queryMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected