Code example for SQLiteDatabase

Methods: queryreplace

0
            initialValues.put(KEY_ROWID, 
                    rowCursor.getInt(rowCursor.getColumnIndex(KEY_ROWID)));
        } 
        rowCursor.close();
 
        return mDb.replace(DATABASE_TABLE, null, initialValues);
    } 
 
    /** 
     * Fetch a entry by name. 
     * @param type the type 
     * @param name the name 
     * @return a Cursor object positioned at the first entry 
     */ 
    public Cursor fetchByName(int type, String name) {
        String[] columns = new String[] {KEY_ROWID, KEY_TYPE, KEY_NAME};
        String selection = KEY_NAME + "=? AND " + KEY_TYPE + "=?";
        String[] selectionArgs = new String[] {name, String.valueOf(type)};
        Cursor cursor = mDb.query(DATABASE_TABLE, columns, selection,
                selectionArgs, null, null, null);
        if (cursor != null) {
            cursor.moveToFirst();
        } 
        return cursor;
Contextual code suggestions in your IDE  Get Codota for Java