Package com.jengine.orm.db.query

Examples of com.jengine.orm.db.query.SQLQuery$TableItem


    public long count() throws DBException {
        return this.target(new Count()).<Long>one();
    }

    public <T extends Object> List<T> list() throws DBException {
        SQLQuery sqlQuery = toSQL();
        List result = manager.getModelClass().getProvider().select(sqlQuery);
        return processResult(result);
    }
View Full Code Here


    public void remove() throws DBException {
        manager.getModelClass().getProvider().remove(toSQL());
    }

    public SQLQuery toSQL() {
        SQLQuery query = new SQLQuery(multiModel.getMultiTable());

        if (targets.size() > 0) {
            for (Target target : targets.values()) {
                target.setSQL(query);
            }
        } else {
            defaultTarget.setSQL(query);
        }
        query.setDistinct(distinct);
        for (Filter filter : filters) {
            filter.setSQL(query);
        }
        for (StringFilter stringFilter : stringFilters) {
            stringFilter.setSQL(query);
        }
        for (MultiModelField field : group.values()) {
            query.group(field.getSQLName());
        }
        for (OrderItem orderItem : orderList) {
            orderItem.setSQL(query);
        }
        for (String fieldName : values.keySet()) {
            Field field = manager.getField(fieldName);
            query.addValue(field.getColumnName(), values.get(fieldName));
        }
        if (page.get("start") != null && page.get("end") != null) {
            query.setStart(page.get("start"));
            query.setEnd(page.get("end"));
            query.addParam(page.get("start"));
            query.addParam(page.get("end"));
        }

        return query;
    }
View Full Code Here

    public ClusterQuery page(Integer start, Integer end) {
        return (ClusterQuery) super.page(start, end);
    }

    public <T extends Object> List<T> list() throws DBException {
        SQLQuery sqlQuery = toSQL();
        List result = multiModel.getDB().getProvider().select(sqlQuery);
        return processResult(result);
    }
View Full Code Here

        List result = multiModel.getDB().getProvider().select(sqlQuery);
        return processResult(result);
    }

    public SQLQuery toSQL() {
        SQLQuery query = new SQLQuery(multiModel.getMultiTable());

        for (Target target : targets.values()) {
            target.setSQL(query);
        }
        query.setDistinct(distinct);
        for (Filter filter : filters) {
            filter.setSQL(query);
        }
        for (StringFilter stringFilter : stringFilters) {
            stringFilter.setSQL(query);
        }
        for (MultiModelField field : group.values()) {
            query.group(field.getSQLName());
        }
        for (OrderItem orderItem : orderList) {
            orderItem.setSQL(query);
        }
        for (String fieldName : values.keySet()) {
            MultiModelField field = multiModel.getFields().get(fieldName);
            query.addValue(field.getSQLName(), values.get(fieldName));
        }
        if (page.get("start") != null && page.get("end") != null) {
            query.setStart(page.get("start"));
            query.setEnd(page.get("end"));
            query.addParam(page.get("start"));
            query.addParam(page.get("end"));
        }

        return query;
    }
View Full Code Here

TOP

Related Classes of com.jengine.orm.db.query.SQLQuery$TableItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.