public interface

SupportSQLiteStatement

implements SupportSQLiteProgram

 androidx.sqlite.db.SupportSQLiteStatement

Gradle dependencies

compile group: 'androidx.sqlite', name: 'sqlite', version: '2.3.0-alpha02'

  • groupId: androidx.sqlite
  • artifactId: sqlite
  • version: 2.3.0-alpha02

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

Androidx artifact mapping:

androidx.sqlite:sqlite android.arch.persistence:db

Androidx class mapping:

androidx.sqlite.db.SupportSQLiteStatement android.arch.persistence.db.SupportSQLiteStatement

Overview

An interface to map the behavior of .

Summary

Methods
public voidexecute()

Execute this SQL statement, if it is not a SELECT / INSERT / DELETE / UPDATE, for example CREATE / DROP table, view, trigger, index etc.

public longexecuteInsert()

Execute this SQL statement and return the ID of the row inserted due to this call.

public intexecuteUpdateDelete()

Execute this SQL statement, if the the number of rows affected by execution of this SQL statement is of any importance to the caller - for example, UPDATE / DELETE SQL statements.

public longsimpleQueryForLong()

Execute a statement that returns a 1 by 1 table with a numeric value.

public java.lang.StringsimpleQueryForString()

Execute a statement that returns a 1 by 1 table with a text value.

Methods

public void execute()

Execute this SQL statement, if it is not a SELECT / INSERT / DELETE / UPDATE, for example CREATE / DROP table, view, trigger, index etc.

public int executeUpdateDelete()

Execute this SQL statement, if the the number of rows affected by execution of this SQL statement is of any importance to the caller - for example, UPDATE / DELETE SQL statements.

Returns:

the number of rows affected by this SQL statement execution.

public long executeInsert()

Execute this SQL statement and return the ID of the row inserted due to this call. The SQL statement should be an INSERT for this to be a useful call.

Returns:

the row ID of the last row inserted, if this insert is successful. -1 otherwise.

public long simpleQueryForLong()

Execute a statement that returns a 1 by 1 table with a numeric value. For example, SELECT COUNT(*) FROM table;

Returns:

The result of the query.

public java.lang.String simpleQueryForString()

Execute a statement that returns a 1 by 1 table with a text value. For example, SELECT COUNT(*) FROM table;

Returns:

The result of the query.

Source

/*
 * Copyright (C) 2016 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.sqlite.db;

/**
 * An interface to map the behavior of {@link android.database.sqlite.SQLiteStatement}.
 */
@SuppressWarnings("unused")
public interface SupportSQLiteStatement extends SupportSQLiteProgram {
    /**
     * Execute this SQL statement, if it is not a SELECT / INSERT / DELETE / UPDATE, for example
     * CREATE / DROP table, view, trigger, index etc.
     *
     * @throws android.database.SQLException If the SQL string is invalid for
     *         some reason
     */
    void execute();

    /**
     * Execute this SQL statement, if the the number of rows affected by execution of this SQL
     * statement is of any importance to the caller - for example, UPDATE / DELETE SQL statements.
     *
     * @return the number of rows affected by this SQL statement execution.
     * @throws android.database.SQLException If the SQL string is invalid for
     *         some reason
     */
    int executeUpdateDelete();

    /**
     * Execute this SQL statement and return the ID of the row inserted due to this call.
     * The SQL statement should be an INSERT for this to be a useful call.
     *
     * @return the row ID of the last row inserted, if this insert is successful. -1 otherwise.
     *
     * @throws android.database.SQLException If the SQL string is invalid for
     *         some reason
     */
    long executeInsert();

    /**
     * Execute a statement that returns a 1 by 1 table with a numeric value.
     * For example, SELECT COUNT(*) FROM table;
     *
     * @return The result of the query.
     *
     * @throws android.database.sqlite.SQLiteDoneException if the query returns zero rows
     */
    long simpleQueryForLong();
    /**
     * Execute a statement that returns a 1 by 1 table with a text value.
     * For example, SELECT COUNT(*) FROM table;
     *
     * @return The result of the query.
     *
     * @throws android.database.sqlite.SQLiteDoneException if the query returns zero rows
     */
    String simpleQueryForString();
}