Package com.impossibl.postgres.api.jdbc
Interface PGConnection
-
- All Superinterfaces:
AutoCloseable
,Connection
,Wrapper
- All Known Implementing Classes:
PGDirectConnection
,PGPooledConnectionDelegator
,PGXAConnectionDelegator
public interface PGConnection extends Connection
Public API for PGConnection
-
-
Field Summary
-
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addNotificationListener(PGNotificationListener listener)
Adds an, unnamed, unfiltered, asynchronous notification listener to this connectionvoid
addNotificationListener(String channelNameFilter, PGNotificationListener listener)
Adds an, unnamed, filtered, asynchronous notification listener to this connectionvoid
addNotificationListener(String name, String channelNameFilter, PGNotificationListener listener)
Adds a filtered asynchronous notification listener to this connectionvoid
copyFrom(String sql, InputStream inputStream)
Allows issuing PostgreSQL's COPY command providing anInputStream
stream to read from, instead of relying onSystem.in
.void
copyTo(String sql, OutputStream outputStream)
Allows issuing PostgreSQL's COPY command providing anOutputStream
stream to write to, instead of relying onSystem.out
.Integer
getDefaultFetchSize()
Get the default fetch sizeboolean
isServerMinimumVersion(int major, int minor)
Checks the minimum server versionboolean
isStrictMode()
Is strict modevoid
removeNotificationListener(PGNotificationListener listener)
Removes a notification listenervoid
removeNotificationListener(String name)
Removes a named notification listenerPGAnyType
resolveType(String name)
Resolves a name to an SQLType suitable for passing to any method that accepts one.void
setDefaultFetchSize(Integer v)
Set the default fetch sizevoid
setStrictMode(boolean v)
Set strict mode-
Methods inherited from interface java.sql.Connection
abort, beginRequest, clearWarnings, close, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, endRequest, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid, setTransactionIsolation, setTypeMap
-
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
Method Detail
-
isServerMinimumVersion
boolean isServerMinimumVersion(int major, int minor)
Checks the minimum server version- Parameters:
major
- The major releaseminor
- The minor release- Returns:
True
if the server is minimum the specified version, otherwisefalse
.
-
addNotificationListener
void addNotificationListener(String name, String channelNameFilter, PGNotificationListener listener)
Adds a filtered asynchronous notification listener to this connection- Parameters:
name
- Name of listenerchannelNameFilter
- Channel name based notification filter (Regular Expression)listener
- Notification listener
-
addNotificationListener
void addNotificationListener(String channelNameFilter, PGNotificationListener listener)
Adds an, unnamed, filtered, asynchronous notification listener to this connection- Parameters:
channelNameFilter
- Channel name based notification filter (Regular Expression)listener
- Notification listener
-
addNotificationListener
void addNotificationListener(PGNotificationListener listener)
Adds an, unnamed, unfiltered, asynchronous notification listener to this connection- Parameters:
listener
- Notification listener
-
removeNotificationListener
void removeNotificationListener(String name)
Removes a named notification listener- Parameters:
name
- Name of listener to remove
-
removeNotificationListener
void removeNotificationListener(PGNotificationListener listener)
Removes a notification listener- Parameters:
listener
- Listener instance to remove
-
setStrictMode
void setStrictMode(boolean v)
Set strict mode- Parameters:
v
- The value
-
isStrictMode
boolean isStrictMode()
Is strict mode- Returns:
- The value
-
setDefaultFetchSize
void setDefaultFetchSize(Integer v)
Set the default fetch size- Parameters:
v
- The value
-
getDefaultFetchSize
Integer getDefaultFetchSize()
Get the default fetch size- Returns:
- The value
-
resolveType
PGAnyType resolveType(String name) throws SQLException
Resolves a name to an SQLType suitable for passing to any method that accepts one. As the method queries the server for the type information any type name acceptable to the server is allowed (i.e. qualified, unqualified, quoted, etc.) Using this method allows the resolution of a name to a type to be re-used; speeding up performance in cases where named types are used. NOTE: The possibility of DDL changing the name to type mapping means named types are always looked up when used. This ensures that the correct type is used always. When resolving a named type using this method it is only valid as long as no commands are issued that invalidate it (e.g. dropping and re-adding a type or extension).- Parameters:
name
- Name of type to resolve (anything acceptable to the server)- Returns:
- Type instance representing the current name to type mapping.
- Throws:
SQLException
-
copyFrom
void copyFrom(String sql, InputStream inputStream) throws SQLException
Allows issuing PostgreSQL's COPY command providing anInputStream
stream to read from, instead of relying onSystem.in
.- Parameters:
sql
- SQL text for a validCOPY ... FROM STDIN
command.inputStream
-InputStream
containing data inCOPY
format.- Throws:
SQLException
- If an error occurs during the copy operation or if an alternate command is provided.
-
copyTo
void copyTo(String sql, OutputStream outputStream) throws SQLException
Allows issuing PostgreSQL's COPY command providing anOutputStream
stream to write to, instead of relying onSystem.out
.- Parameters:
sql
- SQL text for a validCOPY ... TO STDOUT
command.outputStream
-OutputStream
to write data inCOPY
format.- Throws:
SQLException
- If an error occurs during the copy operation or if an alternate command is provided.
-
-