Skip to content

Commit

Permalink
feat: add syntax sugar for accessing name parts easier
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Reichel <[email protected]>
Signed-off-by: manticore-projects <[email protected]>
  • Loading branch information
manticore-projects committed Sep 2, 2024
1 parent d3d3af9 commit 25b08b1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/net/sf/jsqlparser/schema/Column.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,30 @@ public Table getTable() {
return table;
}

public String getTableName() {
return table != null ? table.getName() : null;
}

public String getUnquotedTableName() {
return table != null ? table.getUnquotedName() : null;
}

public String getSchemaName() {
return table != null ? table.getSchemaName() : null;
}

public String getUnquotedSchemaName() {
return table != null ? table.getUnquotedSchemaName() : null;
}

public String getCatalogName() {
return table != null ? table.getCatalogName() : null;
}

public String getUnquotedCatalogName() {
return table != null ? table.getUnquotedCatalogName() : null;
}

public void setTable(Table table) {
this.table = table;
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/sf/jsqlparser/schema/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ public String getDatabaseName() {
return getIndex(DATABASE_IDX);
}

public String getUnquotedCatalogName() {
return MultiPartName.unquote(getDatabaseName());
}

public String getUnquotedDatabaseName() {
return MultiPartName.unquote(getDatabaseName());
}
Expand Down

0 comments on commit 25b08b1

Please sign in to comment.