1 /* 2 * Copyright (C) 2016 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 androidx.sqlite.db; 18 19 /** 20 * An interface to map the behavior of {@link android.database.sqlite.SQLiteStatement}. 21 */ 22 @SuppressWarnings("unused") 23 public interface SupportSQLiteStatement extends SupportSQLiteProgram { 24 /** 25 * Execute this SQL statement, if it is not a SELECT / INSERT / DELETE / UPDATE, for example 26 * CREATE / DROP table, view, trigger, index etc. 27 * 28 * @throws android.database.SQLException If the SQL string is invalid for 29 * some reason 30 */ execute()31 void execute(); 32 33 /** 34 * Execute this SQL statement, if the the number of rows affected by execution of this SQL 35 * statement is of any importance to the caller - for example, UPDATE / DELETE SQL statements. 36 * 37 * @return the number of rows affected by this SQL statement execution. 38 * @throws android.database.SQLException If the SQL string is invalid for 39 * some reason 40 */ executeUpdateDelete()41 int executeUpdateDelete(); 42 43 /** 44 * Execute this SQL statement and return the ID of the row inserted due to this call. 45 * The SQL statement should be an INSERT for this to be a useful call. 46 * 47 * @return the row ID of the last row inserted, if this insert is successful. -1 otherwise. 48 * 49 * @throws android.database.SQLException If the SQL string is invalid for 50 * some reason 51 */ executeInsert()52 long executeInsert(); 53 54 /** 55 * Execute a statement that returns a 1 by 1 table with a numeric value. 56 * For example, SELECT COUNT(*) FROM table; 57 * 58 * @return The result of the query. 59 * 60 * @throws android.database.sqlite.SQLiteDoneException if the query returns zero rows 61 */ simpleQueryForLong()62 long simpleQueryForLong(); 63 /** 64 * Execute a statement that returns a 1 by 1 table with a text value. 65 * For example, SELECT COUNT(*) FROM table; 66 * 67 * @return The result of the query. 68 * 69 * @throws android.database.sqlite.SQLiteDoneException if the query returns zero rows 70 */ simpleQueryForString()71 String simpleQueryForString(); 72 } 73