Interface QueryParameterCreator

All Superinterfaces:
Serializable
All Known Implementing Classes:
DefaultQueryParameterCreator

public interface QueryParameterCreator extends Serializable
A QueryParameterCreator creates a QueryParameter from an argument value of an expression.
Author:
Karl Eilebrecht
  • Method Summary

    Modifier and Type
    Method
    Description
    createParameter(de.calamanari.adl.cnv.tps.ArgMetaInfo argMetaInfo, String argValue, de.calamanari.adl.irl.MatchOperator matchOperator, AdlSqlType adlSqlType)
    Takes an argument from an expression with AdlType information as its input to create a QueryParameter to be applied to a PreparedStatement at a later time.
    createParameter(String id, de.calamanari.adl.cnv.tps.ArgMetaInfo argMetaInfo, String argValue, de.calamanari.adl.irl.MatchOperator matchOperator, AdlSqlType adlSqlType)
    Takes an argument from an expression with AdlType information as its input to create a QueryParameter to be applied to a PreparedStatement at a later time.
    boolean
    isTypeCombinationSupported(de.calamanari.adl.cnv.tps.AdlType sourceType, AdlSqlType targetType)
    This method tells whether an argument of the given sourceType can be mapped to the targetType to create a valid SQL-parameter.
    It is meant for detecting configuration errors early.
  • Method Details

    • createParameter

      QueryParameter createParameter(String id, de.calamanari.adl.cnv.tps.ArgMetaInfo argMetaInfo, String argValue, de.calamanari.adl.irl.MatchOperator matchOperator, AdlSqlType adlSqlType)
      Takes an argument from an expression with AdlType information as its input to create a QueryParameter to be applied to a PreparedStatement at a later time.
      Parameters:
      id - the temporary id of the new parameter, see QueryParameter, NOT NULL (use createParameter(ArgMetaInfo, String, MatchOperator, AdlSqlType) instead)
      argMetaInfo - describes the source argument type
      argValue - value to be passed as parameter of a query
      matchOperator - context information: the operation the parameter is required for
      adlSqlType - requested type (target column)
      Returns:
      parameter for PreparedStatement execution
      Throws:
      de.calamanari.adl.cnv.tps.AdlFormattingException - in case of incompatibilities and errors
    • createParameter

      QueryParameter createParameter(de.calamanari.adl.cnv.tps.ArgMetaInfo argMetaInfo, String argValue, de.calamanari.adl.irl.MatchOperator matchOperator, AdlSqlType adlSqlType)
      Takes an argument from an expression with AdlType information as its input to create a QueryParameter to be applied to a PreparedStatement at a later time.

      Parameters:
      argMetaInfo - describes the source argument type
      argValue - value to be passed as parameter of a query
      matchOperator - context information: the operation the parameter is required for
      adlSqlType - requested type (target column)
      Returns:
      parameter for PreparedStatement execution
      Throws:
      de.calamanari.adl.cnv.tps.AdlFormattingException - in case of incompatibilities and errors
    • isTypeCombinationSupported

      boolean isTypeCombinationSupported(de.calamanari.adl.cnv.tps.AdlType sourceType, AdlSqlType targetType)
      This method tells whether an argument of the given sourceType can be mapped to the targetType to create a valid SQL-parameter.
      It is meant for detecting configuration errors early.

      Important: This method only tells that a conversion from the source type to the target type might be possible. It can still happen that a particular value will be rejected at runtime.

      Examples:

      • A string to integer conversion is only possible if the input value is the textual representation of an integer. This method should return true
      • It is principally impossible to turn a boolean into a date. This method should return false.
      By definition, AdlSqlTypes shall be incompatible (return false) to any AdlSqlType (even itself) to ensure SQL-types cannot be abused for the logical data model.
      Parameters:
      sourceType - argument type from the logical data model
      targetType - column type
      Returns:
      true if the combination is supported by this creator, otherwise false