Commit 5fc6ca89 authored by akrherz's avatar akrherz

add specific clause for postgresql to purge ofPubsubItem

http://issues.igniterealtime.org/browse/OF-756
parent ed98704b
......@@ -72,6 +72,14 @@ public class PubSubPersistenceManager {
"ORDER BY creationDate DESC LIMIT ?) AS noDelete " +
"ON ofPubsubItem.id = noDelete.id WHERE noDelete.id IS NULL AND " +
"ofPubsubItem.serviceID = ? AND nodeID = ?";
private static final String PURGE_FOR_SIZE_POSTGRESQL =
"DELETE from ofPubsubItem where id in " +
"(select ofPubsubItem.id FROM ofPubsubItem LEFT JOIN " +
"(SELECT id FROM ofPubsubItem WHERE serviceID=? AND nodeID=? " +
"ORDER BY creationDate DESC LIMIT ?) AS noDelete " +
"ON ofPubsubItem.id = noDelete.id WHERE noDelete.id IS NULL " +
"AND ofPubsubItem.serviceID = ? AND nodeID = ?)";
private static final String PURGE_FOR_SIZE_HSQLDB = "DELETE FROM ofPubsubItem WHERE serviceID=? AND nodeID=? AND id NOT IN "
+ "(SELECT id FROM ofPubsubItem WHERE serviceID=? AND nodeID=? ORDER BY creationDate DESC LIMIT ?)";
......@@ -1917,6 +1925,8 @@ public class PubSubPersistenceManager {
{
switch (type)
{
case postgresql:
return PURGE_FOR_SIZE_POSTGRESQL;
case hsqldb:
return PURGE_FOR_SIZE_HSQLDB;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment