Package ca.uhn.fhir.jpa.migrate.util
Class SqlUtil
java.lang.Object
ca.uhn.fhir.jpa.migrate.util.SqlUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Method Summary
Modifier and TypeMethodDescriptionparseAlterTableAddConstraintConstraintForeignKey(String theStatement) Accepts a DDL statement containingALTER TABLE [IF EXISTS]? table_name ADD CONSTRAINT constraint_name FOREIGN KEY (column_list)and returns the parsed details.parseCreateTableStatementPrimaryKey(String theStatement) Accepts a SQL statement and parses it as a SQLCREATE TABLEstatement, returning details about the table name and primary key.splitSqlFileIntoStatements(String theSql)
-
Method Details
-
splitSqlFileIntoStatements
-
parseCreateTableStatementPrimaryKey
@Nonnull public static Optional<SqlUtil.CreateTablePrimaryKey> parseCreateTableStatementPrimaryKey(String theStatement) Accepts a SQL statement and parses it as a SQLCREATE TABLEstatement, returning details about the table name and primary key. This method has only been tested for Postgresql DDL format!- Parameters:
theStatement- A single SQL statement- Returns:
- Returns details about the table name and PK columns if the SQL statement contains a valid CREATE TABLE statement, returns null otherwise.
-
parseAlterTableAddConstraintConstraintForeignKey
@Nonnull public static Optional<SqlUtil.AlterTableAddConstraint> parseAlterTableAddConstraintConstraintForeignKey(String theStatement) Accepts a DDL statement containingALTER TABLE [IF EXISTS]? table_name ADD CONSTRAINT constraint_name FOREIGN KEY (column_list)and returns the parsed details.
-