Class Insert

    • Constructor Detail

      • Insert

        public Insert()
        Constructs a default instance of this class.
      • Insert

        public Insert​(GroupSymbol group,
                      List<ElementSymbol> variables,
                      List values)
        Construct an instance with group, variable list (may be null), and values
        Parameters:
        group - Group associated with this insert
        variables - List of ElementSymbols that represent columns for the values, null implies all columns
        values - List of Expression values to be inserted
    • Method Detail

      • getType

        public int getType()
        Return type of command.
        Specified by:
        getType in class Command
        Returns:
        TYPE_INSERT
      • getGroup

        public GroupSymbol getGroup()
        Returns the group being inserted into
        Returns:
        Group being inserted into
      • setGroup

        public void setGroup​(GroupSymbol group)
        Set the group for this insert statement
        Parameters:
        group - Group to be inserted into
      • getVariables

        public List<ElementSymbol> getVariables()
        Return an ordered List of variables, may be null if no columns were specified
        Returns:
        List of ElementSymbol
      • addVariable

        public void addVariable​(ElementSymbol var)
        Add a variable to end of list
        Parameters:
        var - Variable to add to the list
      • addVariables

        public void addVariables​(Collection<ElementSymbol> vars)
        Add a collection of variables to end of list
        Parameters:
        vars - Variables to add to the list - collection of ElementSymbol
      • getValues

        public List getValues()
        Returns a list of values to insert to be inserted.
        Returns:
        List of Expressions
      • setValues

        public void setValues​(List values)
        Sets the values to be inserted.
        Parameters:
        values - List of Expressions
      • setVariables

        public void setVariables​(Collection<ElementSymbol> vars)
        Set a collection of variables that replace the existing variables
        Parameters:
        vars - Variables to be set on this object (ElementSymbols)
      • addValue

        public void addValue​(Expression value)
        Adds a value to the list of values
        Parameters:
        value - Expression to be added to the list of values
      • setQueryExpression

        public void setQueryExpression​(QueryCommand query)
      • getQueryExpression

        public QueryCommand getQueryExpression()
      • acceptVisitor

        public void acceptVisitor​(LanguageVisitor visitor)
        Description copied from interface: LanguageObject
        Method for accepting a visitor. It is the responsibility of the language object to call back on the visitor.
        Parameters:
        visitor - Visitor being used
      • hashCode

        public int hashCode()
        Get hashcode for command. WARNING: This hash code relies on the hash codes of the Group, variables. If the command changes, it's hash code will change and it can be lost from collections. Hash code is only valid after command has been completely constructed.
        Overrides:
        hashCode in class Object
        Returns:
        Hash code for object
      • equals

        public boolean equals​(Object obj)
        Compare two Insert commands for equality. Will only evaluate to equal if they are IDENTICAL: group is equal, value is equal and variables are equal.
        Overrides:
        equals in class Object
        Parameters:
        obj - Other object
        Returns:
        True if equal
      • getProjectedSymbols

        public List<Expression> getProjectedSymbols()
        Get the ordered list of all elements returned by this query. These elements may be ElementSymbols or ExpressionSymbols but in all cases each represents a single column.
        Specified by:
        getProjectedSymbols in class Command
        Returns:
        Ordered list of SingleElementSymbol
      • setTupleSource

        public void setTupleSource​(TupleSource tupleSource)
      • getConstraint

        public Criteria getConstraint()
      • setConstraint

        public void setConstraint​(Criteria constraint)
      • isUpsert

        public boolean isUpsert()
      • setUpsert

        public void setUpsert​(boolean merge)