1c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar/* 2c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * Copyright (C) 2016 The Android Open Source Project 3c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * 4c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * Licensed under the Apache License, Version 2.0 (the "License"); 5c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * you may not use this file except in compliance with the License. 6c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * You may obtain a copy of the License at 7c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * 8c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * http://www.apache.org/licenses/LICENSE-2.0 9c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * 10c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * Unless required by applicable law or agreed to in writing, software 11c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * distributed under the License is distributed on an "AS IS" BASIS, 12c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * See the License for the specific language governing permissions and 14c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * limitations under the License. 15c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar */ 16c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar 1764db0cc15b78b62a1d44a70fc8b4552e660d952cYigit Boyarpackage android.arch.persistence.db; 18c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar 190d1b036f6868844705cd3b57e96d373edd09b3d5Yigit Boyarimport android.annotation.TargetApi; 200d1b036f6868844705cd3b57e96d373edd09b3d5Yigit Boyarimport android.os.Build; 210d1b036f6868844705cd3b57e96d373edd09b3d5Yigit Boyar 22c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar/** 23c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * An interface to map the behavior of {@link android.database.sqlite.SQLiteProgram}. 24c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar */ 25c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar 260d1b036f6868844705cd3b57e96d373edd09b3d5Yigit Boyar@TargetApi(Build.VERSION_CODES.KITKAT) 27c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar@SuppressWarnings("unused") 280d1b036f6868844705cd3b57e96d373edd09b3d5Yigit Boyarpublic interface SupportSQLiteProgram extends AutoCloseable { 29c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar /** 30c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * Bind a NULL value to this statement. The value remains bound until 31c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * {@link #clearBindings} is called. 32c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * 33c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * @param index The 1-based index to the parameter to bind null to 34c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar */ 35c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar void bindNull(int index); 36c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar 37c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar /** 38c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * Bind a long value to this statement. The value remains bound until 39c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * {@link #clearBindings} is called. 40c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar *addToBindArgs 41c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * @param index The 1-based index to the parameter to bind 42c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * @param value The value to bind 43c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar */ 44c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar void bindLong(int index, long value); 45c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar 46c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar /** 47c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * Bind a double value to this statement. The value remains bound until 48c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * {@link #clearBindings} is called. 49c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * 50c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * @param index The 1-based index to the parameter to bind 51c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * @param value The value to bind 52c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar */ 53c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar void bindDouble(int index, double value); 54c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar 55c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar /** 56c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * Bind a String value to this statement. The value remains bound until 57c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * {@link #clearBindings} is called. 58c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * 59c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * @param index The 1-based index to the parameter to bind 60c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * @param value The value to bind, must not be null 61c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar */ 62c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar void bindString(int index, String value); 63c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar 64c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar /** 65c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * Bind a byte array value to this statement. The value remains bound until 66c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * {@link #clearBindings} is called. 67c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * 68c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * @param index The 1-based index to the parameter to bind 69c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * @param value The value to bind, must not be null 70c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar */ 71c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar void bindBlob(int index, byte[] value); 72c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar 73c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar /** 74c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar * Clears all existing bindings. Unset bindings are treated as NULL. 75c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar */ 76c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar void clearBindings(); 77c308c91470c1c724bd021088aabbc747ccd441f5Yigit Boyar} 78