public static Subscription getSubscription(final Connection conn,
final String schema, final String table) throws SQLException,
SyncDatabaseException {
if (conn == null || schema == null || table == null) {
throw new SyncDatabaseException("error.argument");
}
PreparedStatement pstmt = null;
ResultSet rset = null;
try {
pstmt = conn.prepareStatement("SELECT * "
+ "FROM observer.v$subscription "
+ "WHERE nspname = ? AND relname = ?");
pstmt.setString(1, schema);
pstmt.setString(2, table);
rset = pstmt.executeQuery();
// not found
if (!rset.next()) {
throw new SyncDatabaseException("error.no_subscription",
SyncDatabaseDAO.getTablePrint(schema, table));
}
return new Subscription(rset.getString(SUBSCRIPTION_NSPNAME), rset
.getString(SUBSCRIPTION_RELNAME), rset