Search in sources :

Example 11 with LinkDefinition

use of org.apache.qpid.server.protocol.v1_0.LinkDefinition in project qpid-broker-j by apache.

the class JDBCLinkStore method doDeleteLink.

@Override
protected void doDeleteLink(final LinkDefinition<Source, Target> link) throws StoreException {
    try (Connection connection = getConnection();
        PreparedStatement preparedStatement = connection.prepareStatement(String.format("DELETE FROM %s WHERE link_key = ?", getLinksTableName()))) {
        preparedStatement.setString(1, generateLinkKey(link));
        preparedStatement.execute();
    } catch (SQLException e) {
        throw new StoreException(String.format("Cannot delete link %s", new LinkKey(link)), e);
    }
}
Also used : LinkKey(org.apache.qpid.server.protocol.v1_0.LinkKey) SQLException(java.sql.SQLException) Connection(java.sql.Connection) PreparedStatement(java.sql.PreparedStatement) StoreException(org.apache.qpid.server.store.StoreException)

Aggregations

LinkKey (org.apache.qpid.server.protocol.v1_0.LinkKey)8 StoreException (org.apache.qpid.server.store.StoreException)8 PreparedStatement (java.sql.PreparedStatement)5 Database (com.sleepycat.je.Database)3 DatabaseEntry (com.sleepycat.je.DatabaseEntry)3 Connection (java.sql.Connection)3 SQLException (java.sql.SQLException)3 LinkDefinition (org.apache.qpid.server.protocol.v1_0.LinkDefinition)3 OperationStatus (com.sleepycat.je.OperationStatus)2 ResultSet (java.sql.ResultSet)2 ModelVersion (org.apache.qpid.server.model.ModelVersion)2 BaseSource (org.apache.qpid.server.protocol.v1_0.type.BaseSource)2 BaseTarget (org.apache.qpid.server.protocol.v1_0.type.BaseTarget)2 Source (org.apache.qpid.server.protocol.v1_0.type.messaging.Source)2 Target (org.apache.qpid.server.protocol.v1_0.type.messaging.Target)2 Cursor (com.sleepycat.je.Cursor)1 DatabaseNotFoundException (com.sleepycat.je.DatabaseNotFoundException)1 Transaction (com.sleepycat.je.Transaction)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1