1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License 16 */ 17 18 package com.android.providers.contacts; 19 20 import android.content.ContentValues; 21 import android.database.DatabaseUtils; 22 import android.database.sqlite.SQLiteDatabase; 23 24 /** 25 * An interface which wraps key database modify operations (insert, update, delete) to perform 26 * additional tasks before or after the database modification operation. A typical use case is to 27 * generate notification when a database is modified. 28 */ 29 public interface DatabaseModifier { 30 /** 31 * Use this method to insert a value which you would otherwise do using the 32 * {@link SQLiteDatabase#insert(String, String, ContentValues)} method. 33 */ 34 public abstract long insert(String table, String nullColumnHack, ContentValues values); 35 /** 36 * Use this method to insert a value which you would otherwise do using the 37 * {@link DatabaseUtils.InsertHelper#insert(ContentValues)} method. 38 */ 39 public abstract long insert(ContentValues values); 40 /** 41 * Use this method to update a table which you would otherwise do using the 42 * {@link SQLiteDatabase#update(String, ContentValues, String, String[])} method. 43 */ 44 public abstract int update(String table, ContentValues values, 45 String whereClause, String[] whereArgs); 46 /** 47 * Use this method to delete entries from a table which you would otherwise do using the 48 * {@link SQLiteDatabase#delete(String, String, String[])} method. 49 */ 50 public abstract int delete(String table, String whereClause, String[] whereArgs); 51 } 52