mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
delete a game's entries in chats table when it's deleted
This commit is contained in:
parent
5d9de30170
commit
78f0ac7783
1 changed files with 7 additions and 3 deletions
|
@ -1107,8 +1107,9 @@ public class DBUtils {
|
||||||
public static void deleteGame( Context context, GameLock lock )
|
public static void deleteGame( Context context, GameLock lock )
|
||||||
{
|
{
|
||||||
Assert.assertTrue( lock.canWrite() );
|
Assert.assertTrue( lock.canWrite() );
|
||||||
String selSummaries = String.format( ROW_ID_FMT, lock.getRowid() );
|
long rowid = lock.getRowid();
|
||||||
String selInvites = String.format( "%s=%d", DBHelper.ROW, lock.getRowid() );
|
String selSummaries = String.format( ROW_ID_FMT, rowid );
|
||||||
|
String selInvites = String.format( "%s=%d", DBHelper.ROW, rowid );
|
||||||
|
|
||||||
initDB( context );
|
initDB( context );
|
||||||
synchronized( s_dbHelper ) {
|
synchronized( s_dbHelper ) {
|
||||||
|
@ -1117,6 +1118,9 @@ public class DBUtils {
|
||||||
|
|
||||||
// Delete invitations too
|
// Delete invitations too
|
||||||
db.delete( DBHelper.TABLE_NAME_INVITES, selInvites, null );
|
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();
|
db.close();
|
||||||
}
|
}
|
||||||
|
@ -1766,7 +1770,7 @@ public class DBUtils {
|
||||||
ArrayList<ContentValues> valuess = new ArrayList<ContentValues>();
|
ArrayList<ContentValues> valuess = new ArrayList<ContentValues>();
|
||||||
valuess.add( cvForChat( rowid, msg, fromPlayer ) );
|
valuess.add( cvForChat( rowid, msg, fromPlayer ) );
|
||||||
appendChatHistory( context, valuess );
|
appendChatHistory( context, valuess );
|
||||||
DbgUtils.logf( "appendChatHistory: inserted %s from player %d",
|
DbgUtils.logf( "appendChatHistory: inserted \"%s\" from player %d",
|
||||||
msg, fromPlayer );
|
msg, fromPlayer );
|
||||||
} // appendChatHistory
|
} // appendChatHistory
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue