mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 16:56:30 -06:00
Allow the connection driver to return notices/messages from the server.
This commit is contained in:
parent
d2e372114b
commit
0b43443151
@ -10,7 +10,6 @@
|
||||
"""Implement the Base class for Driver and Connection"""
|
||||
|
||||
from abc import ABCMeta, abstractmethod, abstractproperty
|
||||
from flask import session
|
||||
from .registry import DriverRegistry
|
||||
import six
|
||||
|
||||
@ -125,16 +124,23 @@ class BaseConnection(object):
|
||||
management.
|
||||
|
||||
* _wait(conn)
|
||||
- Implement this method to wait for asynchronous connection. This is a blocking call.
|
||||
- Implement this method to wait for asynchronous connection to finish the
|
||||
execution, hence - it must be a blocking call.
|
||||
|
||||
* _wait_timeout(conn, time)
|
||||
- Implement this method to wait for asynchronous connection with timeout. This is a non blocking call.
|
||||
- Implement this method to wait for asynchronous connection with timeout.
|
||||
This must be a non blocking call.
|
||||
|
||||
* poll()
|
||||
- Implement this method to poll the data of query running on asynchronous connection.
|
||||
- Implement this method to poll the data of query running on asynchronous
|
||||
connection.
|
||||
|
||||
* cancel_transaction(conn_id, did=None)
|
||||
- Implement this method to cancel the running transaction.
|
||||
|
||||
* messages()
|
||||
- Implement this method to return the list of the messages/notices from
|
||||
the database server.
|
||||
"""
|
||||
|
||||
ASYNC_OK = 1
|
||||
|
@ -7,7 +7,11 @@
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
"""Implementation of Connection, ServerManager and Driver classes"""
|
||||
"""
|
||||
Implementation of Connection, ServerManager and Driver classes using the
|
||||
psycopg2. It is a wrapper around the actual psycopg2 driver, and connection
|
||||
object.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
@ -79,17 +83,24 @@ class Connection(BaseConnection):
|
||||
- Release the connection object of psycopg2
|
||||
|
||||
* _wait(conn)
|
||||
- This method is used to wait for asynchronous connection. This is a blocking call.
|
||||
- This method is used to wait for asynchronous connection. This is a
|
||||
blocking call.
|
||||
|
||||
* _wait_timeout(conn, time)
|
||||
- This method is used to wait for asynchronous connection with timeout. This is a non blocking call.
|
||||
- This method is used to wait for asynchronous connection with timeout.
|
||||
This is a non blocking call.
|
||||
|
||||
* poll()
|
||||
- This method is used to poll the data of query running on asynchronous connection.
|
||||
- This method is used to poll the data of query running on asynchronous
|
||||
connection.
|
||||
|
||||
* cancel_transaction(conn_id, did=None)
|
||||
- This method is used to cancel the transaction for the
|
||||
specified connection id and database id.
|
||||
|
||||
* messages()
|
||||
- Returns the list of messages/notices sends from the PostgreSQL database
|
||||
server.
|
||||
"""
|
||||
def __init__(self, manager, conn_id, db, auto_reconnect=True, async=0):
|
||||
assert(manager is not None)
|
||||
@ -781,6 +792,12 @@ Polling result for (Query-id: {query_id})""".format(query_id=self.__async_query_
|
||||
|
||||
return status, msg
|
||||
|
||||
def messages(self):
|
||||
"""
|
||||
Returns the list of the messages/notices send from the database server.
|
||||
"""
|
||||
return self.pg_conn.notices if self.pg_conn else []
|
||||
|
||||
|
||||
class ServerManager(object):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user