Package org.h2.bnf.context
Class DbContents
- java.lang.Object
-
- org.h2.bnf.context.DbContents
-
public class DbContents extends java.lang.ObjectKeeps meta data information about a database. This class is used by the H2 Console.
-
-
Field Summary
Fields Modifier and Type Field Description private booleandatabaseToLowerprivate booleandatabaseToUpperprivate DbSchemadefaultSchemaprivate booleanisDB2private booleanisDerbyprivate booleanisFirebirdprivate booleanisH2private booleanisMSSQLServerprivate booleanisMySQLprivate booleanisOracleprivate booleanisPostgreSQLprivate booleanisSQLiteprivate booleanmayHaveStandardViewsprivate DbSchema[]schemas
-
Constructor Summary
Constructors Constructor Description DbContents()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DbSchemagetDefaultSchema()private java.lang.StringgetDefaultSchemaName(java.sql.DatabaseMetaData meta)private java.lang.String[]getSchemaNames(java.sql.DatabaseMetaData meta)DbSchema[]getSchemas()booleanisDB2()booleanisDerby()booleanisFirebird()booleanisH2()booleanisMSSQLServer()booleanisMySQL()booleanisOracle()booleanisPostgreSQL()booleanisSQLite()booleanmayHaveStandardViews()Returns whether standard INFORMATION_SCHEMA.VIEWS may be supported.java.lang.StringquoteIdentifier(java.lang.String identifier)Add double quotes around an identifier if required.voidreadContents(java.lang.String url, java.sql.Connection conn)Read the contents of this database from the database meta data.voidsetMayHaveStandardViews(boolean mayHaveStandardViews)
-
-
-
Field Detail
-
schemas
private DbSchema[] schemas
-
defaultSchema
private DbSchema defaultSchema
-
isOracle
private boolean isOracle
-
isH2
private boolean isH2
-
isPostgreSQL
private boolean isPostgreSQL
-
isDerby
private boolean isDerby
-
isSQLite
private boolean isSQLite
-
isMySQL
private boolean isMySQL
-
isFirebird
private boolean isFirebird
-
isMSSQLServer
private boolean isMSSQLServer
-
isDB2
private boolean isDB2
-
databaseToUpper
private boolean databaseToUpper
-
databaseToLower
private boolean databaseToLower
-
mayHaveStandardViews
private boolean mayHaveStandardViews
-
-
Method Detail
-
getDefaultSchema
public DbSchema getDefaultSchema()
- Returns:
- the default schema.
-
isDerby
public boolean isDerby()
- Returns:
- true if this is an Apache Derby database.
-
isFirebird
public boolean isFirebird()
- Returns:
- true if this is a Firebird database.
-
isH2
public boolean isH2()
- Returns:
- true if this is a H2 database.
-
isMSSQLServer
public boolean isMSSQLServer()
- Returns:
- true if this is a MS SQL Server database.
-
isMySQL
public boolean isMySQL()
- Returns:
- true if this is a MySQL database.
-
isOracle
public boolean isOracle()
- Returns:
- true if this is an Oracle database.
-
isPostgreSQL
public boolean isPostgreSQL()
- Returns:
- true if this is a PostgreSQL database.
-
isSQLite
public boolean isSQLite()
- Returns:
- true if this is an SQLite database.
-
isDB2
public boolean isDB2()
- Returns:
- true if this is an IBM DB2 database.
-
getSchemas
public DbSchema[] getSchemas()
- Returns:
- the list of schemas.
-
mayHaveStandardViews
public boolean mayHaveStandardViews()
Returns whether standard INFORMATION_SCHEMA.VIEWS may be supported.- Returns:
- whether standard INFORMATION_SCHEMA.VIEWS may be supported
-
setMayHaveStandardViews
public void setMayHaveStandardViews(boolean mayHaveStandardViews)
- Parameters:
mayHaveStandardViews- whether standard INFORMATION_SCHEMA.VIEWS is detected as supported
-
readContents
public void readContents(java.lang.String url, java.sql.Connection conn) throws java.sql.SQLExceptionRead the contents of this database from the database meta data.- Parameters:
url- the database URLconn- the connection- Throws:
java.sql.SQLException- on failure
-
getSchemaNames
private java.lang.String[] getSchemaNames(java.sql.DatabaseMetaData meta) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getDefaultSchemaName
private java.lang.String getDefaultSchemaName(java.sql.DatabaseMetaData meta)
-
quoteIdentifier
public java.lang.String quoteIdentifier(java.lang.String identifier)
Add double quotes around an identifier if required.- Parameters:
identifier- the identifier- Returns:
- the quoted identifier
-
-