From 5f8dba7bf6fb5f947e4edc7db40f6438a3d754aa Mon Sep 17 00:00:00 2001
From: akwizgran <michael@briarproject.org>
Date: Fri, 15 Mar 2013 16:55:29 +0000
Subject: [PATCH] Access result columns in order, in case it helps performance.

---
 briar-core/src/net/sf/briar/db/JdbcDatabase.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

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