Examples of UpdateBatchQuery


Examples of org.apache.cayenne.query.UpdateBatchQuery

    }

    @Override
    public List getValuesForLOBUpdateParameters(BatchQuery query) {
        int len = query.getDbAttributes().size();
        UpdateBatchQuery updateBatch = (UpdateBatchQuery) query;

        List values = new ArrayList(len);
        List<DbAttribute> qualifierAttributes = updateBatch.getQualifierAttributes();
        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();

        int updatedLen = updatedDbAttributes.size();
        int qualifierLen = qualifierAttributes.size();
        for (int i = 0; i < updatedLen; i++) {
            DbAttribute attribute = updatedDbAttributes.get(i);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

        return values;
    }

    @Override
    public String createSqlString(BatchQuery batch) {
        UpdateBatchQuery updateBatch = (UpdateBatchQuery) batch;
        String table = batch.getDbEntity().getFullyQualifiedName();
        List<DbAttribute> idDbAttributes = updateBatch.getQualifierAttributes();
        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();
        StringBuffer query = new StringBuffer("UPDATE ");
        query.append(table).append(" SET ");

        int len = updatedDbAttributes.size();
        for (int i = 0; i < len; i++) {
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

        List idAttributes = Collections.singletonList(entity
                .getAttribute("LOCKING_TEST_ID"));
        List updatedAttributes = Collections.singletonList(entity
                .getAttribute("DESCRIPTION"));

        UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                entity,
                idAttributes,
                updatedAttributes,
                null,
                1);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

        List updatedAttributes = Collections.singletonList(entity
                .getAttribute("DESCRIPTION"));

        Collection nullAttributes = Collections.singleton("NAME");

        UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                entity,
                idAttributes,
                updatedAttributes,
                nullAttributes,
                1);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

            List idAttributes = Collections.singletonList(entity
                    .getAttribute("LOCKING_TEST_ID"));
            List updatedAttributes = Collections.singletonList(entity
                    .getAttribute("DESCRIPTION"));

            UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                    entity,
                    idAttributes,
                    updatedAttributes,
                    null,
                    1);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

            List updatedAttributes = Collections.singletonList(entity
                    .getAttribute("DESCRIPTION"));

            Collection nullAttributes = Collections.singleton("NAME");

            UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                    entity,
                    idAttributes,
                    updatedAttributes,
                    nullAttributes,
                    1);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

        super(adapter);
    }

    @Override
    public String createSqlString(BatchQuery batch) {
        UpdateBatchQuery updateBatch = (UpdateBatchQuery) batch;
        String table = batch.getDbEntity().getFullyQualifiedName();
        List<DbAttribute> qualifierAttributes = updateBatch.getQualifierAttributes();
        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();

        StringBuffer query = new StringBuffer("UPDATE ");
        query.append(table).append(" SET ");

        int len = updatedDbAttributes.size();
        for (int i = 0; i < len; i++) {
            if (i > 0) {
                query.append(", ");
            }

            DbAttribute attribute = updatedDbAttributes.get(i);
            query.append(attribute.getName()).append(" = ?");
        }

        query.append(" WHERE ");

        Iterator<DbAttribute> i = qualifierAttributes.iterator();
        while (i.hasNext()) {
            DbAttribute attribute = i.next();
            appendDbAttribute(query, attribute);
            query.append(updateBatch.isNull(attribute) ? " IS NULL" : " = ?");

            if (i.hasNext()) {
                query.append(" AND ");
            }
        }
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

     */
    @Override
    public void bindParameters(PreparedStatement statement, BatchQuery query)
            throws SQLException, Exception {

        UpdateBatchQuery updateBatch = (UpdateBatchQuery) query;
        List<DbAttribute> qualifierAttributes = updateBatch.getQualifierAttributes();
        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();

        int len = updatedDbAttributes.size();
        int parameterIndex = 1;
        for (int i = 0; i < len; i++) {
            Object value = query.getValue(i);

            DbAttribute attribute = updatedDbAttributes.get(i);
            adapter.bindParameter(
                    statement,
                    value,
                    parameterIndex++,
                    attribute.getType(),
                    attribute.getScale());
        }

        for (int i = 0; i < qualifierAttributes.size(); i++) {
            Object value = query.getValue(len + i);
            DbAttribute attribute = qualifierAttributes.get(i);

            // skip null attributes... they are translated as "IS NULL"
            if (updateBatch.isNull(attribute)) {
                continue;
            }

            adapter.bindParameter(
                    statement,
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

        List idAttributes = Collections.singletonList(entity
                .getAttribute("LOCKING_TEST_ID"));
        List updatedAttributes = Collections.singletonList(entity
                .getAttribute("DESCRIPTION"));

        UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                entity,
                idAttributes,
                updatedAttributes,
                null,
                1);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

        List updatedAttributes = Collections.singletonList(entity
                .getAttribute("DESCRIPTION"));

        Collection nullAttributes = Collections.singleton("NAME");

        UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                entity,
                idAttributes,
                updatedAttributes,
                nullAttributes,
                1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.