public final class

DatabaseUtilsCompat

extends java.lang.Object

 java.lang.Object

↳androidx.core.database.DatabaseUtilsCompat

Gradle dependencies

compile group: 'androidx.core', name: 'core', version: '1.15.0-alpha02'

  • groupId: androidx.core
  • artifactId: core
  • version: 1.15.0-alpha02

Artifact androidx.core:core:1.15.0-alpha02 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.core:core com.android.support:support-compat

Androidx class mapping:

androidx.core.database.DatabaseUtilsCompat android.support.v4.database.DatabaseUtilsCompat

Overview

Helper for accessing features in .

Summary

Methods
public static java.lang.StringappendSelectionArgs(java.lang.String originalValues[], java.lang.String newValues[])

Appends one set of selection args to another.

public static java.lang.StringconcatenateWhere(java.lang.String a, java.lang.String b)

Concatenates two SQL WHERE clauses, handling empty or null values.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public static java.lang.String concatenateWhere(java.lang.String a, java.lang.String b)

Deprecated: Use directly.

Concatenates two SQL WHERE clauses, handling empty or null values.

public static java.lang.String appendSelectionArgs(java.lang.String originalValues[], java.lang.String newValues[])

Deprecated: Use directly.

Appends one set of selection args to another. This is useful when adding a selection argument to a user provided set.

Source

/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.core.database;

import android.text.TextUtils;

/**
 * Helper for accessing features in {@link android.database.DatabaseUtils}.
 *
 * @deprecated Use {@link android.database.DatabaseUtils} directly.
 */
@Deprecated
public final class DatabaseUtilsCompat {

    private DatabaseUtilsCompat() {
        /* Hide constructor */
    }

    /**
     * Concatenates two SQL WHERE clauses, handling empty or null values.
     *
     * @deprecated Use {@link android.database.DatabaseUtils#concatenateWhere(String, String)}
     * directly.
     */
    @Deprecated
    public static String concatenateWhere(String a, String b) {
        if (TextUtils.isEmpty(a)) {
            return b;
        }
        if (TextUtils.isEmpty(b)) {
            return a;
        }

        return "(" + a + ") AND (" + b + ")";
    }

    /**
     * Appends one set of selection args to another. This is useful when adding a selection
     * argument to a user provided set.
     *
     * @deprecated Use
     * {@link android.database.DatabaseUtils#appendSelectionArgs(String[], String[])} directly.
     */
    @Deprecated
    public static String[] appendSelectionArgs(String[] originalValues, String[] newValues) {
        if (originalValues == null || originalValues.length == 0) {
            return newValues;
        }
        String[] result = new String[originalValues.length + newValues.length ];
        System.arraycopy(originalValues, 0, result, 0, originalValues.length);
        System.arraycopy(newValues, 0, result, originalValues.length, newValues.length);
        return result;
    }
}