数据库操作类:
public class DBOpenHelper extends SQLiteOpenHelper {
private static DBOpenHelper mDBOpenHelper;
private DBOpenHelper(Context context) {
super(context, Constants.NAME, null, Constants.VERSION);
}
public static DBOpenHelper getDBOpenHelper(Context context) {
if (mDBOpenHelper == null) {
mDBOpenHelper = new DBOpenHelper(context.getApplicationContext());
}
return mDBOpenHelper;
}
@Override
public void onCreate(SQLiteDatabase db) {
if(Constants.currentUserid != null){
db.execSQL("CREATE TABLE IF NOT EXISTS " + Constants.table_talkhistory + " (_id integer primary key autoincrement, name varchar(50), msg varchar(500), date datetime, employee_id integer)");
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {