1 /* 2 * Copyright (C) 2017 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 * A query with typed bindings. It is better to use this API instead of 21 * {@link android.database.sqlite.SQLiteDatabase#rawQuery(String, String[])} because it allows 22 * binding type safe parameters. 23 */ 24 public interface SupportSQLiteQuery { 25 /** 26 * The SQL query. This query can have placeholders(?) for bind arguments. 27 * 28 * @return The SQL query to compile 29 */ getSql()30 String getSql(); 31 32 /** 33 * Callback to bind the query parameters to the compiled statement. 34 * 35 * @param statement The compiled statement 36 */ bindTo(SupportSQLiteProgram statement)37 void bindTo(SupportSQLiteProgram statement); 38 39 /** 40 * Returns the number of arguments in this query. This is equal to the number of placeholders 41 * in the query string. See: https://www.sqlite.org/c3ref/bind_blob.html for details. 42 * 43 * @return The number of arguments in the query. 44 */ getArgCount()45 int getArgCount(); 46 } 47