Code example for SQLiteDatabase

Methods: compileStatementexecSQLquery

0
    public int startPerformance(Intermediates intermediates) {
        return 1; 
    } 
 
    private void populateDefaultTable() { 
        mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data TEXT);");
 
        mDatabase.execSQL("INSERT INTO test (data) VALUES ('" + sString1 + "');");
        mDatabase.execSQL("INSERT INTO test (data) VALUES ('" + sString2 + "');");
        mDatabase.execSQL("INSERT INTO test (data) VALUES ('" + sString3 + "');");
    } 
 
    @MediumTest 
    public void testExecuteStatement() throws Exception { 
        populateDefaultTable(); 
        SQLiteStatement statement = mDatabase.compileStatement("DELETE FROM test");
        statement.execute();
 
        Cursor c = mDatabase.query("test", null, null, null, null, null, null);
        assertEquals(0, c.getCount());
        c.deactivate();
        statement.close();
    } 
 
Contextual code suggestions in your IDE  Get Codota for Java