Access result columns in order, in case it helps performance.

This commit is contained in:
akwizgran
2013-03-15 16:55:29 +00:00
parent a94867907f
commit 5f8dba7bf6

View File

@@ -1275,8 +1275,8 @@ abstract class JdbcDatabase implements Database<Connection> {
ResultSet rs = null; ResultSet rs = null;
try { try {
String sql = "SELECT messageId, parentId, m.authorId, authorName," String sql = "SELECT messageId, parentId, m.authorId, authorName,"
+ " authorKey, contentType, subject, timestamp, read," + " authorKey, rating, contentType, subject, timestamp,"
+ " starred, rating" + " read, starred"
+ " FROM messages AS m" + " FROM messages AS m"
+ " LEFT OUTER JOIN ratings AS r" + " LEFT OUTER JOIN ratings AS r"
+ " ON m.authorId = r.authorId" + " ON m.authorId = r.authorId"
@@ -1301,13 +1301,13 @@ abstract class JdbcDatabase implements Database<Connection> {
String authorName = rs.getString(4); String authorName = rs.getString(4);
byte[] authorKey = rs.getBytes(5); byte[] authorKey = rs.getBytes(5);
author = new Author(authorId, authorName, authorKey); author = new Author(authorId, authorName, authorKey);
rating = Rating.values()[rs.getByte(11)]; rating = Rating.values()[rs.getByte(6)];
} }
String contentType = rs.getString(6); String contentType = rs.getString(7);
String subject = rs.getString(7); String subject = rs.getString(8);
long timestamp = rs.getLong(8); long timestamp = rs.getLong(9);
boolean read = rs.getBoolean(9); boolean read = rs.getBoolean(10);
boolean starred = rs.getBoolean(10); boolean starred = rs.getBoolean(11);
headers.add(new GroupMessageHeader(id, parent, contentType, headers.add(new GroupMessageHeader(id, parent, contentType,
subject, timestamp, read, starred, g, author, rating)); subject, timestamp, read, starred, g, author, rating));
} }