Search in sources :

Example 1 with ParameterInfo

use of com.sun.jdo.spi.persistence.utility.ParameterInfo in project Payara by payara.

the class ParameterTable method getParameterInfoForParamName.

/**
 * Returns the parameter info for the specified parameter name
 * and associated field.
 * If the associated field is not known, then null is used as
 * input parameter.
 * @param paramName
 * @param associatedField
 * @return corresponding parameterInfo
 */
public ParameterInfo getParameterInfoForParamName(String paramName, String associatedField) {
    int index = names.indexOf(paramName);
    Type type = (Type) types.get(index);
    return new ParameterInfo(index, type.getEnumType(), associatedField);
}
Also used : Type(com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.Type) WrapperClassType(com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.WrapperClassType) DateType(com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.DateType) StringType(com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.StringType) MathType(com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.MathType) PrimitiveType(com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.PrimitiveType) ParameterInfo(com.sun.jdo.spi.persistence.utility.ParameterInfo)

Example 2 with ParameterInfo

use of com.sun.jdo.spi.persistence.utility.ParameterInfo in project Payara by payara.

the class RetrieveDescImpl method addParameterConstraint.

/**
 * Adds information about parameter on the constraint stack.
 * @param value Instance of
 * <code>com.sun.jdo.spi.persistence.utility.ParameterInfo</code>.
 * Contains index, type and name of the field to which
 * this parameter is bound. The field name is used when binding
 * the parameter to the sql statement.
 * name can be null for complex expressions in a filter as described in
 * addValueConstraint.
 *  @see #addValueConstraint
 */
private void addParameterConstraint(Object value) {
    if (value instanceof ParameterInfo) {
        ParameterInfo parameterInfo = (ParameterInfo) value;
        constraint.addParamIndex(parameterInfo.getIndex(), parameterInfo.getType(), getLocalFieldDesc(parameterInfo.getAssociatedField()));
    } else {
        throw new JDOFatalInternalException(I18NHelper.getMessage(messages, // NOI18N
        "core.constraint.illegalParameterInfo"));
    }
}
Also used : JDOFatalInternalException(com.sun.jdo.api.persistence.support.JDOFatalInternalException) ParameterInfo(com.sun.jdo.spi.persistence.utility.ParameterInfo)

Example 3 with ParameterInfo

use of com.sun.jdo.spi.persistence.utility.ParameterInfo in project Payara by payara.

the class RetrieveDescImpl method addParameterConstraint.

/**
 * Add ParameterConstraint corresponding to given <code>field</code>
 * at given  <code>index</code>.
 * @param field The field for which constraints are to be added.
 * @param index Index at which the ParameterConstraint is to be inserted.
 */
public void addParameterConstraint(LocalFieldDesc field, int index) {
    // Generate parameter info for this parameter.
    String fieldName = field.getName();
    int type = field.getEnumType();
    addConstraint(null, ActionDesc.OP_PARAMETER, new ParameterInfo(index, type, fieldName));
    addConstraint(fieldName, ActionDesc.OP_FIELD, null);
    addConstraint(null, ActionDesc.OP_EQ, null);
}
Also used : ParameterInfo(com.sun.jdo.spi.persistence.utility.ParameterInfo) Constraint(com.sun.jdo.spi.persistence.support.sqlstore.sql.constraint.Constraint)

Aggregations

ParameterInfo (com.sun.jdo.spi.persistence.utility.ParameterInfo)3 JDOFatalInternalException (com.sun.jdo.api.persistence.support.JDOFatalInternalException)1 DateType (com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.DateType)1 MathType (com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.MathType)1 PrimitiveType (com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.PrimitiveType)1 StringType (com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.StringType)1 Type (com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.Type)1 WrapperClassType (com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.WrapperClassType)1 Constraint (com.sun.jdo.spi.persistence.support.sqlstore.sql.constraint.Constraint)1