1 /* 2 * Copyright (C) 2011 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.core.database; 18 19 import android.text.TextUtils; 20 21 /** 22 * Helper for accessing features in {@link android.database.DatabaseUtils}. 23 * 24 * @deprecated Use {@link android.database.DatabaseUtils} directly. 25 */ 26 @Deprecated 27 public final class DatabaseUtilsCompat { 28 29 private DatabaseUtilsCompat() { 30 /* Hide constructor */ 31 } 32 33 /** 34 * Concatenates two SQL WHERE clauses, handling empty or null values. 35 * 36 * @deprecated Use {@link android.database.DatabaseUtils#concatenateWhere(String, String)} 37 * directly. 38 */ 39 @Deprecated 40 public static String concatenateWhere(String a, String b) { 41 if (TextUtils.isEmpty(a)) { 42 return b; 43 } 44 if (TextUtils.isEmpty(b)) { 45 return a; 46 } 47 48 return "(" + a + ") AND (" + b + ")"; 49 } 50 51 /** 52 * Appends one set of selection args to another. This is useful when adding a selection 53 * argument to a user provided set. 54 * 55 * @deprecated Use 56 * {@link android.database.DatabaseUtils#appendSelectionArgs(String[], String[])} directly. 57 */ 58 @Deprecated 59 public static String[] appendSelectionArgs(String[] originalValues, String[] newValues) { 60 if (originalValues == null || originalValues.length == 0) { 61 return newValues; 62 } 63 String[] result = new String[originalValues.length + newValues.length ]; 64 System.arraycopy(originalValues, 0, result, 0, originalValues.length); 65 System.arraycopy(newValues, 0, result, originalValues.length, newValues.length); 66 return result; 67 } 68 } 69