1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.Random;
/**
* Created by ProgrammingKnowledge on 4/3/2015.
*/
@SuppressWarnings("deprecation")
public class DatabaseHelper extends SQLiteOpenHelper {
public static final String DATABASE_NAME;
public static final String TABLE_NAME;
static {
DATABASE_NAME = "traduction.db";
TABLE_NAME = "mots";
}
public static final String COL_1 = "ID";
public static final String COL_2 = "V_FR";
public static final String COL_3 = "V_PL";
// public static final String COL_4 = "Rep_USER";
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, 2);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + TABLE_NAME +" (ID INTEGER PRIMARY KEY AUTOINCREMENT,V_FR TEXT, V_PL TEXT)"); //REP_USER TEXT)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS "+TABLE_NAME);
onCreate(db); |
Partager