Class InsertStatementParser
java.lang.Object
com.databricks.jdbc.common.util.InsertStatementParser
Utility class for parsing INSERT statements to extract table and column information. Supports
detecting compatible INSERT statements that can be combined into multi-row batches.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents the parsed components of an INSERT statement. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateMultiRowInsert(InsertStatementParser.InsertInfo insertInfo, int numberOfRows) Generates a multi-row INSERT statement from the template and number of rows.static booleanChecks if the given SQL statement is a parametrized INSERT statement suitable for batching.parseInsert(String sql) Parses an INSERT statement to extract table and column information.parseInsertStrict(String sql) Parses an INSERT statement to extract table and column information with strict error handling.
-
Constructor Details
-
InsertStatementParser
public InsertStatementParser()
-
-
Method Details
-
parseInsert
Parses an INSERT statement to extract table and column information.- Parameters:
sql- the INSERT SQL statement to parse- Returns:
- InsertInfo object containing parsed information, or null if not a valid INSERT
-
parseInsertStrict
public static InsertStatementParser.InsertInfo parseInsertStrict(String sql) throws DatabricksParsingException Parses an INSERT statement to extract table and column information with strict error handling.- Parameters:
sql- the INSERT SQL statement to parse- Returns:
- InsertInfo object containing parsed information
- Throws:
DatabricksParsingException- if the SQL is not a properly formatted INSERT statement
-
isParametrizedInsert
Checks if the given SQL statement is a parametrized INSERT statement suitable for batching.- Parameters:
sql- the SQL statement to check- Returns:
- true if it's a parametrized INSERT that can be batched, false otherwise
-
generateMultiRowInsert
public static String generateMultiRowInsert(InsertStatementParser.InsertInfo insertInfo, int numberOfRows) throws DatabricksParsingException Generates a multi-row INSERT statement from the template and number of rows.- Parameters:
insertInfo- the parsed INSERT informationnumberOfRows- the number of rows to include in the batch- Returns:
- the multi-row INSERT SQL statement
- Throws:
DatabricksParsingException- if insertInfo is null or numberOfRows is invalid
-