public interface PGConnection
Modifier and Type | Method and Description |
---|---|
void |
addDataType(String type,
Class<? extends PGobject> klass)
This allows client code to add a handler for one of org.postgresql's more unique data types.
|
void |
addDataType(String type,
String className)
Deprecated.
As of 8.0, replaced by
addDataType(String, Class) . This deprecated method
does not work correctly for registering classes that cannot be directly loaded by
the JDBC driver's classloader. |
String |
escapeIdentifier(String identifier)
Return the given string suitably quoted to be used as an identifier in an SQL statement string.
|
String |
escapeLiteral(String literal)
Return the given string suitably quoted to be used as a string literal in an SQL statement
string.
|
AutoSave |
getAutosave()
Connection configuration regarding automatic per-query savepoints.
|
int |
getBackendPID()
Return the process ID (PID) of the backend server process handling this connection.
|
CopyManager |
getCopyAPI()
This returns the COPY API for the current connection.
|
int |
getDefaultFetchSize()
Get the default fetch size for statements created from this connection
|
Fastpath |
getFastpathAPI()
This returns the Fastpath API for the current connection.
|
LargeObjectManager |
getLargeObjectAPI()
This returns the LargeObject API for the current connection.
|
PGNotification[] |
getNotifications()
This method returns any notifications that have been received since the last call to this
method.
|
PGNotification[] |
getNotifications(int timeoutMillis)
This method returns any notifications that have been received since the last call to this
method.
|
PreferQueryMode |
getPreferQueryMode()
Returns true if the connection is configured to use "simple 'Q' execute" commands only
When running in simple protocol only, certain features are not available: callable statements,
partial result set fetch, bytea type, etc.
|
int |
getPrepareThreshold()
Get the default server-side prepare reuse threshold for statements created from this
connection.
|
PGReplicationConnection |
getReplicationAPI() |
void |
setAutosave(AutoSave autoSave)
Configures if connection should use automatic savepoints.
|
void |
setDefaultFetchSize(int fetchSize)
Set the default fetch size for statements created from this connection
|
void |
setPrepareThreshold(int threshold)
Set the default statement reuse threshold before enabling server-side prepare.
|
PGNotification[] getNotifications() throws SQLException
SQLException
- if something wrong happensPGNotification[] getNotifications(int timeoutMillis) throws SQLException
timeoutMillis
- when 0, blocks forever. when > 0, blocks up to the specified number of millies
or until at least one notification has been received. If more than one notification is
about to be received, these will be returned in one batch.SQLException
- if something wrong happensCopyManager getCopyAPI() throws SQLException
SQLException
- if something wrong happensLargeObjectManager getLargeObjectAPI() throws SQLException
SQLException
- if something wrong happensFastpath getFastpathAPI() throws SQLException
SQLException
- if something wrong happensvoid addDataType(String type, String className)
addDataType(String, Class)
. This deprecated method
does not work correctly for registering classes that cannot be directly loaded by
the JDBC driver's classloader.addDataType(type, Class.forName(name))
.type
- JDBC type nameclassName
- class nameRuntimeException
- if the type cannot be registered (class not found, etc).void addDataType(String type, Class<? extends PGobject> klass) throws SQLException
NOTE: This is not part of JDBC, but an extension.
The best way to use this is as follows:
... ((org.postgresql.PGConnection)myconn).addDataType("mytype", my.class.name.class); ...
where myconn is an open Connection to org.postgresql.
The handling class must extend org.postgresql.util.PGobject
type
- the PostgreSQL type to registerklass
- the class implementing the Java representation of the type; this class must
implement PGobject
).SQLException
- if klass
does not implement
PGobject
).PGobject
void setPrepareThreshold(int threshold)
PGStatement.setPrepareThreshold(int)
for details.threshold
- the new thresholdint getPrepareThreshold()
void setDefaultFetchSize(int fetchSize) throws SQLException
fetchSize
- new default fetch sizeSQLException
- if specified negative fetchSize
parameterStatement.setFetchSize(int)
int getDefaultFetchSize()
PGProperty.DEFAULT_ROW_FETCH_SIZE
,
Statement.getFetchSize()
int getBackendPID()
String escapeIdentifier(String identifier) throws SQLException
identifier
- input identifierSQLException
- if something goes wrongString escapeLiteral(String literal) throws SQLException
literal
- input literalSQLException
- if something goes wrongPreferQueryMode getPreferQueryMode()
AutoSave getAutosave()
PGProperty.AUTOSAVE
void setAutosave(AutoSave autoSave)
autoSave
- connection configuration regarding automatic per-query savepointsPGProperty.AUTOSAVE
PGReplicationConnection getReplicationAPI()
Copyright © 2017 PostgreSQL Global Development Group. All rights reserved.