mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
toward using chat senders' names in history: add chats table so we can
keep track of sender as a separate column rather than a prepended string. I'm committing this separately for easier debugging of the code that uses it and that converts from the old format.
This commit is contained in:
parent
d536d05e24
commit
f5bc9ca434
1 changed files with 20 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
|
||||
/*
|
||||
* Copyright 2009-2010 by Eric House (xwords@eehouse.org). All
|
||||
* Copyright 2009-2016 by Eric House (xwords@eehouse.org). All
|
||||
* rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -42,8 +42,9 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
public static final String TABLE_NAME_LOC = "loc";
|
||||
public static final String TABLE_NAME_PAIRS = "pairs";
|
||||
public static final String TABLE_NAME_INVITES = "invites";
|
||||
public static final String TABLE_NAME_CHAT = "chat";
|
||||
private static final String DB_NAME = "xwdb";
|
||||
private static final int DB_VERSION = 25;
|
||||
private static final int DB_VERSION = 26;
|
||||
|
||||
public static final String GAME_NAME = "GAME_NAME";
|
||||
public static final String VISID = "VISID";
|
||||
|
@ -111,6 +112,9 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
public static final String TARGET = "TARGET";
|
||||
public static final String TIMESTAMP = "TIMESTAMP";
|
||||
|
||||
public static final String SENDER = "SENDER";
|
||||
public static final String MESSAGE = "MESSAGE";
|
||||
|
||||
private Context m_context;
|
||||
|
||||
private static final String[][] s_summaryColsAndTypes = {
|
||||
|
@ -206,6 +210,12 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
,{ TIMESTAMP, "DATETIME DEFAULT CURRENT_TIMESTAMP" }
|
||||
};
|
||||
|
||||
private static final String[][] s_chatsSchema = {
|
||||
{ ROW, "INTEGER" }
|
||||
,{ SENDER, "INTEGER" }
|
||||
,{ MESSAGE, "TEXT" }
|
||||
};
|
||||
|
||||
public DBHelper( Context context )
|
||||
{
|
||||
super( context, DB_NAME, null, DB_VERSION );
|
||||
|
@ -230,6 +240,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
createLocTable( db );
|
||||
createPairsTable( db );
|
||||
createInvitesTable( db );
|
||||
createChatsTable( db );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -297,6 +308,8 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
case 24:
|
||||
createInvitesTable( db );
|
||||
case 25:
|
||||
createChatsTable( db );
|
||||
|
||||
break;
|
||||
default:
|
||||
|
@ -401,6 +414,11 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
createTable( db, TABLE_NAME_INVITES, s_invitesSchema );
|
||||
}
|
||||
|
||||
private void createChatsTable( SQLiteDatabase db )
|
||||
{
|
||||
createTable( db, TABLE_NAME_CHAT, s_chatsSchema );
|
||||
}
|
||||
|
||||
// Move all existing games to the row previously named "cur games'
|
||||
private void moveToCurGames( SQLiteDatabase db )
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue