If you think the Android project Netball listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.prisch.model;
/*fromwww.java2s.com*/import android.database.sqlite.SQLiteDatabase;
publicclass Game {
// ===== Convenience Methods =====
publicstatic String prefixTable(String column) {
return TABLE + "." + column;
}
// ===== Database Scaffolding =====
publicstaticvoid onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_SCRIPT);
}
publicstaticvoid onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(DROP_SCRIPT);
onCreate(db);
}
// ===== Constants =====
publicstaticfinal String ID = "_id";
publicstaticfinal String DATE = "date";
publicstaticfinal String NAME = "name";
publicstaticfinal String TEAM_SCORE = "team_score";
publicstaticfinal String OPPONENT_SCORE = "opponent_score";
publicstaticfinal String ACTIVE = "active";
publicstaticfinal String TABLE = "game";
privatestaticfinal String CREATE_SCRIPT = "CREATE TABLE " + TABLE + " ("
+ ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ DATE + " INTEGER NOT NULL UNIQUE,"
+ NAME + " TEXT NOT NULL,"
+ TEAM_SCORE + " INTEGER NOT NULL,"
+ OPPONENT_SCORE + " INTEGER NOT NULL,"
+ ACTIVE + " NUMERIC NOT NULL);";
privatestaticfinal String DROP_SCRIPT = "DROP TABLE " + TABLE;
}