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 17package android.arch.persistence.db.framework; 18 19import android.arch.persistence.db.SupportSQLiteStatement; 20import android.database.sqlite.SQLiteStatement; 21 22/** 23 * Delegates all calls to a {@link SQLiteStatement}. 24 */ 25class FrameworkSQLiteStatement implements SupportSQLiteStatement { 26 private final SQLiteStatement mDelegate; 27 28 /** 29 * Creates a wrapper around a framework {@link SQLiteStatement}. 30 * 31 * @param delegate The SQLiteStatement to delegate calls to. 32 */ 33 FrameworkSQLiteStatement(SQLiteStatement delegate) { 34 mDelegate = delegate; 35 } 36 37 @Override 38 public void bindNull(int index) { 39 mDelegate.bindNull(index); 40 } 41 42 @Override 43 public void bindLong(int index, long value) { 44 mDelegate.bindLong(index, value); 45 } 46 47 @Override 48 public void bindDouble(int index, double value) { 49 mDelegate.bindDouble(index, value); 50 } 51 52 @Override 53 public void bindString(int index, String value) { 54 mDelegate.bindString(index, value); 55 } 56 57 @Override 58 public void bindBlob(int index, byte[] value) { 59 mDelegate.bindBlob(index, value); 60 } 61 62 @Override 63 public void clearBindings() { 64 mDelegate.clearBindings(); 65 } 66 67 @Override 68 public void execute() { 69 mDelegate.execute(); 70 } 71 72 @Override 73 public int executeUpdateDelete() { 74 return mDelegate.executeUpdateDelete(); 75 } 76 77 @Override 78 public long executeInsert() { 79 return mDelegate.executeInsert(); 80 } 81 82 @Override 83 public long simpleQueryForLong() { 84 return mDelegate.simpleQueryForLong(); 85 } 86 87 @Override 88 public String simpleQueryForString() { 89 return mDelegate.simpleQueryForString(); 90 } 91 92 @Override 93 public void close() throws Exception { 94 mDelegate.close(); 95 } 96} 97