Removed an unused database method.

This commit is contained in:
akwizgran
2013-04-14 19:34:50 +01:00
parent 63121aecf9
commit 077efbbea1
4 changed files with 0 additions and 71 deletions

View File

@@ -203,10 +203,6 @@ public interface DatabaseComponent {
Collection<GroupMessageHeader> getMessageHeaders(GroupId g)
throws DbException;
/** Returns the headers of all private messages. */
Collection<PrivateMessageHeader> getPrivateMessageHeaders()
throws DbException;
/**
* Returns the headers of all private messages to or from the given
* contact.

View File

@@ -341,14 +341,6 @@ interface Database<T> {
Collection<GroupMessageHeader> getMessageHeaders(T txn, GroupId g)
throws DbException;
/**
* Returns the headers of all private messages.
* <p>
* Locking: message read.
*/
Collection<PrivateMessageHeader> getPrivateMessageHeaders(T txn)
throws DbException;
/**
* Returns the headers of all private messages to or from the given
* contact.

View File

@@ -1124,25 +1124,6 @@ DatabaseCleaner.Callback {
}
}
public Collection<PrivateMessageHeader> getPrivateMessageHeaders()
throws DbException {
messageLock.readLock().lock();
try {
T txn = db.startTransaction();
try {
Collection<PrivateMessageHeader> headers =
db.getPrivateMessageHeaders(txn);
db.commitTransaction(txn);
return headers;
} catch(DbException e) {
db.abortTransaction(txn);
throw e;
}
} finally {
messageLock.readLock().unlock();
}
}
public Collection<PrivateMessageHeader> getPrivateMessageHeaders(
ContactId c) throws DbException {
messageLock.readLock().lock();

View File

@@ -1762,46 +1762,6 @@ abstract class JdbcDatabase implements Database<Connection> {
}
}
public Collection<PrivateMessageHeader> getPrivateMessageHeaders(
Connection txn) throws DbException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = "SELECT m.messageId, parentId, contentType, subject,"
+ " timestamp, m.contactId, read, starred, seen"
+ " FROM messages AS m"
+ " JOIN statuses AS s"
+ " ON m.messageId = s.messageId"
+ " AND m.contactId = s.contactId"
+ " WHERE groupId IS NULL";
ps = txn.prepareStatement(sql);
rs = ps.executeQuery();
List<PrivateMessageHeader> headers =
new ArrayList<PrivateMessageHeader>();
while(rs.next()) {
MessageId id = new MessageId(rs.getBytes(1));
byte[] b = rs.getBytes(2);
MessageId parent = b == null ? null : new MessageId(b);
String contentType = rs.getString(3);
String subject = rs.getString(4);
long timestamp = rs.getLong(5);
ContactId contactId = new ContactId(rs.getInt(6));
boolean read = rs.getBoolean(7);
boolean starred = rs.getBoolean(8);
boolean seen = rs.getBoolean(9);
headers.add(new PrivateMessageHeader(id, parent, contentType,
subject, timestamp, read, starred, contactId, seen));
}
rs.close();
ps.close();
return Collections.unmodifiableList(headers);
} catch(SQLException e) {
tryToClose(rs);
tryToClose(ps);
throw new DbException(e);
}
}
public Collection<PrivateMessageHeader> getPrivateMessageHeaders(
Connection txn, ContactId c) throws DbException {
PreparedStatement ps = null;