net.sourceforge.schemaspy.model
Class Database

java.lang.Object
  extended by net.sourceforge.schemaspy.model.Database

public class Database
extends Object


Constructor Summary
Database(Connection connection, DatabaseMetaData meta, String name, String schema, String description, Properties properties, Pattern include, int maxThreads)
           
 
Method Summary
 Connection getConnection()
           
 String getConnectTime()
           
 String getDatabaseProduct()
           
 String getDescription()
           
 DatabaseMetaData getMetaData()
           
 String getName()
           
 String getOptionalString(ResultSet rs, String columnName)
          Some databases don't play nice with their metadata.
 String getQuotedIdentifier(String id)
           
 String getSchema()
           
 Set getSqlKeywords()
          Return an uppercased Set of all SQL keywords used by a database
 Collection getTables()
           
 Collection getViews()
           
 PreparedStatement prepareStatement(String sql, String tableName)
          Create a PreparedStatement from the specified SQL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Database

public Database(Connection connection,
                DatabaseMetaData meta,
                String name,
                String schema,
                String description,
                Properties properties,
                Pattern include,
                int maxThreads)
         throws SQLException,
                MissingResourceException
Throws:
SQLException
MissingResourceException
Method Detail

getName

public String getName()

getSchema

public String getSchema()

getDescription

public String getDescription()
Returns:
null if a description wasn't specified.

getTables

public Collection getTables()

getViews

public Collection getViews()

getConnection

public Connection getConnection()

getMetaData

public DatabaseMetaData getMetaData()

getConnectTime

public String getConnectTime()

getDatabaseProduct

public String getDatabaseProduct()

getOptionalString

public String getOptionalString(ResultSet rs,
                                String columnName)
Some databases don't play nice with their metadata. E.g. Oracle doesn't have a REMARKS column at all. This method ignores those types of failures, replacing them with null.


prepareStatement

public PreparedStatement prepareStatement(String sql,
                                          String tableName)
                                   throws SQLException
Create a PreparedStatement from the specified SQL. The SQL can contain these named parameters (but not question marks).
  1. :schema - replaced with the name of the schema
  2. :owner - alias for :schema
  3. :table - replaced with the name of the table

Parameters:
sql - String - SQL without question marks
tableName - String - null if the statement doesn't deal with Table-level details.
Returns:
PreparedStatement
Throws:
SQLException

getSqlKeywords

public Set getSqlKeywords()
                   throws SQLException
Return an uppercased Set of all SQL keywords used by a database

Returns:
Throws:
SQLException

getQuotedIdentifier

public String getQuotedIdentifier(String id)
                           throws SQLException
Throws:
SQLException


Copyright © 2007-2010. All Rights Reserved.