Class QueryParameter

java.lang.Object
ortus.boxlang.runtime.jdbc.QueryParameter

public class QueryParameter extends Object
Represents a parameter to a SQL query created via QueryExecute or the Query component.
  • Method Details

    • fromAny

      public static QueryParameter fromAny(Object value)
      Construct a new QueryParameter from a given value.

      If the value is an IStruct, it will be used as the construction arguments to QueryParameter(String, IStruct). Otherwise, the QueryParameter will be constructed with the value as the `value` property of the IStruct, and no sqltype, null, list, or maxLength/scale properties.

    • fromAny

      public static QueryParameter fromAny(String name, Object value)
      Construct a new QueryParameter from a given name and value.

      If the value is an IStruct, it will be used as the construction arguments to QueryParameter(String, IStruct). Otherwise, the QueryParameter will be constructed with the value as the `value` property of the IStruct, and no sqltype, null, list, or maxLength/scale properties.

      Parameters:
      name - The parameter name. Null is completely valid.
      value - The parameter value.
    • getName

      public String getName()
      Retrieve the parameter name.
    • isListParam

      public boolean isListParam()
      Is this a list parameter?
    • isNullParam

      public boolean isNullParam()
      Is this parameter specifically typed as 'null'?
    • getValue

      public Object getValue()
      Retrieve the parameter value.
    • toSQLType

      public Object toSQLType(IBoxContext context)
      Retrieve the value casted to the declared SQL type of the parameter..
    • getType

      public QueryColumnType getType()
      Retrieve the QueryColumnType of the parameter.
    • getSqlTypeAsInt

      public int getSqlTypeAsInt()
      Retrieve the SQL type as an ordinal from Types.

      For example, Types.VARCHAR is 12.

    • getScaleOrLength

      public Integer getScaleOrLength()
      Retrieve the `scale` or `maxLength` of the parameter.

      For QueryColumnType.DOUBLE and QueryColumnType.DECIMAL, this is the `scale`. For all other types, this is the `maxLength` property.

    • isNull

      public boolean isNull()
      Returns whether this parameter has a null value override.

      For example: <bx:queryparam null="true" />