Package gudusoft.gsqlparser.resolver2
Class TSQLResolverConfig
Object
gudusoft.gsqlparser.resolver2.TSQLResolverConfig
Configuration for TSQLResolver2.
Controls various aspects of name resolution behavior.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intPick the last candidate table (farthest in FROM clause order)static final String[]Human-readable names for strategy valuesstatic final intPick the first candidate table (nearest in FROM clause order)static final intDo not pick any candidate, leave as unresolved/ambiguous -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanGuessWithConfidence(double confidence) Check if a confidence value is sufficient to allow guessing.voidClear any custom guess column strategy, reverting to TBaseType.GUESS_COLUMN_STRATEGY.static TSQLResolverConfigCreate configuration for case-sensitive matchingstatic TSQLResolverConfigCreate a default configurationstatic TSQLResolverConfigcreateForVendor(EDbVendor vendor) Create configuration for a specific database vendor.static TSQLResolverConfigcreateForVendorWithDatatype(EDbVendor vendor) Create configuration for a specific database vendor with datatype display enabled.static TSQLResolverConfigCreate configuration for standalone mode (no legacy sync)static TSQLResolverConfigCreate configuration with showCTE enabled.static TSQLResolverConfigCreate configuration with showDatatype enabled.Get the display name mode.Get the display name policy.intGet the strategy for handling ambiguous columns.Get the human-readable name for the current strategy.doubleintdoubleGet the minimum confidence threshold to allow guessing.doubleGet the minimum confidence threshold for definite resolutions.doubleintGet the database vendor, if set.booleanCheck if a custom guess column strategy has been set on this config.booleanCheck if vendor-specific name matching is enabled.booleanCheck if guessing is allowed when all candidates are inferred.booleanbooleanisDefiniteConfidence(double confidence) Check if a confidence value represents a definite resolution.booleanDeprecated.Use NamespaceEnhancer insteadbooleanbooleanCheck if CTE (Common Table Expression) tables and columns should be shown in output.booleanCheck if datatype information should be shown for columns from CREATE TABLE statements.booleanCheck if delimiters should be stripped for display.voidsetAllowGuessWhenAllInferred(boolean allow) Set whether to allow guessing when all candidates are inferred.voidsetCollectFullCandidates(boolean collectFullCandidates) voidSet the display name mode.voidSet the display name policy.voidsetEvidenceCollectionEnabled(boolean enabled) Deprecated.Use NamespaceEnhancer insteadvoidsetGuessColumnStrategy(int strategy) Set the strategy for handling ambiguous columns.voidsetLegacyCompatibilityEnabled(boolean enabled) voidsetLegacySyncMinConfidence(double threshold) voidsetMaxIterations(int maxIterations) voidsetMinConfidenceToGuess(double threshold) Set the minimum confidence threshold to allow guessing.voidsetMinDefiniteConfidence(double threshold) Set the minimum confidence threshold for definite resolutions.voidsetMinProgressRate(double minProgressRate) voidsetNameMatcher(INameMatcher nameMatcher) voidsetShowCTE(boolean showCTE) Set whether to show CTE (Common Table Expression) tables and columns in output.voidsetShowDatatype(boolean showDatatype) Set whether to show datatype information for columns from CREATE TABLE statements.voidsetStablePassesForConvergence(int stablePasses) voidsetStripDelimitersForDisplay(boolean stripDelimiters) Set whether to strip delimiters for display.voidSet the database vendor and update name matcher accordingly.toString()
-
Field Details
-
GUESS_COLUMN_STRATEGY_NEAREST
Pick the first candidate table (nearest in FROM clause order)- See Also:
-
GUESS_COLUMN_STRATEGY_FARTHEST
Pick the last candidate table (farthest in FROM clause order)- See Also:
-
GUESS_COLUMN_STRATEGY_NOT_PICKUP
Do not pick any candidate, leave as unresolved/ambiguous- See Also:
-
GUESS_COLUMN_STRATEGY_NAMES
Human-readable names for strategy values
-
-
Constructor Details
-
TSQLResolverConfig
public TSQLResolverConfig()
-
-
Method Details
-
getNameMatcher
-
setNameMatcher
-
isLegacyCompatibilityEnabled
-
setLegacyCompatibilityEnabled
-
getLegacySyncMinConfidence
-
setLegacySyncMinConfidence
-
getMaxIterations
-
setMaxIterations
-
getMinProgressRate
-
setMinProgressRate
-
getStablePassesForConvergence
-
setStablePassesForConvergence
-
isCollectFullCandidates
-
setCollectFullCandidates
-
isEvidenceCollectionEnabled
Deprecated.Use NamespaceEnhancer instead -
setEvidenceCollectionEnabled
Deprecated.Use NamespaceEnhancer instead -
isShowDatatype
Check if datatype information should be shown for columns from CREATE TABLE statements.- Returns:
- true if datatype information should be included in column names
-
setShowDatatype
Set whether to show datatype information for columns from CREATE TABLE statements. When enabled, columns from CREATE TABLE will include datatype info in format: columnName:datatypeName:length or columnName:datatypeName:precision:scale- Parameters:
showDatatype- true to include datatype information
-
isShowCTE
Check if CTE (Common Table Expression) tables and columns should be shown in output.- Returns:
- true if CTE tables and columns should be included
-
setShowCTE
Set whether to show CTE (Common Table Expression) tables and columns in output. When enabled, CTE tables are included in the tables list and CTE columns are included in the fields list with "(CTE)" suffix.- Parameters:
showCTE- true to include CTE tables and columns
-
getDisplayNameMode
Get the display name mode.- Returns:
- the current display name mode
-
setDisplayNameMode
Set the display name mode.- Parameters:
mode- the display name mode
-
getDisplayNamePolicy
Get the display name policy.- Returns:
- the current display name policy
-
setDisplayNamePolicy
Set the display name policy.- Parameters:
policy- the display name policy
-
isStripDelimitersForDisplay
Check if delimiters should be stripped for display.- Returns:
- true if delimiters should be stripped
-
setStripDelimitersForDisplay
Set whether to strip delimiters for display.- Parameters:
stripDelimiters- true to strip delimiters
-
getGuessColumnStrategy
Get the strategy for handling ambiguous columns. Returns the configured value, or TBaseType.GUESS_COLUMN_STRATEGY if not set.- Returns:
- One of GUESS_COLUMN_STRATEGY_NEAREST, GUESS_COLUMN_STRATEGY_FARTHEST, or GUESS_COLUMN_STRATEGY_NOT_PICKUP
-
setGuessColumnStrategy
Set the strategy for handling ambiguous columns.- Parameters:
strategy- One of GUESS_COLUMN_STRATEGY_NEAREST, GUESS_COLUMN_STRATEGY_FARTHEST, or GUESS_COLUMN_STRATEGY_NOT_PICKUP
-
hasCustomGuessColumnStrategy
Check if a custom guess column strategy has been set on this config. If false, the strategy from TBaseType.GUESS_COLUMN_STRATEGY will be used.- Returns:
- true if a custom strategy is set
-
clearGuessColumnStrategy
Clear any custom guess column strategy, reverting to TBaseType.GUESS_COLUMN_STRATEGY. -
getGuessColumnStrategyName
Get the human-readable name for the current strategy.- Returns:
- Strategy name (e.g., "GUESS_COLUMN_STRATEGY_NEAREST")
-
getMinDefiniteConfidence
Get the minimum confidence threshold for definite resolutions.- Returns:
- Threshold value [0.0, 1.0]
-
setMinDefiniteConfidence
Set the minimum confidence threshold for definite resolutions.- Parameters:
threshold- Threshold value [0.0, 1.0]
-
getMinConfidenceToGuess
Get the minimum confidence threshold to allow guessing.- Returns:
- Threshold value [0.0, 1.0]
-
setMinConfidenceToGuess
Set the minimum confidence threshold to allow guessing.- Parameters:
threshold- Threshold value [0.0, 1.0]
-
isAllowGuessWhenAllInferred
Check if guessing is allowed when all candidates are inferred.- Returns:
- true if guessing is allowed with inferred candidates
-
setAllowGuessWhenAllInferred
Set whether to allow guessing when all candidates are inferred.- Parameters:
allow- true to allow guessing with inferred candidates
-
isDefiniteConfidence
Check if a confidence value represents a definite resolution.- Parameters:
confidence- The confidence value to check- Returns:
- true if the confidence is >= minDefiniteConfidence
-
canGuessWithConfidence
Check if a confidence value is sufficient to allow guessing.- Parameters:
confidence- The confidence value to check- Returns:
- true if the confidence is >= minConfidenceToGuess
-
createDefault
Create a default configuration -
createCaseSensitive
Create configuration for case-sensitive matching -
createStandalone
Create configuration for standalone mode (no legacy sync) -
createWithDatatype
Create configuration with showDatatype enabled. This configuration includes datatype information for columns from CREATE TABLE statements. -
createWithCTE
Create configuration with showCTE enabled. This configuration includes CTE tables and columns in the output. -
createForVendor
Create configuration for a specific database vendor.This factory method creates a configuration with vendor-specific name matching rules. The VendorNameMatcher uses IdentifierService to properly handle case sensitivity and quote handling for each vendor.
Example vendor behaviors:
- Oracle: Unquoted identifiers fold to UPPER, quoted are case-sensitive
- PostgreSQL: Unquoted identifiers fold to LOWER, quoted are case-sensitive
- MySQL: Depends on lower_case_table_names setting
- BigQuery: Table names are case-sensitive, column names are case-insensitive
- Parameters:
vendor- the database vendor- Returns:
- configuration with vendor-specific name matcher
-
createForVendorWithDatatype
Create configuration for a specific database vendor with datatype display enabled.- Parameters:
vendor- the database vendor- Returns:
- configuration with vendor-specific name matcher and datatype display
-
getVendor
Get the database vendor, if set.- Returns:
- the database vendor, or null if not set
-
setVendor
Set the database vendor and update name matcher accordingly.- Parameters:
vendor- the database vendor
-
hasVendor
Check if vendor-specific name matching is enabled.- Returns:
- true if a vendor is configured
-
toString
-