From ad5bcb7d43494dd90d555cee42b9c69ec7326f1f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 16 Jan 2016 18:57:19 +0100 Subject: [PATCH] removed some unused methods from db backend --- .../persistance/DatabaseBackend.java | 83 ------------------- 1 file changed, 83 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java index d6e580dff..77c16f25b 100644 --- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -379,22 +379,6 @@ public class DatabaseBackend extends SQLiteOpenHelper { db.insert(Account.TABLENAME, null, account.getContentValues()); } - public void createContact(Contact contact) { - SQLiteDatabase db = this.getWritableDatabase(); - db.insert(Contact.TABLENAME, null, contact.getContentValues()); - } - - public int getConversationCount() { - SQLiteDatabase db = this.getReadableDatabase(); - Cursor cursor = db.rawQuery("select count(uuid) as count from " - + Conversation.TABLENAME + " where " + Conversation.STATUS - + "=" + Conversation.STATUS_AVAILABLE, null); - cursor.moveToFirst(); - int count = cursor.getInt(0); - cursor.close(); - return count; - } - public CopyOnWriteArrayList getConversations(int status) { CopyOnWriteArrayList list = new CopyOnWriteArrayList<>(); SQLiteDatabase db = this.getReadableDatabase(); @@ -593,12 +577,6 @@ public class DatabaseBackend extends SQLiteOpenHelper { updateAccount(account); } - public void deleteMessage(Message message) { - SQLiteDatabase db = this.getWritableDatabase(); - String[] args = {message.getUuid()}; - db.delete(Message.TABLENAME, Message.UUID + "=?", args); - } - public void deleteMessagesInConversation(Conversation conversation) { SQLiteDatabase db = this.getWritableDatabase(); String[] args = {conversation.getUuid()}; @@ -622,67 +600,6 @@ public class DatabaseBackend extends SQLiteOpenHelper { } } - public Conversation findConversationByUuid(String conversationUuid) { - SQLiteDatabase db = this.getReadableDatabase(); - String[] selectionArgs = {conversationUuid}; - Cursor cursor = db.query(Conversation.TABLENAME, null, - Conversation.UUID + "=?", selectionArgs, null, null, null); - if (cursor.getCount() == 0) { - return null; - } - cursor.moveToFirst(); - Conversation conversation = Conversation.fromCursor(cursor); - cursor.close(); - return conversation; - } - - public Message findMessageByUuid(String messageUuid) { - SQLiteDatabase db = this.getReadableDatabase(); - String[] selectionArgs = {messageUuid}; - Cursor cursor = db.query(Message.TABLENAME, null, Message.UUID + "=?", - selectionArgs, null, null, null); - if (cursor.getCount() == 0) { - return null; - } - cursor.moveToFirst(); - Message message = Message.fromCursor(cursor); - cursor.close(); - return message; - } - - public Account findAccountByUuid(String accountUuid) { - SQLiteDatabase db = this.getReadableDatabase(); - String[] selectionArgs = {accountUuid}; - Cursor cursor = db.query(Account.TABLENAME, null, Account.UUID + "=?", - selectionArgs, null, null, null); - if (cursor.getCount() == 0) { - return null; - } - cursor.moveToFirst(); - Account account = Account.fromCursor(cursor); - cursor.close(); - return account; - } - - public List getImageMessages(Conversation conversation) { - ArrayList list = new ArrayList<>(); - SQLiteDatabase db = this.getReadableDatabase(); - Cursor cursor; - String[] selectionArgs = {conversation.getUuid(), String.valueOf(Message.TYPE_IMAGE)}; - cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION - + "=? AND " + Message.TYPE + "=?", selectionArgs, null, null, null); - if (cursor.getCount() > 0) { - cursor.moveToLast(); - do { - Message message = Message.fromCursor(cursor); - message.setConversation(conversation); - list.add(message); - } while (cursor.moveToPrevious()); - } - cursor.close(); - return list; - } - private Cursor getCursorForSession(Account account, AxolotlAddress contact) { final SQLiteDatabase db = this.getReadableDatabase(); String[] columns = null;