public class PGDirectConnection extends BasicContext implements PGConnection
charset, registry, settings, typeMap
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
Modifier and Type | Method and Description |
---|---|
void |
abort(Executor executor) |
void |
addNotificationListener(PGNotificationListener listener)
Adds an, unnamed, unfiltered, asynchronous notification listener to this
connection
|
void |
addNotificationListener(String channelNameFilter,
PGNotificationListener listener)
Adds an, unnamed, filtered, asynchronous notification listener to this
connection
|
void |
addNotificationListener(String name,
String channelNameFilter,
PGNotificationListener listener)
Adds a filtered asynchronous notification listener to this connection
|
void |
clearWarnings() |
void |
close() |
void |
commit() |
protected void |
connectionClosed()
Called when
BasicContext.serverConnection was closed
externally (i.e. |
protected void |
connectionNotificationReceived(int processId,
String channelName,
String payload)
Called when
BasicContext.serverConnection received
an asynchronous notification |
void |
copyFrom(String sql,
InputStream inputStream)
Allows issuing PostgreSQL's COPY command providing an
InputStream
stream to read from, instead of relying on System.in . |
void |
copyTo(String sql,
OutputStream outputStream)
Allows issuing PostgreSQL's COPY command providing an
OutputStream
stream to write to, instead of relying on System.out . |
Array |
createArrayOf(String typeName,
Object[] elements) |
Blob |
createBlob() |
Clob |
createClob() |
NClob |
createNClob() |
SQLXML |
createSQLXML() |
com.impossibl.postgres.jdbc.PGStatement |
createStatement() |
com.impossibl.postgres.jdbc.PGStatement |
createStatement(int resultSetType,
int resultSetConcurrency) |
com.impossibl.postgres.jdbc.PGStatement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
Struct |
createStruct(String typeName,
Object[] attributes) |
boolean |
getAutoCommit() |
String |
getCatalog() |
Properties |
getClientInfo() |
String |
getClientInfo(String name) |
Integer |
getDefaultFetchSize()
Get the default fetch size
|
int |
getHoldability() |
DatabaseMetaData |
getMetaData() |
int |
getNetworkTimeout() |
String |
getSchema() |
int |
getTransactionIsolation() |
TransactionStatus |
getTransactionStatus() |
Map<String,Class<?>> |
getTypeMap() |
SQLWarning |
getWarnings() |
void |
init(SharedRegistry.Factory sharedRegistryFactory) |
boolean |
isClosed() |
boolean |
isReadOnly() |
boolean |
isServerMinimumVersion(int major,
int minor)
Checks the minimum server version
|
boolean |
isStrictMode()
Is strict mode
|
boolean |
isValid(int timeout) |
boolean |
isWrapperFor(Class<?> iface) |
String |
nativeSQL(String sql) |
CallableStatement |
prepareCall(String sql) |
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency) |
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
com.impossibl.postgres.jdbc.PGPreparedStatement |
prepareStatement(SQLText sqlText,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
com.impossibl.postgres.jdbc.PGPreparedStatement |
prepareStatement(String sql) |
PreparedStatement |
prepareStatement(String sql,
int autoGeneratedKeys) |
PreparedStatement |
prepareStatement(String sql,
int[] columnIndexes) |
com.impossibl.postgres.jdbc.PGPreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency) |
com.impossibl.postgres.jdbc.PGPreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
PreparedStatement |
prepareStatement(String sql,
String[] columnNames) |
void |
releaseSavepoint(Savepoint savepointParam) |
void |
removeNotificationListener(PGNotificationListener listener)
Removes a notification listener
|
void |
removeNotificationListener(String listenerName)
Removes a named notification listener
|
PGAnyType |
resolveType(String name)
Resolves a name to an SQLType suitable for passing
to any method that accepts one.
|
void |
rollback() |
void |
rollback(Savepoint savepointParam) |
void |
setAutoCommit(boolean autoCommit) |
void |
setCatalog(String catalog) |
void |
setClientInfo(Properties properties) |
void |
setClientInfo(String name,
String value) |
void |
setDefaultFetchSize(Integer v)
Set the default fetch size
|
void |
setHoldability(int holdability) |
void |
setNetworkTimeout(Executor executor,
int networkTimeout) |
void |
setReadOnly(boolean readOnly) |
Savepoint |
setSavepoint() |
Savepoint |
setSavepoint(String name) |
void |
setSchema(String schema) |
void |
setStrictMode(boolean v)
Set strict mode
|
void |
setTransactionIsolation(int level) |
void |
setTypeMap(Map<String,Class<?>> typeMap) |
<T> T |
unwrap(Class<T> iface) |
getAllocator, getCharset, getClientCurrencyFormatter, getClientDateFormat, getClientDecimalFormatter, getClientIntegerFormatter, getClientIntervalFormat, getClientTimeFormat, getClientTimestampFormat, getCustomTypeMap, getKeyData, getRegistry, getRequestExecutor, getServerConnection, getServerCurrencyFormatter, getServerDateFormat, getServerInfo, getServerIntervalFormat, getServerTimeFormat, getServerTimestampFormat, getSetting, getTimeZone, getTimeZoneId, isUtilQueryPrepared, prepareUtilQuery, query, queryBatch, queryBatchPrepared, queryBatchPrepared, queryString, shutdown, unwrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSetting
public void init(SharedRegistry.Factory sharedRegistryFactory) throws IOException
init
in class BasicContext
IOException
public TransactionStatus getTransactionStatus() throws SQLException
SQLException
public void setStrictMode(boolean v)
setStrictMode
in interface PGConnection
v
- The valuepublic boolean isStrictMode()
isStrictMode
in interface PGConnection
public void setDefaultFetchSize(Integer v)
setDefaultFetchSize
in interface PGConnection
v
- The valuepublic Integer getDefaultFetchSize()
getDefaultFetchSize
in interface PGConnection
public PGAnyType resolveType(String name) throws SQLException
PGConnection
resolveType
in interface PGConnection
name
- Name of type to resolve (anything acceptable to the server)SQLException
protected void connectionClosed()
BasicContext
BasicContext.serverConnection
was closed
externally (i.e. without calling BasicContext.shutdown()
connectionClosed
in class BasicContext
public boolean isServerMinimumVersion(int major, int minor)
isServerMinimumVersion
in interface PGConnection
major
- The major releaseminor
- The minor releaseTrue
if the server is minimum the specified version, otherwise false
.public boolean isValid(int timeout) throws SQLException
isValid
in interface Connection
SQLException
public Map<String,Class<?>> getTypeMap() throws SQLException
getTypeMap
in interface Connection
SQLException
public void setTypeMap(Map<String,Class<?>> typeMap) throws SQLException
setTypeMap
in interface Connection
SQLException
public int getHoldability() throws SQLException
getHoldability
in interface Connection
SQLException
public void setHoldability(int holdability) throws SQLException
setHoldability
in interface Connection
SQLException
public DatabaseMetaData getMetaData() throws SQLException
getMetaData
in interface Connection
SQLException
public boolean getAutoCommit() throws SQLException
getAutoCommit
in interface Connection
SQLException
public void setAutoCommit(boolean autoCommit) throws SQLException
setAutoCommit
in interface Connection
SQLException
public boolean isReadOnly() throws SQLException
isReadOnly
in interface Connection
SQLException
public void setReadOnly(boolean readOnly) throws SQLException
setReadOnly
in interface Connection
SQLException
public int getTransactionIsolation() throws SQLException
getTransactionIsolation
in interface Connection
SQLException
public void setTransactionIsolation(int level) throws SQLException
setTransactionIsolation
in interface Connection
SQLException
public void commit() throws SQLException
commit
in interface Connection
SQLException
public void rollback() throws SQLException
rollback
in interface Connection
SQLException
public Savepoint setSavepoint() throws SQLException
setSavepoint
in interface Connection
SQLException
public Savepoint setSavepoint(String name) throws SQLException
setSavepoint
in interface Connection
SQLException
public void rollback(Savepoint savepointParam) throws SQLException
rollback
in interface Connection
SQLException
public void releaseSavepoint(Savepoint savepointParam) throws SQLException
releaseSavepoint
in interface Connection
SQLException
public String getCatalog() throws SQLException
getCatalog
in interface Connection
SQLException
public void setCatalog(String catalog) throws SQLException
setCatalog
in interface Connection
SQLException
public String getSchema() throws SQLException
getSchema
in interface Connection
SQLException
public void setSchema(String schema) throws SQLException
setSchema
in interface Connection
SQLException
public String nativeSQL(String sql) throws SQLException
nativeSQL
in interface Connection
SQLException
public com.impossibl.postgres.jdbc.PGStatement createStatement() throws SQLException
createStatement
in interface Connection
SQLException
public com.impossibl.postgres.jdbc.PGStatement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
createStatement
in interface Connection
SQLException
public com.impossibl.postgres.jdbc.PGStatement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
createStatement
in interface Connection
SQLException
public com.impossibl.postgres.jdbc.PGPreparedStatement prepareStatement(String sql) throws SQLException
prepareStatement
in interface Connection
SQLException
public com.impossibl.postgres.jdbc.PGPreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareStatement
in interface Connection
SQLException
public com.impossibl.postgres.jdbc.PGPreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
prepareStatement
in interface Connection
SQLException
public com.impossibl.postgres.jdbc.PGPreparedStatement prepareStatement(SQLText sqlText, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
SQLException
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
prepareStatement
in interface Connection
SQLException
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
prepareStatement
in interface Connection
SQLException
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
prepareStatement
in interface Connection
SQLException
public CallableStatement prepareCall(String sql) throws SQLException
prepareCall
in interface Connection
SQLException
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareCall
in interface Connection
SQLException
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
prepareCall
in interface Connection
SQLException
public Blob createBlob() throws SQLException
createBlob
in interface Connection
SQLException
public Clob createClob() throws SQLException
createClob
in interface Connection
SQLException
public SQLXML createSQLXML() throws SQLException
createSQLXML
in interface Connection
SQLException
public Array createArrayOf(String typeName, Object[] elements) throws SQLException
createArrayOf
in interface Connection
SQLException
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
createStruct
in interface Connection
SQLException
public String getClientInfo(String name) throws SQLException
getClientInfo
in interface Connection
SQLException
public Properties getClientInfo() throws SQLException
getClientInfo
in interface Connection
SQLException
public void setClientInfo(String name, String value) throws SQLClientInfoException
setClientInfo
in interface Connection
SQLClientInfoException
public void setClientInfo(Properties properties) throws SQLClientInfoException
setClientInfo
in interface Connection
SQLClientInfoException
public NClob createNClob() throws SQLException
createNClob
in interface Connection
SQLException
public boolean isClosed()
isClosed
in interface Connection
public void close()
close
in interface AutoCloseable
close
in interface Connection
public void abort(Executor executor)
abort
in interface Connection
public SQLWarning getWarnings() throws SQLException
getWarnings
in interface Connection
SQLException
public void clearWarnings() throws SQLException
clearWarnings
in interface Connection
SQLException
public int getNetworkTimeout() throws SQLException
getNetworkTimeout
in interface Connection
SQLException
public void setNetworkTimeout(Executor executor, int networkTimeout) throws SQLException
setNetworkTimeout
in interface Connection
SQLException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public boolean isWrapperFor(Class<?> iface)
isWrapperFor
in interface Wrapper
protected void connectionNotificationReceived(int processId, String channelName, String payload)
BasicContext
BasicContext.serverConnection
received
an asynchronous notificationconnectionNotificationReceived
in class BasicContext
public void addNotificationListener(PGNotificationListener listener)
PGConnection
addNotificationListener
in interface PGConnection
listener
- Notification listenerpublic void addNotificationListener(String channelNameFilter, PGNotificationListener listener)
PGConnection
addNotificationListener
in interface PGConnection
channelNameFilter
- Channel name based notification filter (Regular Expression)listener
- Notification listenerpublic void addNotificationListener(String name, String channelNameFilter, PGNotificationListener listener)
PGConnection
addNotificationListener
in interface PGConnection
name
- Name of listenerchannelNameFilter
- Channel name based notification filter (Regular Expression)listener
- Notification listenerpublic void removeNotificationListener(PGNotificationListener listener)
PGConnection
removeNotificationListener
in interface PGConnection
listener
- Listener instance to removepublic void removeNotificationListener(String listenerName)
PGConnection
removeNotificationListener
in interface PGConnection
listenerName
- Name of listener to removepublic void copyFrom(String sql, InputStream inputStream) throws SQLException
PGConnection
InputStream
stream to read from, instead of relying on System.in
.copyFrom
in interface PGConnection
sql
- SQL text for a valid COPY ... FROM STDIN
command.inputStream
- InputStream
containing data in COPY
format.SQLException
- If an error occurs during the copy operation or if an alternate command is provided.public void copyTo(String sql, OutputStream outputStream) throws SQLException
PGConnection
OutputStream
stream to write to, instead of relying on System.out
.copyTo
in interface PGConnection
sql
- SQL text for a valid COPY ... TO STDOUT
command.outputStream
- OutputStream
to write data in COPY
format.SQLException
- If an error occurs during the copy operation or if an alternate command is provided.