@获取数据库尺寸(批量删除验证) @args json/int 数据库id
(self, args)
| 415 | return public.returnMsg(True, '修改sa密码成功!') |
| 416 | |
| 417 | def get_database_size_by_id(self, args): |
| 418 | """ |
| 419 | @获取数据库尺寸(批量删除验证) |
| 420 | @args json/int 数据库id |
| 421 | """ |
| 422 | total = 0 |
| 423 | db_id = args |
| 424 | if not isinstance(args, int): db_id = args['db_id'] |
| 425 | |
| 426 | try: |
| 427 | name = public.M('databases').where("id=? AND LOWER(type)=LOWER('SQLServer')", db_id).getField('name') |
| 428 | mssql_obj = self.get_mssql_obj(name) |
| 429 | tables = mssql_obj.query("select name,size,type from sys.master_files where type=0 and name = '{}'".format(name)) |
| 430 | |
| 431 | total = tables[0][1] |
| 432 | if not total: total = 0 |
| 433 | except: |
| 434 | pass |
| 435 | |
| 436 | return total |
| 437 | |
| 438 | def check_del_data(self, args): |
| 439 | """ |
no test coverage detected