org.postgresql.core
Interface ProtocolConnection


public interface ProtocolConnection

Provides access to protocol-level connection operations.

Author:
Oliver Jowett (oliver@opencloud.com)

Field Summary
static int TRANSACTION_FAILED
          Constant returned by getTransactionState() indicating that a transaction is currently open, but it has seen errors and will refuse subsequent queries until a ROLLBACK.
static int TRANSACTION_IDLE
          Constant returned by getTransactionState() indicating that no transaction is currently open.
static int TRANSACTION_OPEN
          Constant returned by getTransactionState() indicating that a transaction is currently open.
 
Method Summary
 void close()
          Close this connection cleanly.
 String getDatabase()
           
 Encoding getEncoding()
           
 String getHost()
           
 PGNotification[] getNotifications()
          Retrieve and clear the set of asynchronous notifications pending on this connection.
 int getPort()
           
 int getProtocolVersion()
           
 QueryExecutor getQueryExecutor()
           
 String getServerVersion()
           
 boolean getStandardConformingStrings()
          Returns whether the server treats string-literals according to the SQL standard or if it uses traditional PostgreSQL escaping rules.
 int getTransactionState()
          Get the current transaction state of this connection.
 String getUser()
           
 SQLWarning getWarnings()
          Retrieve and clear the chain of warnings accumulated on this connection.
 boolean isClosed()
          Check if this connection is closed.
 void sendQueryCancel()
          Sends a query cancellation for this connection.
 

Field Detail

TRANSACTION_IDLE

static final int TRANSACTION_IDLE
Constant returned by getTransactionState() indicating that no transaction is currently open.

See Also:
Constant Field Values

TRANSACTION_OPEN

static final int TRANSACTION_OPEN
Constant returned by getTransactionState() indicating that a transaction is currently open.

See Also:
Constant Field Values

TRANSACTION_FAILED

static final int TRANSACTION_FAILED
Constant returned by getTransactionState() indicating that a transaction is currently open, but it has seen errors and will refuse subsequent queries until a ROLLBACK.

See Also:
Constant Field Values
Method Detail

getHost

String getHost()
Returns:
the hostname this connection is connected to.

getPort

int getPort()
Returns:
the port number this connection is connected to.

getUser

String getUser()
Returns:
the user this connection authenticated as.

getDatabase

String getDatabase()
Returns:
the database this connection is connected to.

getServerVersion

String getServerVersion()
Returns:
the server version of the connected server, formatted as X.Y.Z.

getEncoding

Encoding getEncoding()
Returns:
the current encoding in use by this connection

getStandardConformingStrings

boolean getStandardConformingStrings()
Returns whether the server treats string-literals according to the SQL standard or if it uses traditional PostgreSQL escaping rules. Versions up to 8.1 always treated backslashes as escape characters in string-literals. Since 8.2, this depends on the value of the standard_conforming_strings server variable.

Returns:
true if the server treats string literals according to the SQL standard

getTransactionState

int getTransactionState()
Get the current transaction state of this connection.

Returns:
a ProtocolConnection.TRANSACTION_* constant.

getNotifications

PGNotification[] getNotifications()
                                  throws SQLException
Retrieve and clear the set of asynchronous notifications pending on this connection.

Returns:
an array of notifications; if there are no notifications, an empty array is returned.
Throws:
SQLException

getWarnings

SQLWarning getWarnings()
Retrieve and clear the chain of warnings accumulated on this connection.

Returns:
the first SQLWarning in the chain; subsequent warnings can be found via SQLWarning.getNextWarning().

getQueryExecutor

QueryExecutor getQueryExecutor()
Returns:
the QueryExecutor instance for this connection.

sendQueryCancel

void sendQueryCancel()
                     throws SQLException
Sends a query cancellation for this connection.

Throws:
SQLException - if something goes wrong.

close

void close()
Close this connection cleanly.


isClosed

boolean isClosed()
Check if this connection is closed.

Returns:
true iff the connection is closed.

getProtocolVersion

int getProtocolVersion()
Returns:
the version of the implementation


Copyright © 2013. All Rights Reserved.