Class SQLEngine


  • public class SQLEngine
    extends java.lang.Object
    The SQL Engine can transform sql fragments containing references to BindingSets into pure sql, resolving table and column names To resolve the given binding set/group names to the right concrete BindingSets first, it parses the given sql twice, - In phase 2 it will just collect the binding set name - binding item names combination, using BindingsLookupContextObject and BindingSetLookupContextObject - In phase 2 it does then know the concrete BindingSet and BindingItem and can output the appropriate table and column names, using BindingsContextObject and BindingSetContextObject
    • Constructor Summary

      Constructors 
      Constructor Description
      SQLEngine()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<BindingItem> getAllBindigItemsInOrder()
      Getter for a list of all BindindItems used in this sql
      int getIndex​(java.lang.String bindingItem)
      Get first index of selected BindingItem
      java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.String>> getRequestedBindingSetNames()
      Getter for the BindingSet requested for this sql
      java.util.Set<StandardBindingSet> getResultingBindingSets()
      Getter for BindingSets which where chosen base on the BindingSet name and BindingItems
      java.util.List<BindingItem> getSelectedBindigItemsInOrder()
      Getter for a list of all BindindItems used in this sql and mentioned before the table name
      java.lang.String transform​(java.lang.String sql)
      transform
      java.lang.String transform​(java.lang.String sql, Bindings bindings)
      transform
      java.lang.String transform​(java.lang.String sql, Bindings bindings, java.util.Map<java.lang.String,​java.lang.Object> additionalProps)  
      java.lang.String transform​(java.lang.String sql, java.util.Map<java.lang.String,​java.lang.Object> additionalProps)  
      java.lang.String transformParams​(java.lang.String sql, java.util.Map<java.lang.String,​java.lang.Integer> multiplicities, java.lang.String keyword, java.lang.String separator, java.util.Vector<java.lang.String> substitutes)
      simple transform parameters into multiplicities of actual question marks ('?')
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SQLEngine

        public SQLEngine()
    • Method Detail

      • getSelectedBindigItemsInOrder

        public java.util.List<BindingItem> getSelectedBindigItemsInOrder()
        Getter for a list of all BindindItems used in this sql and mentioned before the table name
      • getAllBindigItemsInOrder

        public java.util.List<BindingItem> getAllBindigItemsInOrder()
        Getter for a list of all BindindItems used in this sql
      • getIndex

        public int getIndex​(java.lang.String bindingItem)
        Get first index of selected BindingItem
      • getResultingBindingSets

        public java.util.Set<StandardBindingSet> getResultingBindingSets()
        Getter for BindingSets which where chosen base on the BindingSet name and BindingItems
      • getRequestedBindingSetNames

        public java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.String>> getRequestedBindingSetNames()
        Getter for the BindingSet requested for this sql
      • transform

        public java.lang.String transform​(java.lang.String sql)
        transform
        Parameters:
        sql -
        Returns:
        the transformed sql
      • transform

        public java.lang.String transform​(java.lang.String sql,
                                          java.util.Map<java.lang.String,​java.lang.Object> additionalProps)
        Parameters:
        sql -
        additionalProps -
        Returns:
      • transform

        public java.lang.String transform​(java.lang.String sql,
                                          Bindings bindings)
        transform
        Parameters:
        sql -
        bindings -
        Returns:
        the transformed sql
      • transform

        public java.lang.String transform​(java.lang.String sql,
                                          Bindings bindings,
                                          java.util.Map<java.lang.String,​java.lang.Object> additionalProps)
        Parameters:
        sql -
        bindings -
        additionalProps -
        Returns:
      • transformParams

        public java.lang.String transformParams​(java.lang.String sql,
                                                java.util.Map<java.lang.String,​java.lang.Integer> multiplicities,
                                                java.lang.String keyword,
                                                java.lang.String separator,
                                                java.util.Vector<java.lang.String> substitutes)
        simple transform parameters into multiplicities of actual question marks ('?') and store the substituted unqualified names
        Parameters:
        sql - input string
        substitutes - List that will contain the substitutions. Unchecked for null.
        multiplicities - map the keywords to number of substitutions needed. If null, number of substitutions is consistently 1
        keyword - pretext that is used for look up of values to transform. If null, 'params' is used.
        Returns:
        the input string with occurences like '$params.some_name_or_other' substituted by '?' (or by '?,?,?' depending on the multiplicity map) and the List of the 'some_name_or_other' in the substitutes List.