public class PostgresConnection extends JdbcConnection
JdbcConnection connection extension used for connecting to Postgres instances.JdbcConnection.CallPreparer, JdbcConnection.ConnectionFactory, JdbcConnection.Operations, JdbcConnection.ResultSetConsumer, JdbcConnection.SingleParameterResultSetConsumer, JdbcConnection.StatementFactory, JdbcConnection.StatementPreparer| Modifier and Type | Field and Description |
|---|---|
protected static JdbcConnection.ConnectionFactory |
FACTORY |
private static org.slf4j.Logger |
LOGGER |
private static String |
URL_PATTERN |
| Constructor and Description |
|---|
PostgresConnection(Configuration config)
Creates a Postgres connection using the supplied configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
String |
connectionString()
Returns a JDBC connection string for the current configuration.
|
Long |
currentTransactionId()
Returns the PG id of the current active transaction
|
long |
currentXLogLocation()
Returns the current position in the server tx log.
|
protected static void |
defaultSettings(Configuration.Builder builder) |
boolean |
dropReplicationSlot(String slotName)
Drops a replication slot that was created on the DB
|
PostgresConnection |
executeWithoutCommitting(String... statements)
Executes a series of statements without explicitly committing the connection.
|
ServerInfo.ReplicaIdentity |
readReplicaIdentityInfo(TableId tableId)
Prints out information about the REPLICA IDENTITY status of a table.
|
protected ServerInfo.ReplicationSlot |
readReplicationSlotInfo(String slotName,
String pluginName) |
ServerInfo |
serverInfo()
Returns information about the PG server to which this instance is connected.
|
private static void |
validateServerVersion(Statement statement) |
call, columnsFor, columnsFor, config, connect, connection, connectionString, database, execute, execute, isConnected, patternBasedFactory, patternBasedFactory, prepareQuery, prepareQuery, prepareQuery, prepareUpdate, print, print, query, query, readAllCatalogNames, readAllSchemaNames, readAllTableNames, readSchema, readTableNames, readTypeInfo, setAutoCommit, tableTypes, usernameprivate static final String URL_PATTERN
protected static JdbcConnection.ConnectionFactory FACTORY
private static org.slf4j.Logger LOGGER
public PostgresConnection(Configuration config)
config - Configuration instance, may not be null.public String connectionString()
String where the variables in urlPattern are replaced with values from the configurationpublic PostgresConnection executeWithoutCommitting(String... statements) throws SQLException
statements - a series of statements to executeSQLException - if anything failspublic ServerInfo.ReplicaIdentity readReplicaIdentityInfo(TableId tableId) throws SQLException
tableId - the identifier of the tableSQLException - if there is a problem obtaining the replica identity information for the given tableprotected ServerInfo.ReplicationSlot readReplicationSlotInfo(String slotName, String pluginName) throws SQLException
SQLExceptionpublic boolean dropReplicationSlot(String slotName)
slotName - the name of the replication slot, may not be nulltrue if the slot was dropped, false otherwisepublic void close()
close in interface AutoCloseableclose in class JdbcConnectionpublic Long currentTransactionId() throws SQLException
SQLException - if anything fails.public long currentXLogLocation()
throws SQLException
SQLException - if anything unexpected fails.public ServerInfo serverInfo() throws SQLException
ServerInfo instance, never nullSQLException - if anything failsprotected static void defaultSettings(Configuration.Builder builder)
private static void validateServerVersion(Statement statement) throws SQLException
SQLExceptionCopyright © 2017 JBoss by Red Hat. All rights reserved.