Class ModelMetaData

java.lang.Object
org.tentackle.sql.metadata.ModelMetaData

public class ModelMetaData extends Object
The whole metadata for the connected database.
Author:
harald
  • Constructor Details

    • ModelMetaData

      public ModelMetaData(Backend backend, DatabaseMetaData[] metaData, String[] schemas)
      Creates a database meta instance.
      Parameters:
      backend - the backend
      metaData - the connections metadata
      schemas - optional schemas, null if no schema check
  • Method Details

    • getAllTablesInDatabase

      public List<DatabaseMetaDataTableHeader> getAllTablesInDatabase() throws SQLException
      Gets the header info of all tables in the database.
      Returns:
      the table headers
      Throws:
      SQLException - if cannot retrieve meta data from database
    • getTableInDatabase

      public List<DatabaseMetaDataTableHeader> getTableInDatabase(String tableName) throws SQLException
      Gets the header infos for given tablename.
      May return more than one entry if the same tablename is used in more than one schema.
      Parameters:
      tableName - the tablename
      Returns:
      the non-empty list of header infos, null if no such table in database
      Throws:
      SQLException - if cannot retrieve meta data from database
    • addTableMetaData

      public boolean addTableMetaData(TableMetaData tableMetaData)
      Adds a table to this model.
      If schemas are set, only tables belonging to one of given schemas will be appended.
      Parameters:
      tableMetaData - the table
      Returns:
      true if added, false if wrong schema
    • getTables

      public Collection<TableMetaData> getTables()
      Gets the tables of this model.
      Returns:
      the tables
    • getBackend

      public Backend getBackend()
      Gets the backend.
      Returns:
      the backend
    • getSchemas

      public String[] getSchemas()
      Gets the valid schemas.
      Returns:
      the optional schemas, null if no schema check
    • getMetaData

      public DatabaseMetaData[] getMetaData()
      Gets the JDBC-connection's metadata.
      May be more than one if different schemas and schema-option was given in BackendInfo.
      Returns:
      the meta data
    • toString

      public String toString()
      Overrides:
      toString in class Object