mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
add new column to store mac addresses of remote devices in this game via BT.
This commit is contained in:
parent
796baffa6d
commit
52ffefb173
1 changed files with 20 additions and 17 deletions
|
@ -29,7 +29,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
public static final String TABLE_NAME_SUM = "summaries";
|
public static final String TABLE_NAME_SUM = "summaries";
|
||||||
public static final String TABLE_NAME_OBITS = "obits";
|
public static final String TABLE_NAME_OBITS = "obits";
|
||||||
private static final String DB_NAME = "xwdb";
|
private static final String DB_NAME = "xwdb";
|
||||||
private static final int DB_VERSION = 11;
|
private static final int DB_VERSION = 12;
|
||||||
|
|
||||||
public static final String GAME_NAME = "GAME_NAME";
|
public static final String GAME_NAME = "GAME_NAME";
|
||||||
public static final String NUM_MOVES = "NUM_MOVES";
|
public static final String NUM_MOVES = "NUM_MOVES";
|
||||||
|
@ -47,6 +47,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
// for which messages arrive. Add now while changing the DB
|
// for which messages arrive. Add now while changing the DB
|
||||||
// format
|
// format
|
||||||
public static final String GAMEID = "GAMEID";
|
public static final String GAMEID = "GAMEID";
|
||||||
|
public static final String REMOTEDEVS = "REMOTEDEVS";
|
||||||
public static final String DICTLANG = "DICTLANG";
|
public static final String DICTLANG = "DICTLANG";
|
||||||
public static final String DICTLIST = "DICTLIST";
|
public static final String DICTLIST = "DICTLIST";
|
||||||
public static final String HASMSGS = "HASMSGS";
|
public static final String HASMSGS = "HASMSGS";
|
||||||
|
@ -96,6 +97,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
+ SCORES + " TEXT,"
|
+ SCORES + " TEXT,"
|
||||||
+ CHAT_HISTORY + " TEXT,"
|
+ CHAT_HISTORY + " TEXT,"
|
||||||
+ GAMEID + " INTEGER,"
|
+ GAMEID + " INTEGER,"
|
||||||
|
+ REMOTEDEVS + " TEXT,"
|
||||||
// HASMSGS: sqlite doesn't have bool; use 0 and 1
|
// HASMSGS: sqlite doesn't have bool; use 0 and 1
|
||||||
+ HASMSGS + " INTEGER DEFAULT 0,"
|
+ HASMSGS + " INTEGER DEFAULT 0,"
|
||||||
+ CONTRACTED + " INTEGER DEFAULT 0,"
|
+ CONTRACTED + " INTEGER DEFAULT 0,"
|
||||||
|
@ -132,27 +134,21 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
case 5:
|
case 5:
|
||||||
onCreateObits(db);
|
onCreateObits(db);
|
||||||
case 6:
|
case 6:
|
||||||
db.execSQL( "ALTER TABLE " + TABLE_NAME_SUM +
|
addColumn( db, TURN, "INTEGER" );
|
||||||
" ADD COLUMN " + TURN + " INTEGER;" );
|
addColumn( db, GIFLAGS, "INTEGER" );
|
||||||
db.execSQL( "ALTER TABLE " + TABLE_NAME_SUM +
|
addColumn( db, CHAT_HISTORY, "TEXT" );
|
||||||
" ADD COLUMN " + GIFLAGS + " INTEGER;" );
|
|
||||||
db.execSQL( "ALTER TABLE " + TABLE_NAME_SUM +
|
|
||||||
" ADD COLUMN " + CHAT_HISTORY + " TEXT;" );
|
|
||||||
case 7:
|
case 7:
|
||||||
db.execSQL( "ALTER TABLE " + TABLE_NAME_SUM +
|
addColumn( db, MISSINGPLYRS, "INTEGER" );
|
||||||
" ADD COLUMN " + MISSINGPLYRS + " INTEGER;" );
|
|
||||||
case 8:
|
case 8:
|
||||||
db.execSQL( "ALTER TABLE " + TABLE_NAME_SUM +
|
addColumn( db, GAME_NAME, "TEXT" );
|
||||||
" ADD COLUMN " + GAME_NAME + " TEXT;" );
|
addColumn( db, CONTRACTED, "INTEGER" );
|
||||||
db.execSQL( "ALTER TABLE " + TABLE_NAME_SUM +
|
|
||||||
" ADD COLUMN " + CONTRACTED + " INTEGER;" );
|
|
||||||
case 9:
|
case 9:
|
||||||
db.execSQL( "ALTER TABLE " + TABLE_NAME_SUM +
|
addColumn( db, DICTLIST, "TEXT" );
|
||||||
" ADD COLUMN " + DICTLIST + " TEXT;" );
|
|
||||||
case 10:
|
case 10:
|
||||||
db.execSQL( "ALTER TABLE " + TABLE_NAME_SUM +
|
addColumn( db, INVITEID, "TEXT" );
|
||||||
" ADD COLUMN " + INVITEID + " TEXT;" );
|
|
||||||
case 11:
|
case 11:
|
||||||
|
addColumn( db, REMOTEDEVS, "TEXT" );
|
||||||
|
case 12:
|
||||||
// nothing yet
|
// nothing yet
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -163,4 +159,11 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
onCreate( db );
|
onCreate( db );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addColumn( SQLiteDatabase db, String colName, String colType )
|
||||||
|
{
|
||||||
|
String cmd = String.format( "ALTER TABLE %s ADD COLUMN %s %s;",
|
||||||
|
TABLE_NAME_SUM, colName, colType );
|
||||||
|
db.execSQL( cmd );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue