Code example for SQLiteDatabase

Methods: execSQLisReadOnly

0
        return mStoreDB.query(KEYVAL_TABLE_NAME, KEYVAL_COLUMNS, null, null, null, null, null);
    } 
 
    @Deprecated 
    private void createDatabaseTables(SQLiteDatabase sqLiteDatabase) {
        sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS " + KEYVAL_TABLE_NAME + "(" +
                KEYVAL_COLUMN_KEY + " TEXT PRIMARY KEY, " +
                KEYVAL_COLUMN_VAL + " TEXT)");
 
        sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS " + GOOGLE_MANAGED_ITEMS_TABLE_NAME + "(" +
                GOOGLE_MANAGED_ITEMS_COLUMN_PRODUCT_ID + " TEXT PRIMARY KEY)");
 
        sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS " + VIRTUAL_CURRENCY_TABLE_NAME + "(" +
                VIRTUAL_CURRENCY_COLUMN_ITEM_ID + " TEXT PRIMARY KEY, " +
                VIRTUAL_CURRENCY_COLUMN_BALANCE + " TEXT)");
 
        sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS " + VIRTUAL_GOODS_TABLE_NAME + "(" +
                VIRTUAL_GOODS_COLUMN_ITEM_ID + " TEXT PRIMARY KEY, " +
                VIRTUAL_GOODS_COLUMN_BALANCE + " TEXT, " +
                VIRTUAL_GOODS_COLUMN_EQUIPPED + " TEXT)");
 
        sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS " + METADATA_TABLE_NAME + "(" +
                METADATA_COLUMN_PACKAGE + " TEXT PRIMARY KEY, " +
                METADATA_COLUMN_STOREINFO + " TEXT, " +
                METADATA_COLUMN_STOREFRONTINFO + " TEXT)");
    } 
 
    @Deprecated 
    private class DatabaseHelper extends SQLiteOpenHelper{
 
        public DatabaseHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
        } 
 
        @Override 
        public void onCreate(SQLiteDatabase sqLiteDatabase) {
            if (!sqLiteDatabase.isReadOnly()){
                sqLiteDatabase.execSQL("PRAGMA foreign_key=ON");
            } 
 
            createDatabaseTables(sqLiteDatabase);
        }