2016-01-18 14:48:14 +00:00
|
|
|
##########################################################################
|
|
|
|
|
#
|
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
|
#
|
2024-01-01 14:13:48 +05:30
|
|
|
# Copyright (C) 2013 - 2024, The pgAdmin Development Team
|
2016-01-18 14:48:14 +00:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
|
#
|
|
|
|
|
##########################################################################
|
|
|
|
|
|
2015-10-20 12:33:18 +05:30
|
|
|
from flask import current_app
|
2016-06-21 14:12:14 +01:00
|
|
|
|
2015-10-20 12:33:18 +05:30
|
|
|
from .registry import DriverRegistry
|
|
|
|
|
|
|
|
|
|
|
2021-06-24 11:30:11 +05:30
|
|
|
def get_driver(_type, app=None):
|
2015-10-20 12:33:18 +05:30
|
|
|
|
2021-06-24 11:30:11 +05:30
|
|
|
if app is not None:
|
|
|
|
|
DriverRegistry.load_modules(app)
|
2015-10-20 12:33:18 +05:30
|
|
|
|
2021-06-24 11:30:11 +05:30
|
|
|
return DriverRegistry.get(_type)
|
2015-10-20 12:33:18 +05:30
|
|
|
|
2016-06-21 14:21:06 +01:00
|
|
|
|
2015-10-20 12:33:18 +05:30
|
|
|
def init_app(app):
|
|
|
|
|
drivers = dict()
|
|
|
|
|
|
|
|
|
|
setattr(app, '_pgadmin_server_drivers', drivers)
|
2021-06-24 11:30:11 +05:30
|
|
|
DriverRegistry.load_modules(app)
|
2015-10-20 12:33:18 +05:30
|
|
|
|
2016-01-02 14:54:01 +05:30
|
|
|
return drivers
|
|
|
|
|
|
2015-10-20 12:33:18 +05:30
|
|
|
|
|
|
|
|
def ping():
|
2023-01-19 15:57:02 +05:30
|
|
|
for type in DriverRegistry._registry:
|
|
|
|
|
DriverRegistry._objects[type].gc_timeout()
|