Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package br.org.lsitec.overlaycenter.model;
- import android.content.Context;
- import android.database.sqlite.SQLiteDatabase;
- import android.database.sqlite.SQLiteOpenHelper;
- import android.provider.BaseColumns;
- import android.util.Log;
- public final class DBTable {
- private DBTable() {}
- public static class PropertyTable implements BaseColumns {
- public static final String TABLE_NAME = "properties";
- public static final String PROP_NAME = "name";
- public static final String PROP_FUNC = "function";
- }
- public static class DBController extends SQLiteOpenHelper {
- public static final int DB_VERSION = '1';
- public static final String DB_NAME = "properties.db";
- public DBController(Context context) {
- super(context, DB_NAME, null, DB_VERSION);
- }
- @Override
- public void onCreate(SQLiteDatabase db) {
- db.execSQL(SQL_CREATE_ENTRIES);
- }
- @Override
- public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
- db.execSQL(SQL_DELETE_ENTRIES);
- onCreate(db);
- }
- }
- private static final String SQL_CREATE_ENTRIES = "CREATE TABLE " + PropertyTable.TABLE_NAME +
- " (" + PropertyTable._ID + " INTEGER PRIMARY KEY, " + PropertyTable.PROP_NAME + " TEXT, " +
- PropertyTable.PROP_FUNC + " TEXT)";
- private static final String SQL_DELETE_ENTRIES = "DROP TABLE IF EXISTS " + PropertyTable.TABLE_NAME;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement