Android Open Source - Android-Lib-Database Query






From Project

Back to project page Android-Lib-Database.

License

The source code is released under:

Apache License

If you think the Android project Android-Lib-Database listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package android.lib.database.query;
/*from   w ww .  java2  s.com*/
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;


/**
 * A SQL abstraction layer for building SQLite SQL queries via a object-oriented API.
 * <p>The end result of a {@link Query} object will produce a SQL statement that represents the
 * target query and can be directly executed against the database.</p>
 * <p>{@link Query} object provides fou primary types of queries, {@link Select}, {@link Update},
 * {@link Insert} and {@link Delete}, that can be used to interacting or building queries.</p>
 * <p>For complex queries such as sub-<code>SELECT</code> queries, instantiate a {@link Query}
 * object with the specific raw SQL statement.</p>
 */
public class Query {
    private final List<Object> parameters;

    protected String rawSQL;

    public Query(final String rawSQL, final Object... parameters) {
        this.rawSQL     = rawSQL;
        this.parameters = Arrays.asList(parameters);
    }

    public Query(final String rawSQL, final List<Object> parameters) {
        this.rawSQL     = rawSQL;
        this.parameters = parameters;
    }

    protected Query() {
        this.parameters = new ArrayList<Object>();
    }

    public String getRawSQL() {
        return this.rawSQL;
    }

    public List<Object> getParameters() {
        return this.parameters;
    }

    public static Select select() {
        return new Select();
    }

    public static Update update() {
        return new Update();
    }

    public static Insert insert() {
        return new Insert();
    }

    public static Delete delete() {
        return new Delete();
    }
}




Java Source Code List

android.lib.database.Column.java
android.lib.database.CompositeIndex.java
android.lib.database.DatabaseOpenHelper.java
android.lib.database.Database.java
android.lib.database.DateConverter.java
android.lib.database.Index.java
android.lib.database.JSONRowMapper.java
android.lib.database.RowMapper.java
android.lib.database.Table.java
android.lib.database.TypeConverter.java
android.lib.database.UniqueCompositeIndex.java
android.lib.database.UnsupportedTypeException.java
android.lib.database.UseConverter.java
android.lib.database.predicate.ManySidedPredicate.java
android.lib.database.predicate.Predicate.java
android.lib.database.predicate.ThreeSidedPredicate.java
android.lib.database.predicate.TwoSidedPredicate.java
android.lib.database.query.Delete.java
android.lib.database.query.Insert.java
android.lib.database.query.QueryBuilder.java
android.lib.database.query.Query.java
android.lib.database.query.Select.java
android.lib.database.query.Update.java