aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/persistance
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-01-25 19:33:12 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-01-25 19:33:12 +0100
commit665ef7511f5dcccb349228baa2aa6f02281d3c07 (patch)
tree461ffa268dc16b299c68e764a3ae55ad912075c4 /src/de/gultsch/chat/persistance
parentdf9dcb1060d44a719e2892446b62cde884a880cf (diff)
all access to the persistance layer is now done via the new xmppservice
Diffstat (limited to 'src/de/gultsch/chat/persistance')
-rw-r--r--src/de/gultsch/chat/persistance/DatabaseBackend.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/de/gultsch/chat/persistance/DatabaseBackend.java b/src/de/gultsch/chat/persistance/DatabaseBackend.java
index 5ce7f7e03..dac83f586 100644
--- a/src/de/gultsch/chat/persistance/DatabaseBackend.java
+++ b/src/de/gultsch/chat/persistance/DatabaseBackend.java
@@ -8,7 +8,6 @@ import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
-import android.util.Log;
public class DatabaseBackend extends SQLiteOpenHelper {
@@ -23,7 +22,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
@Override
public void onCreate(SQLiteDatabase db) {
- db.execSQL("create table conversations (uuid TEXT, name TEXT, profilePhotoUri TEXT, accountUuid TEXT, contactJid TEXT)");
+ db.execSQL("create table conversations (uuid TEXT, name TEXT, profilePhotoUri TEXT, accountUuid TEXT, contactJid TEXT, created NUMBER, status NUMBER)");
}
@Override
@@ -34,7 +33,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
public static synchronized DatabaseBackend getInstance(Context context) {
if (instance == null) {
- instance = new DatabaseBackend(context.getApplicationContext());
+ instance = new DatabaseBackend(context);
}
return instance;
}
@@ -56,10 +55,8 @@ public class DatabaseBackend extends SQLiteOpenHelper {
List<Conversation> list = new ArrayList<Conversation>();
SQLiteDatabase db = this.getReadableDatabase();
String[] selectionArgs = {""+status};
- Cursor cursor = db.rawQuery("select * from conversations where status = ?", selectionArgs);
- Log.d("gultsch","getConversations has found "+cursor.getCount()+" rows");
+ Cursor cursor = db.rawQuery("select * from conversations where status = ? order by created desc", selectionArgs);
while(cursor.moveToNext()) {
- Log.d("gultsch","converting row #"+cursor.getPosition());
list.add(Conversation.fromCursor(cursor));
}
return list;