Class AbstractSingleColumnSqlRedoPreambleParser
java.lang.Object
io.debezium.connector.oracle.logminer.parser.AbstractSingleColumnSqlRedoPreambleParser
- All Implemented Interfaces:
SingleColumnSqlRedoPreambleParser
- Direct Known Subclasses:
AbstractSelectSingleColumnSqlRedoPreambleParser,ExtendedStringParser
public abstract class AbstractSingleColumnSqlRedoPreambleParser
extends Object
implements SingleColumnSqlRedoPreambleParser
A common abstract base class for
SingleColumnSqlRedoPreambleParser implementations.- Author:
- Chris Cranford
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract LogMinerDmlEntrycreateDmlEntryForColumnValues(Object[] columnValues) Creates theLogMinerDmlEntryfor the column values.Get the name of the parsed columnGet the schema name of the parsed statement.Get the table name of the parsed statement.protected static intindexOfThrow(String findValue, String value, int fromIndex) Performs anString.indexOf(int, int)on the givenvalue, throwing an exception if not found.Parses the redo SQL.protected intparseColumnValue(String sql, int index, int columnIndex) Parses a column value from the given SQL.protected abstract voidparseInternal(String sql, Table table) An internal parse handler that handles the unique logic per parser implementation.protected intparseOperator(String sql, int index) Parses a SQL operator at the specified offset.protected static intparseQuotedValue(String sql, int index, Consumer<String> collector) Parses a quoted SQL value.protected intparseWhereClause(String sql, int index, Table table) Parses the SQL where-clauseprotected voidreset()protected static booleanstartsWithAtIndex(String startsWithValue, int index, String value) Checks that the specifiedvaluestarts with the given valuestartsWithValueat the given index.protected static booleanstartsWithAtIndexThrow(String startsWith, int index, String value) Checks that the specifiedvaluestarts with the given valuestartsWithValueat the given index.
-
Field Details
-
DECLARE
- See Also:
-
BEGIN
- See Also:
-
WHERE
- See Also:
-
AND
- See Also:
-
OR
- See Also:
-
FOR_UPDATE
- See Also:
-
schemaName
-
tableName
-
columnName
-
columnValues
-
-
Constructor Details
-
AbstractSingleColumnSqlRedoPreambleParser
public AbstractSingleColumnSqlRedoPreambleParser()
-
-
Method Details
-
getSchemaName
Description copied from interface:SingleColumnSqlRedoPreambleParserGet the schema name of the parsed statement.- Specified by:
getSchemaNamein interfaceSingleColumnSqlRedoPreambleParser- Returns:
- the schema name
-
getTableName
Description copied from interface:SingleColumnSqlRedoPreambleParserGet the table name of the parsed statement.- Specified by:
getTableNamein interfaceSingleColumnSqlRedoPreambleParser- Returns:
- the table name
-
getColumnName
Description copied from interface:SingleColumnSqlRedoPreambleParserGet the name of the parsed column- Specified by:
getColumnNamein interfaceSingleColumnSqlRedoPreambleParser- Returns:
- the column name
-
reset
protected void reset() -
parse
Description copied from interface:SingleColumnSqlRedoPreambleParserParses the redo SQL. Must be called before fetching state from the parser.- Specified by:
parsein interfaceSingleColumnSqlRedoPreambleParser- Parameters:
sql- the redo SQL to be parsed, can benulltable- the table the redo SQL is related to, should not benull- Returns:
- the preamble parse data
- Throws:
ParsingException- if the parser failed to parse the redo SQL
-
parseInternal
An internal parse handler that handles the unique logic per parser implementation.- Parameters:
sql- the SQL to be parsed, should not benulltable- the relational table model, should not benull
-
parseQuotedValue
Parses a quoted SQL value.- Parameters:
sql- the SQL to be parsedindex- the position in the SQL where the parse startscollector- the consumer functor to receive the parsed value- Returns:
- the index where the quoted value token ends
-
parseOperator
Parses a SQL operator at the specified offset.- Parameters:
sql- the SQL to be parsedindex- the position in the SQL where the operator parse starts- Returns:
- the index where the operator ends
-
parseColumnValue
Parses a column value from the given SQL.- Parameters:
sql- the SQL to be parsedindex- the position in the SQL where the column value parsing startscolumnIndex- the column index position in thecolumnValuesarray to populate- Returns:
- the index where the column value token ends
-
parseWhereClause
Parses the SQL where-clause- Parameters:
sql- the SQL to be parsedindex- the position in the SQL where the parsing startstable- the expected relational table being parsed- Returns:
- the index where the where-clause parsing ends
-
createDmlEntryForColumnValues
Creates theLogMinerDmlEntryfor the column values.- Parameters:
columnValues- the column values array- Returns:
- the DML entry that represents the parsed statement
-
startsWithAtIndex
Checks that the specifiedvaluestarts with the given valuestartsWithValueat the given index.- Parameters:
startsWithValue- the value to match againstindex- the position to start the matchingvalue- the value to search within for the match- Returns:
- true if the match was found, false otherwise
-
startsWithAtIndexThrow
Checks that the specifiedvaluestarts with the given valuestartsWithValueat the given index.- Parameters:
startsWith- the value to match againstindex- the position to start the matchingvalue- the value to search within for the match- Returns:
- true if the match was found, false otherwise
- Throws:
IllegalStateException- if the match is not found
-
indexOfThrow
Performs anString.indexOf(int, int)on the givenvalue, throwing an exception if not found.- Parameters:
findValue- the text to find within the string valuevalue- the string value to operate onfromIndex- the index where the find starts- Returns:
- the index of the found string
- Throws:
IllegalStateException- if the indexOf operation returns -1
-