All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bixuebihui.r2dbc.db.ActiveRecord Maven / Gradle / Ivy

The newest version!
package com.bixuebihui.r2dbc.db;

import com.bixuebihui.db.SqlHelper;

import java.sql.SQLException;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 13-4-18
 * Time: 下午5:57
 * To change this template use File | Settings | File Templates.
 *
 * @author xingwx
 * @version $Id: $Id
 */
public interface ActiveRecord extends Record {

    /**
     * Constant ORDER_ASC=0
     */
    int ORDER_ASC = 0;
    /** Constant ORDER_DESC=1 */
    int ORDER_DESC=1;

    /**
     * 

in.

* 条件 * @param field a {@link String} object. * @param values an array of {@link Object} objects. * @return a {@link ActiveRecord} object. */ ActiveRecord in(String field, Object[] values); /** * Call this method will reject empty string as where condition value * @return this */ ActiveRecord emptyStringAsNullCondition(); /** *

in.

* * @param field a {@link String} object. * @param values a {@link Object} object. * @return a {@link ActiveRecord} object. */ ActiveRecord in(String field, Object values); /** *

like.

* * @param field a {@link String} object. * @param value a {@link String} object. * @return a {@link ActiveRecord} object. */ ActiveRecord like(String field, String value); /** *

startWith.

* * @param field a {@link String} object. * @param value a {@link String} object. * @return a {@link ActiveRecord} object. */ ActiveRecord startWith(String field, String value); /** *

eq.

* * @param field a {@link String} object. * @param value a {@link Object} object. * @return a {@link ActiveRecord} object. */ ActiveRecord eq(String field, Object value); /** *

ne.

* * @param field a {@link String} object. * @param value a {@link Object} object. * @return a {@link ActiveRecord} object. */ ActiveRecord ne(String field, Object value); /** *

eq.

* * @param fields an array of {@link String} objects. * @param value an array of {@link Object} objects. * @return a {@link ActiveRecord} object. * @throws SQLException if any. */ ActiveRecord eq(String[] fields, Object[] value) throws SQLException; /** *

greaterThan.

* * @param field a {@link String} object. * @param value a {@link Object} object. * @return a {@link ActiveRecord} object. */ ActiveRecord greaterThan(String field, Object value); /** *

smallerThan.

* * @param field a {@link String} object. * @param value a {@link Object} object. * @return a {@link ActiveRecord} object. */ ActiveRecord smallerThan(String field, Object value); /** * SQL is null * @param field * @return */ ActiveRecord isNull(String field); /** * SQL is not null * @param field * @return */ ActiveRecord isNotNull(String field); /** *

asc.

* * @param field a {@link String} object. * @return a {@link ActiveRecord} object. */ ActiveRecord asc(String field); /** * Sort by given order * e.g. select FirstName from DemoTable where Id IN(4,5,6) order by field(Id,4,5,6); * +----+-----------+ * | Id | FirstName | * +----+-----------+ * | 1 | Chris | * | 2 | Robert | * | 3 | Mike | * | 4 | Sam | * | 5 | Carol | * | 6 | David | * +----+-----------+ * result * +-----------+ * | FirstName | * +-----------+ * | Sam | * | Carol | * | David | * +-----------+ * @param field field name * @param in fields value in IN clause * @return this */ ActiveRecord orderByIn(String field, Object[] in); /** *

desc.

* * @param field a {@link String} object. * @return a {@link ActiveRecord} object. */ ActiveRecord desc(String field); /** *

limit.

* * @param begin a int. * @param num a int. * @return a {@link ActiveRecord} object. */ ActiveRecord limit(int begin, int num); /** *

last.

* * @return a {@link Record} object. */ Record last(); /** * 大于或等于 * @param field db field * @param value value to compare * @return this */ ActiveRecord greaterOrEqualThan(String field, Object value); /** * 小于或等于 * @param field db field * @param value value to compare * @return this */ ActiveRecord smallerOrEqualThan(String field, Object value); /** *

getCondStack.

* * @return a {@link SqlHelper} object. */ SqlHelper getCondStack(); /** *

or.

* * @param andStack a {@link SqlHelper} object. * @return a {@link ActiveRecord} object. */ ActiveRecord or(SqlHelper andStack); /** *

alias.

* * @param shortName a {@link String} object. * @return a {@link ActiveRecord} object. */ ActiveRecord alias(String shortName); /** *

fields.

* * @param resultFields a {@link String} object. * @return a {@link ActiveRecord} object. */ ActiveRecord fields(String resultFields); /** *

join.

* * @param joinClause a {@link String} object. * @return a {@link ActiveRecord} object. */ ActiveRecord join(String joinClause); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy