Package de.businesscode.sqlengine
Class SQLEngine
java.lang.Object
de.businesscode.sqlengine.SQLEngine
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 -
Method Summary
Modifier and TypeMethodDescriptionGetter for a list of all BindindItems used in this sqlint
Get first index of selected BindingItemGetter for the BindingSet requested for this sqlGetter for BindingSets which where chosen base on the BindingSet name and BindingItemsGetter for a list of all BindindItems used in this sql and mentioned before the table nametransformtransformtransformParams
(String sql, Map<String, Integer> multiplicities, String keyword, String separator, Vector<String> substitutes) simple transform parameters into multiplicities of actual question marks ('?')
-
Constructor Details
-
SQLEngine
public SQLEngine()
-
-
Method Details
-
getSelectedBindigItemsInOrder
Getter for a list of all BindindItems used in this sql and mentioned before the table name -
getAllBindigItemsInOrder
Getter for a list of all BindindItems used in this sql -
getIndex
Get first index of selected BindingItem -
getResultingBindingSets
Getter for BindingSets which where chosen base on the BindingSet name and BindingItems -
getRequestedBindingSetNames
Getter for the BindingSet requested for this sql -
transform
transform- Parameters:
sql
-- Returns:
- the transformed sql
-
transform
- Parameters:
sql
-additionalProps
-- Returns:
-
transform
transform- Parameters:
sql
-bindings
-- Returns:
- the transformed sql
-
transform
- Parameters:
sql
-bindings
-additionalProps
-- Returns:
-
transformParams
public String transformParams(String sql, Map<String, Integer> multiplicities, String keyword, String separator, Vector<String> substitutes) simple transform parameters into multiplicities of actual question marks ('?') and store the substituted unqualified names- Parameters:
sql
- input stringsubstitutes
- 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 1keyword
- 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.
-