Package org.apache.gravitino.utils.jdbc
Class JdbcSqlScriptUtils
java.lang.Object
org.apache.gravitino.utils.jdbc.JdbcSqlScriptUtils
Utility methods for parsing and executing SQL scripts.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidexecuteSqlScript(Connection connection, String sqlContent) Executes all SQL statements parsed from the script content.splitStatements(String sqlContent) Splits SQL script content into executable statements.
-
Method Details
-
splitStatements
Splits SQL script content into executable statements.Lines starting with
--are treated as comments and removed before splitting.- Parameters:
sqlContent- SQL script content- Returns:
- executable SQL statements in order
-
executeSqlScript
Executes all SQL statements parsed from the script content.- Parameters:
connection- JDBC connection used to execute statementssqlContent- SQL script content- Throws:
SQLException- if statement execution fails
-