@获取数据库尺寸(批量删除验证) @args json/int 数据库id
(self, args)
| 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 | """ |