ADSQLFunctionExpression

public class ADSQLFunctionExpression: ADSQLExpression

Defines a function being called in a SQL instruction such as count or sum.

  • If true and the function is an aggregate function, the function is in the accumulation pass where it is accumulating values. If false the function will simply report the values acquired in the accumulation pass.

    Declaration

    Swift

    public static var accumulate = true
  • The type of function being performed.

    Declaration

    Swift

    public var functionType: ADSQLFunction
  • The list of optional parameters being passed to the function.

    Declaration

    Swift

    public var parameters: [ADSQLExpression] = []
  • Returns true if the function is one of the aggregate functions: COUNT, MIN, MAX, AVG, SUM.

    Declaration

    Swift

    public var isAggregate: Bool
  • Evaluates the given expression and returns a result based on the data in the record passed in.

    Declaration

    Swift

    @discardableResult public func evaluate(forRecord row: ADRecord? = nil) throws -> Any?

    Parameters

    row

    A ADRecord containing values to be evaluated against the expression.

    Return Value

    The result of the evaluation.

  • Ensures the proper number of parameters have been passed to a given function call.

    Remark

    Throws an error if the proper number of parameters have not been provided.

    Declaration

    Swift

    public func ensureParameterCount(equals num: Int) throws

    Parameters

    num

    The number of required parameters.

  • Ensures the proper number of parameters have been passed to a given function call.

    Remark

    Throws an error if the proper number of parameters have not been provided.

    Declaration

    Swift

    public func ensureParameterCount(between min: Int, and max: Int) throws

    Parameters

    min

    The minimal number of parameters.

    max

    The maximum number of parameters.

  • Encodes the expression into an Instance Dictionary for storage in a Swift Portable Object Notation (SPON) format. -Returns: The expression represented as an Instance Dictionary.

    Declaration

    Swift

    public func encode() -> ADInstanceDictionary
  • Decodes the expression from an Instance Dictionary that has been read from a Swift Portable Object Notation (SPON) stream.

    Declaration

    Swift

    public func decode(fromInstance dictionary: ADInstanceDictionary)

    Parameters

    dictionary

    A ADInstanceDictionary representing the values for the expression.