Class DatabaseSchemaLayout

java.lang.Object
com.invirgance.convirgance.jdbc.schema.DatabaseSchemaLayout

public class DatabaseSchemaLayout extends Object
For working with Database Object metadata for a given AutomaticDriver and DataSource. Each database has their own way of interacting with views, tables and catalogs. This serves as a way to create standardized reusable logic. DatabaseSchemaLayout supports operations such as: - Retrieving catalogs, schemas, tables, and views - Getting the current catalog and schema - Accessing column information for tabular structures - Handling database-specific naming and quoting conventions
Author:
jbanes
  • Constructor Details

    • DatabaseSchemaLayout

      public DatabaseSchemaLayout(AutomaticDriver driver, DataSource source)
      Creates a new DataBaseSchemaLayout using the drivers configuration.
      Parameters:
      driver - The driver.
      source - The data source.
  • Method Details

    • getDriver

      public AutomaticDriver getDriver()
      Returns the driver whose configuration was used to create this.
      Returns:
      The driver.
    • getDataSource

      public DataSource getDataSource()
      Returns the data source used to create this.
      Returns:
      The data source.
    • getAllStructures

      public TabularStructure[] getAllStructures()
      Returns an array containing all views, tables and other structures.
      Returns:
      An array of TabularStructures.
    • getAllStructures

      public TabularStructure[] getAllStructures(String type)
      Returns an array containing structures matching the provided table type. Ex: for MySQL this could be "SYSTEM VIEW"
      Parameters:
      type - A string representing a type.
      Returns:
      An array.
    • getCurrentCatalog

      public Catalog getCurrentCatalog()
      Gets the databases most recent table catalog.
      Returns:
      A Catalog.
    • getCurrentSchema

      public Schema getCurrentSchema()
      Returns the current Schema of the source.
      Returns:
      A Schema.
    • getCatalogs

      public Catalog[] getCatalogs()
      Returns all catalogs.
      Returns:
      Array of Catalogs
    • getCatalog

      public Catalog getCatalog(String name)
      Gets the catalog with the specified name (case-insensitive)
      Parameters:
      name - Catalog name.
      Returns:
      The specified catalog.
    • getAllTables

      public Table[] getAllTables()
      Returns all the tables found matching the current drivers table type.
      Returns:
      An array of tables.
    • getAllViews

      public View[] getAllViews()
      Returns all the views found matching the current drivers view type.
      Returns:
      An array of views.
    • getTypes

      public String[] getTypes()
      Returns the table types included in the schema layout. Ex: for MySQL this could be "BASE TABLE", "VIEW", "SYSTEM VIEW"
      Returns:
      A String array of table types.