This method is used to get database based on sid, did.
(sid, did)
| 615 | |
| 616 | |
| 617 | def _get_database_role(sid, did): |
| 618 | """ |
| 619 | This method is used to get database based on sid, did. |
| 620 | """ |
| 621 | try: |
| 622 | from pgadmin.utils.driver import get_driver |
| 623 | manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(int(sid)) |
| 624 | conn = manager.connection(did=int(did)) |
| 625 | |
| 626 | is_connected = get_connection_status(conn) |
| 627 | |
| 628 | if not is_connected: |
| 629 | conn.connect() |
| 630 | |
| 631 | db_name = conn.db |
| 632 | role = manager.role if manager.role else None |
| 633 | return {'db_name': db_name, 'role': role} |
| 634 | except Exception as e: |
| 635 | print(str(e)) |
| 636 | return None |
| 637 | |
| 638 | |
| 639 | def get_open_psql_connections(): |
no test coverage detected