1 package com.example.groom;
3 import android.content.Context;
4 import android.database.sqlite.SQLiteDatabase;
5 import android.database.sqlite.SQLiteOpenHelper;
12 "CREATE TABLE occupants (" +
13 "idOccupant INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," +
14 "nom VARCHAR(45) NULL," +
15 "prenom VARCHAR(45) NULL," +
16 "fonction VARCHAR(45) NULL);";
18 "CREATE TABLE preferences (" +
19 "idPreferences INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," +
20 "groom VARCHAR(45) NULL," +
21 "idPrecedentOccupant INTEGER NOT NULL, " +
22 "FOREIGN KEY (idPrecedentOccupant) REFERENCES occupants (idOccupant);";
26 super(context, DATABASE_NAME, null, DATABASE_VERSION);
32 db.execSQL(CREATE_BDD_OCCUPANTS);
33 db.execSQL(CREATE_BDD_PREFERENCES);
37 public void onUpgrade(SQLiteDatabase db,
int oldVersion,
int newVersion)
39 db.execSQL(
"DROP TABLE occupants;");
40 db.execSQL(
"DROP TABLE preferences");
static final String CREATE_BDD_OCCUPANTS
static final int DATABASE_VERSION
static final String DATABASE_NAME
void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
void onCreate(SQLiteDatabase db)
GroomSQLite(Context context)
static final String CREATE_BDD_PREFERENCES