Class DmlAstUtils


  • public final class DmlAstUtils
    extends Object
    AST utils for DML
    • Method Detail

      • selectForInsertOrMerge

        public static GridSqlQuery selectForInsertOrMerge​(GridSqlColumn[] cols,
                                                          List<GridSqlElement[]> rows,
                                                          GridSqlQuery subQry)
        Create SELECT on which subsequent INSERT or MERGE will be based.
        Parameters:
        cols - Columns to insert values into.
        rows - Rows to create pseudo-SELECT upon.
        subQry - Subquery to use rather than rows.
        Returns:
        Subquery or pseudo-SELECT to evaluate inserted expressions, or null no query needs to be run.
      • selectForDelete

        public static GridSqlSelect selectForDelete​(GridSqlDelete del)
        Generate SQL SELECT based on DELETE's WHERE, LIMIT, etc.
        Parameters:
        del - Delete statement.
        Returns:
        SELECT statement.
      • getFastUpdateArgs

        public static FastUpdate getFastUpdateArgs​(GridSqlUpdate update)
        Parameters:
        update - UPDATE statement.
        Returns:
        null if given statement directly updates _val column with a literal or param value and filters by single non expression key (and, optionally, by single non expression value).
      • getFastDeleteArgs

        public static FastUpdate getFastDeleteArgs​(GridSqlDelete del)
        Parameters:
        del - DELETE statement.
        Returns:
        true if given statement filters by single non expression key.
      • selectForUpdate

        public static GridSqlSelect selectForUpdate​(GridSqlUpdate update)
        Generate SQL SELECT based on UPDATE's WHERE, LIMIT, etc.
        Parameters:
        update - Update statement.
        Returns:
        SELECT statement.
      • collectAllGridTablesInTarget

        public static void collectAllGridTablesInTarget​(GridSqlElement from,
                                                        Set<GridSqlTable> tbls)
        Parameters:
        from - From element.
        tbls - Tables.
      • gridTableForElement

        public static GridSqlTable gridTableForElement​(GridSqlElement target)
        Parameters:
        target - Expression to extract the table from.
        Returns:
        Back end table for this element.