Search in sources :

Example 1 with QueryValue

use of com.revolsys.record.query.QueryValue in project com.revolsys.open by revolsys.

the class Function method equals.

@Override
public boolean equals(final Object obj) {
    if (obj instanceof Function) {
        final Function value = (Function) obj;
        if (DataType.equal(getName(), value.getName())) {
            final List<QueryValue> parameters1 = getParameters();
            final List<QueryValue> parameters2 = value.getParameters();
            if (parameters1.size() == parameters2.size()) {
                for (int i = 0; i < parameters1.size(); i++) {
                    final QueryValue value1 = parameters1.get(i);
                    final QueryValue value2 = parameters2.get(i);
                    if (!DataType.equal(value1, value2)) {
                        return false;
                    }
                }
                return true;
            }
        }
    }
    return false;
}
Also used : QueryValue(com.revolsys.record.query.QueryValue) AbstractMultiQueryValue(com.revolsys.record.query.AbstractMultiQueryValue)

Example 2 with QueryValue

use of com.revolsys.record.query.QueryValue in project com.revolsys.open by revolsys.

the class Function method appendDefaultSql.

@Override
public void appendDefaultSql(final Query query, final RecordStore recordStore, final StringBuilder buffer) {
    buffer.append(this.name);
    buffer.append("(");
    boolean first = true;
    for (final QueryValue parameter : getParameters()) {
        if (first) {
            first = false;
        } else {
            buffer.append(", ");
        }
        parameter.appendSql(query, recordStore, buffer);
    }
    buffer.append(")");
}
Also used : QueryValue(com.revolsys.record.query.QueryValue) AbstractMultiQueryValue(com.revolsys.record.query.AbstractMultiQueryValue)

Example 3 with QueryValue

use of com.revolsys.record.query.QueryValue in project com.revolsys.open by revolsys.

the class WithinDistance method updateQueryValues.

@SuppressWarnings("unchecked")
@Override
public <QV extends QueryValue> QV updateQueryValues(final Function<QueryValue, QueryValue> valueHandler) {
    final QueryValue distanceValue = valueHandler.apply(this.distanceValue);
    final QueryValue geometry1Value = valueHandler.apply(this.geometry1Value);
    final QueryValue geometry2Value = valueHandler.apply(this.geometry2Value);
    if (distanceValue == this.distanceValue && geometry1Value == this.geometry1Value && geometry2Value == this.geometry2Value) {
        return (QV) this;
    } else {
        final WithinDistance clone = clone();
        clone.distanceValue = distanceValue;
        clone.geometry1Value = geometry1Value;
        clone.geometry2Value = geometry2Value;
        return (QV) clone;
    }
}
Also used : QueryValue(com.revolsys.record.query.QueryValue)

Example 4 with QueryValue

use of com.revolsys.record.query.QueryValue in project com.revolsys.open by revolsys.

the class OracleRecordStore method appendEnvelopeIntersects.

private void appendEnvelopeIntersects(final Query query, final StringBuilder sql, final EnvelopeIntersects envelopeIntersects) {
    final FieldDefinition geometryField = query.getGeometryField();
    if (geometryField instanceof OracleSdoGeometryJdbcFieldDefinition) {
        sql.append("SDO_RELATE(");
        final QueryValue boundingBox1Value = envelopeIntersects.getBoundingBox1Value();
        if (boundingBox1Value == null) {
            sql.append("NULL");
        } else {
            boundingBox1Value.appendSql(query, this, sql);
        }
        sql.append(",");
        final QueryValue boundingBox2Value = envelopeIntersects.getBoundingBox2Value();
        if (boundingBox2Value == null) {
            sql.append("NULL");
        } else {
            boundingBox2Value.appendSql(query, this, sql);
        }
        sql.append(",'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'");
    } else if (geometryField instanceof ArcSdeStGeometryFieldDefinition) {
        sql.append("SDE.ST_ENVINTERSECTS(");
        final QueryValue boundingBox1Value = envelopeIntersects.getBoundingBox1Value();
        if (boundingBox1Value == null) {
            sql.append("NULL");
        } else {
            boundingBox1Value.appendSql(query, this, sql);
        }
        sql.append(",");
        final QueryValue boundingBox2Value = envelopeIntersects.getBoundingBox2Value();
        if (boundingBox2Value == null) {
            sql.append("NULL");
        } else {
            boundingBox2Value.appendSql(query, this, sql);
        }
        sql.append(") = 1");
    } else {
        throw new IllegalArgumentException("Unknown geometry attribute type " + geometryField.getClass());
    }
}
Also used : OracleSdoGeometryJdbcFieldDefinition(com.revolsys.oracle.recordstore.field.OracleSdoGeometryJdbcFieldDefinition) FieldDefinition(com.revolsys.record.schema.FieldDefinition) OracleJdbcRowIdFieldDefinition(com.revolsys.oracle.recordstore.field.OracleJdbcRowIdFieldDefinition) ArcSdeStGeometryFieldDefinition(com.revolsys.oracle.recordstore.esri.ArcSdeStGeometryFieldDefinition) JdbcFieldDefinition(com.revolsys.jdbc.field.JdbcFieldDefinition) OracleSdoGeometryJdbcFieldDefinition(com.revolsys.oracle.recordstore.field.OracleSdoGeometryJdbcFieldDefinition) ArcSdeStGeometryFieldDefinition(com.revolsys.oracle.recordstore.esri.ArcSdeStGeometryFieldDefinition) QueryValue(com.revolsys.record.query.QueryValue)

Example 5 with QueryValue

use of com.revolsys.record.query.QueryValue in project com.revolsys.open by revolsys.

the class OracleRecordStore method appendGeometryEqual2d.

private void appendGeometryEqual2d(final Query query, final StringBuilder sql, final GeometryEqual2d equals) {
    final FieldDefinition geometryField = query.getGeometryField();
    if (geometryField instanceof OracleSdoGeometryJdbcFieldDefinition) {
        sql.append("MDSYS.SDO_EQUAL(");
        final QueryValue geometry1Value = equals.getGeometry1Value();
        if (geometry1Value == null) {
            sql.append("NULL");
        } else {
            geometry1Value.appendSql(query, this, sql);
        }
        sql.append(",");
        final QueryValue geometry2Value = equals.getGeometry2Value();
        if (geometry2Value == null) {
            sql.append("NULL");
        } else {
            geometry2Value.appendSql(query, this, sql);
        }
        sql.append(") = 'TRUE'");
    } else if (geometryField instanceof ArcSdeStGeometryFieldDefinition) {
        sql.append("SDE.ST_EQUALS(");
        final QueryValue geometry1Value = equals.getGeometry1Value();
        if (geometry1Value == null) {
            sql.append("NULL");
        } else {
            geometry1Value.appendSql(query, this, sql);
        }
        sql.append(",");
        final QueryValue geometry2Value = equals.getGeometry2Value();
        if (geometry2Value == null) {
            sql.append("NULL");
        } else {
            geometry2Value.appendSql(query, this, sql);
        }
        sql.append(") = 1");
    } else {
        throw new IllegalArgumentException("Unknown geometry attribute type " + geometryField.getClass());
    }
}
Also used : OracleSdoGeometryJdbcFieldDefinition(com.revolsys.oracle.recordstore.field.OracleSdoGeometryJdbcFieldDefinition) FieldDefinition(com.revolsys.record.schema.FieldDefinition) OracleJdbcRowIdFieldDefinition(com.revolsys.oracle.recordstore.field.OracleJdbcRowIdFieldDefinition) ArcSdeStGeometryFieldDefinition(com.revolsys.oracle.recordstore.esri.ArcSdeStGeometryFieldDefinition) JdbcFieldDefinition(com.revolsys.jdbc.field.JdbcFieldDefinition) OracleSdoGeometryJdbcFieldDefinition(com.revolsys.oracle.recordstore.field.OracleSdoGeometryJdbcFieldDefinition) ArcSdeStGeometryFieldDefinition(com.revolsys.oracle.recordstore.esri.ArcSdeStGeometryFieldDefinition) QueryValue(com.revolsys.record.query.QueryValue)

Aggregations

QueryValue (com.revolsys.record.query.QueryValue)16 Column (com.revolsys.record.query.Column)5 Value (com.revolsys.record.query.Value)5 ILike (com.revolsys.record.query.ILike)4 FieldDefinition (com.revolsys.record.schema.FieldDefinition)4 JdbcFieldDefinition (com.revolsys.jdbc.field.JdbcFieldDefinition)3 ArcSdeStGeometryFieldDefinition (com.revolsys.oracle.recordstore.esri.ArcSdeStGeometryFieldDefinition)3 OracleJdbcRowIdFieldDefinition (com.revolsys.oracle.recordstore.field.OracleJdbcRowIdFieldDefinition)3 OracleSdoGeometryJdbcFieldDefinition (com.revolsys.oracle.recordstore.field.OracleSdoGeometryJdbcFieldDefinition)3 BinaryCondition (com.revolsys.record.query.BinaryCondition)3 CollectionValue (com.revolsys.record.query.CollectionValue)3 EnvelopeIntersects (com.revolsys.record.query.functions.EnvelopeIntersects)3 ValueNode (com.akiban.sql.parser.ValueNode)2 BoundingBox (com.revolsys.geometry.model.BoundingBox)2 AbstractBinaryQueryValue (com.revolsys.record.query.AbstractBinaryQueryValue)2 AbstractMultiCondition (com.revolsys.record.query.AbstractMultiCondition)2 AbstractMultiQueryValue (com.revolsys.record.query.AbstractMultiQueryValue)2 Condition (com.revolsys.record.query.Condition)2 In (com.revolsys.record.query.In)2 IsNotNull (com.revolsys.record.query.IsNotNull)2