Class SqlMetaOrd

  • All Implemented Interfaces:
    SqlMetaElement

    class SqlMetaOrd
    extends Object
    implements SqlMetaElement
    A META SQL sub-element. It represents the ORDER command of the final ANSI SQL.

    Schematically:

     SqlMetaOrd
         SqlMetaText
         SqlMetaIdent
         SqlMetaConst
     
    Author:
    Vladimir Hudec
    • Field Detail

      • logger

        final org.slf4j.Logger logger
        The internal slf4j logger.
      • elements

        List<SqlMetaSimple> elements
        The list of sub-elements based on ANTLR grammar.
      • id

        String id
        The ordering id. This value should correspond to the order number in META SQL {#NNN order by ...}.
    • Constructor Detail

      • SqlMetaOrd

        SqlMetaOrd​(String id)
        Creates a new instance. It's used from inside ANTLR parser.
        Parameters:
        id - the ordering id, which corresponds to the order number in META SQL {#NNN order by ...}
    • Method Detail

      • addElement

        void addElement​(SqlMetaSimple element)
        Adds a new sub-element. It's used from inside ANTLR parser.
        Parameters:
        element - new sub-element, based on ANTLR grammar
      • process

        private StringBuilder process​(StringBuilder sql,
                                      SqlOrder.Order orderDirrection)
        Returns ANSI SQL ORDER command for one ordering rule.
        Parameters:
        sql - the cumulative fragment of the final ordering command
        orderDirrection - the ASC or DESC ordering direction
        Returns:
        the cumulative fragment of the final ordering command
      • process

        public SqlProcessResult process​(SqlProcessContext ctx)
        The main contract for a dynamic ANSI SQL Query generation. Also known as a META SQL processing. The composite pattern main contract. All ANTLR grammar based elements must implement this contract.
        Specified by:
        process in interface SqlMetaElement
        Parameters:
        ctx - the crate for all input parameters and the context of processing