Package gudusoft.gsqlparser
Class TSafeParserPool
Object
gudusoft.gsqlparser.TParserPool
gudusoft.gsqlparser.TSafeParserPool
Thread-safe parser pool that clears parser references from parse trees.
This eliminates any potential issues with shared parser references when
parse trees are used concurrently after parsing.
This pool ensures complete isolation of parse trees from parser instances,
making them safe to use in any concurrent scenario.
-
Nested Class Summary
Nested classes/interfaces inherited from class gudusoft.gsqlparser.TParserPool
TParserPool.ParserFunction<T>, TParserPool.PoolStatistics, TParserPool.TimeoutException -
Constructor Summary
ConstructorsConstructorDescriptionCreates a safe parser pool with default sizeTSafeParserPool(int poolSize) Creates a safe parser pool with specified size -
Method Summary
Modifier and TypeMethodDescriptionsafeParseSQL(EDbVendor vendor, String sqlText) Safe parsing method that returns statements without parser references.safeTokenizeSQL(EDbVendor vendor, String sqlText) Safe tokenization method.<T> TwithParser(EDbVendor vendor, TParserPool.ParserFunction<T> function) Executes a function with a borrowed parser and automatically returns it.Methods inherited from class gudusoft.gsqlparser.TParserPool
borrowParser, getStatistics, prewarm, returnParser, shutdown
-
Constructor Details
-
TSafeParserPool
public TSafeParserPool()Creates a safe parser pool with default size -
TSafeParserPool
Creates a safe parser pool with specified size- Parameters:
poolSize- Size of the pool for each vendor
-
-
Method Details
-
withParser
Executes a function with a borrowed parser and automatically returns it. This version clears parser references from the parse tree before returning.- Overrides:
withParserin classTParserPool- Parameters:
vendor- Database vendorfunction- Function to execute with the parser- Returns:
- Result of the function
- Throws:
Exception
-
safeParseSQL
Safe parsing method that returns statements without parser references.- Parameters:
vendor- Database vendorsqlText- SQL text to parse- Returns:
- Parsed statements with no parser references
- Throws:
Exception
-
safeTokenizeSQL
Safe tokenization method.- Parameters:
vendor- Database vendorsqlText- SQL text to tokenize- Returns:
- Token list
- Throws:
Exception
-