1 /* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.database.sqlite; 18 19 import android.database.Cursor; 20 import android.database.sqlite.SQLiteDatabase.CursorFactory; 21 22 /** 23 * A driver for SQLiteCursors that is used to create them and gets notified 24 * by the cursors it creates on significant events in their lifetimes. 25 */ 26 public interface SQLiteCursorDriver { 27 /** 28 * Executes the query returning a Cursor over the result set. 29 * 30 * @param factory The CursorFactory to use when creating the Cursors, or 31 * null if standard SQLiteCursors should be returned. 32 * @return a Cursor over the result set 33 */ query(CursorFactory factory, String[] bindArgs)34 Cursor query(CursorFactory factory, String[] bindArgs); 35 36 /** 37 * Called by a SQLiteCursor when it is released. 38 */ cursorDeactivated()39 void cursorDeactivated(); 40 41 /** 42 * Called by a SQLiteCursor when it is requeried. 43 */ cursorRequeried(Cursor cursor)44 void cursorRequeried(Cursor cursor); 45 46 /** 47 * Called by a SQLiteCursor when it it closed to destroy this object as well. 48 */ cursorClosed()49 void cursorClosed(); 50 51 /** 52 * Set new bind arguments. These will take effect in cursorRequeried(). 53 * @param bindArgs the new arguments 54 */ setBindArguments(String[] bindArgs)55 public void setBindArguments(String[] bindArgs); 56 } 57