Code example for SQLiteDatabase

Methods: execSQLrawQuery

0
        assertEquals(mGoodDb.rawQuery("SELECT _id FROM Events;", null).getCount(), 2);
    } 
 
    private void addVersion67Events() { 
        // April 5th 1:01:01 AM to April 6th 1:01:01 
        mBadDb.execSQL("INSERT INTO Events (_id,dtstart,dtend,duration,dtstart2,dtend2," +
                "eventTimezone,eventTimezone2,allDay,calendar_id) " + 
                "VALUES (1,1270454471000,1270540872000,'P10S'," + 
                "1270454460000,1270540861000,'America/Los_Angeles','America/Los_Angeles',1,1);"); 
 
        // April 5th midnight to April 6th midnight, duration cleared 
        mGoodDb.execSQL("INSERT INTO Events (_id,dtstart,dtend,duration,dtstart2,dtend2," +
                "eventTimezone,eventTimezone2,allDay,calendar_id) " + 
                "VALUES (1,1270425600000,1270512000000,null," + 
                "1270450800000,1270537200000,'UTC','America/Los_Angeles',1,1);"); 
 
        // April 5th 1:01:01 AM to April 6th 1:01:01, recurring weekly (We only check for the 
        // existence of an rrule so it doesn't matter if the day is correct) 
        mBadDb.execSQL("INSERT INTO Events (_id,dtstart,dtend,duration,dtstart2,dtend2," +
                "eventTimezone,eventTimezone2,allDay,rrule,calendar_id) " + 
                "VALUES (2,1270454462000,1270540863000," + 
                "'P10S',1270454461000,1270540861000,'America/Los_Angeles','America/Los_Angeles',1," + 
                "'WEEKLY:MON',1);"); 
 
        // April 5th midnight with 1 day duration, if only dtend was wrong we wouldn't fix it, but 
        // if anything else is wrong we clear dtend to be sure. 
        mGoodDb.execSQL("INSERT INTO Events (" +
                "_id,dtstart,dtend,duration,dtstart2,dtend2," + 
                "eventTimezone,eventTimezone2,allDay,rrule,calendar_id)" + 
                "VALUES (2,1270425600000,null,'P1D',1270450800000,null," + 
                "'UTC','America/Los_Angeles',1," + 
                "'WEEKLY:MON',1);"); 
 
        assertEquals(mBadDb.rawQuery("SELECT _id FROM Events;", null).getCount(), 2);
        assertEquals(mGoodDb.rawQuery("SELECT _id FROM Events;", null).getCount(), 2);
    } 
 
    @MediumTest 
    public void testUpgradeToVersion69() { 
Contextual code suggestions in your IDE  Get Codota for Java