java.lang.Object
org.miaixz.bus.pager.dialect.replace.RegexWithNolock
- All Implemented Interfaces:
ReplaceSql
Implements
ReplaceSql to handle SQL Server's `with(nolock)` hint using regular expressions. It temporarily
replaces `with(nolock)` with a placeholder for SQL parsing and then restores it.- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringPlaceholder for `with(nolock)` during SQL parsing. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
WITHNOLOCK
Placeholder for `with(nolock)` during SQL parsing.
-
-
Constructor Details
-
RegexWithNolock
public RegexWithNolock()
-
-
Method Details
-
replace
Replaces `with(nolock)` clauses in the SQL with a temporary placeholder. This is done to prevent parsing errors with SQL parsers that do not understand `with(nolock)`.- Specified by:
replacein interfaceReplaceSql- Parameters:
sql- the original SQL string- Returns:
- the SQL string with `with(nolock)` replaced by a placeholder
-
restore
Restores the `with(nolock)` clauses in the SQL from their temporary placeholders. This is called after SQL parsing and modification.- Specified by:
restorein interfaceReplaceSql- Parameters:
sql- the SQL string with placeholders- Returns:
- the SQL string with `with(nolock)` restored
-