From e0cf48779d22497b8f967b3a975237f6c2d06032 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 11 Mar 2016 18:21:25 -0800 Subject: [PATCH] delete a game's entries in chats table when it's deleted --- .../XWords4/src/org/eehouse/android/xw4/DBUtils.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java index d134a784c..88d47dc4d 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java @@ -1107,8 +1107,9 @@ public class DBUtils { public static void deleteGame( Context context, GameLock lock ) { Assert.assertTrue( lock.canWrite() ); - String selSummaries = String.format( ROW_ID_FMT, lock.getRowid() ); - String selInvites = String.format( "%s=%d", DBHelper.ROW, lock.getRowid() ); + long rowid = lock.getRowid(); + String selSummaries = String.format( ROW_ID_FMT, rowid ); + String selInvites = String.format( "%s=%d", DBHelper.ROW, rowid ); initDB( context ); synchronized( s_dbHelper ) { @@ -1117,6 +1118,9 @@ public class DBUtils { // Delete invitations too db.delete( DBHelper.TABLE_NAME_INVITES, selInvites, null ); + + // Delete chats too -- same sel as for invites + db.delete( DBHelper.TABLE_NAME_CHAT, selInvites, null ); db.close(); } @@ -1766,7 +1770,7 @@ public class DBUtils { ArrayList valuess = new ArrayList(); valuess.add( cvForChat( rowid, msg, fromPlayer ) ); appendChatHistory( context, valuess ); - DbgUtils.logf( "appendChatHistory: inserted %s from player %d", + DbgUtils.logf( "appendChatHistory: inserted \"%s\" from player %d", msg, fromPlayer ); } // appendChatHistory