Code example for SQLiteDatabase

Methods: replace

        ContentValues values = new ContentValues();
        values.put(PURCHASED_PRODUCT_ID_COL, productId);
        values.put(PURCHASED_QUANTITY_COL, quantity);
        mDb.replace(PURCHASED_ITEMS_TABLE_NAME, null /* nullColumnHack */, values);
     * Adds the given purchase information to the database and returns the total 
     * number of times that the given product has been purchased. 
     * @param orderId a string identifying the order 
     * @param productId the product ID (sku) 
     * @param purchaseState the purchase state of the product 
     * @param purchaseTime the time the product was purchased, in milliseconds 
     * since the epoch (Jan 1, 1970) 
     * @param developerPayload the developer provided "payload" associated with 
     *     the order 
     * @return the number of times the given product has been purchased.