Class ParserUtils
- java.lang.Object
-
- io.debezium.connector.oracle.antlr.listener.ParserUtils
-
public class ParserUtils extends Object
This class contains a few methods for parser listeners
-
-
Constructor Summary
Constructors Modifier Constructor Description privateParserUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloneOldToNewColumnValues(Map<String,LogMinerColumnValueWrapper> newColumnValues, Map<String,LogMinerColumnValueWrapper> oldColumnValues, Table table)Initialize new column values with old column values.static ObjectconvertValueToSchemaType(Column column, Object value, OracleValueConverters converters)This converts the given value to the appropriate object.(package private) static StringgetTableName(PlSqlParser.Tableview_nameContext tableview_name)Obtains the table namestatic StringremoveApostrophes(String text)In some cases values of the parsed expression are enclosed in apostrophes.static StringreplaceDoubleBackSlashes(String text)this is to handle cases when a record contains escape character(s)static StringstripeAlias(String text, String alias)this method stripes table alias and dot give stringstatic StringstripeQuotes(String text)stripes double quotes that surrounds a string
-
-
-
Method Detail
-
stripeQuotes
public static String stripeQuotes(String text)
stripes double quotes that surrounds a string- Parameters:
text- text- Returns:
- text without surrounding double quotes
-
stripeAlias
public static String stripeAlias(String text, String alias)
this method stripes table alias and dot give string- Parameters:
text- string with possible aliasalias- table alias- Returns:
- striped string
-
cloneOldToNewColumnValues
public static void cloneOldToNewColumnValues(Map<String,LogMinerColumnValueWrapper> newColumnValues, Map<String,LogMinerColumnValueWrapper> oldColumnValues, Table table)
Initialize new column values with old column values. It does not override new values which were processed already in where clause parsing- Parameters:
newColumnValues- values to set or insertoldColumnValues- values in WHERE clausetable- Debezium Table object
-
convertValueToSchemaType
public static Object convertValueToSchemaType(Column column, Object value, OracleValueConverters converters)
This converts the given value to the appropriate object. The conversion is based on the column definition- Parameters:
column- column Objectvalue- value objectconverters- given converter- Returns:
- object as the result of this conversion. It could be null if converter cannot build the schema or if converter or value are null
-
removeApostrophes
public static String removeApostrophes(String text)
In some cases values of the parsed expression are enclosed in apostrophes. Even null values are surrounded by single apostrophes. This method removes them.- Parameters:
text- supplied value which might be enclosed by apostrophes.- Returns:
- clean String or null in case if test = "null" or = "NULL"
-
replaceDoubleBackSlashes
public static String replaceDoubleBackSlashes(String text)
this is to handle cases when a record contains escape character(s)- Parameters:
text- before parsing we replaced it with double escape, now revert it back- Returns:
- string with double slashes
-
getTableName
static String getTableName(PlSqlParser.Tableview_nameContext tableview_name)
Obtains the table name- Parameters:
tableview_name- table view context- Returns:
- table name
-
-