Commit ff4c1021 authored by Roman S's avatar Roman S

Merge pull request #251 from tomatis/master

Restored and separated Database-Query for MYSQL
parents 462dc7b9 97842483
...@@ -73,6 +73,13 @@ public class PubSubPersistenceManager { ...@@ -73,6 +73,13 @@ public class PubSubPersistenceManager {
"ON ofPubsubItem.id = noDelete.id WHERE noDelete.id IS NULL AND " + "ON ofPubsubItem.id = noDelete.id WHERE noDelete.id IS NULL AND " +
"ofPubsubItem.serviceID = ? AND nodeID = ?"; "ofPubsubItem.serviceID = ? AND nodeID = ?";
private static final String PURGE_FOR_SIZE_MYSQL =
"DELETE ofPubsubItem 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_POSTGRESQL = private static final String PURGE_FOR_SIZE_POSTGRESQL =
"DELETE from ofPubsubItem where id in " + "DELETE from ofPubsubItem where id in " +
"(select ofPubsubItem.id FROM ofPubsubItem LEFT JOIN " + "(select ofPubsubItem.id FROM ofPubsubItem LEFT JOIN " +
...@@ -1924,6 +1931,8 @@ public class PubSubPersistenceManager { ...@@ -1924,6 +1931,8 @@ public class PubSubPersistenceManager {
{ {
case postgresql: case postgresql:
return PURGE_FOR_SIZE_POSTGRESQL; return PURGE_FOR_SIZE_POSTGRESQL;
case mysql:
return PURGE_FOR_SIZE_MYSQL;
case hsqldb: case hsqldb:
return PURGE_FOR_SIZE_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