org.h2.bnf.context
Class DbContents

java.lang.Object
  extended by org.h2.bnf.context.DbContents

public class DbContents
extends java.lang.Object

Keeps meta data information about a database. This class is used by the H2 Console.


Constructor Summary
DbContents()
           
 
Method Summary
static int findColumn(java.sql.ResultSet rs, java.lang.String columnName, int defaultColumnIndex)
          Get the column index of a column in a result set.
 DbSchema getDefaultSchema()
           
 DbSchema[] getSchemas()
           
 boolean isDerby()
           
 boolean isFirebird()
           
 boolean isH2()
           
 boolean isH2ModeMySQL()
           
 boolean isMSSQLServer()
           
 boolean isMySQL()
           
 boolean isOracle()
           
 boolean isPostgreSQL()
           
 boolean isSQLite()
           
 java.lang.String quoteIdentifier(java.lang.String identifier)
          Add double quotes around an identifier if required.
 void readContents(java.sql.DatabaseMetaData meta)
          Read the contents of this database from the database meta data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbContents

public DbContents()
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.

isH2ModeMySQL

public boolean isH2ModeMySQL()
Returns:
True if this is a H2 database in MySQL mode.

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.

getSchemas

public DbSchema[] getSchemas()
Returns:
The list of schemas.

findColumn

public static int findColumn(java.sql.ResultSet rs,
                             java.lang.String columnName,
                             int defaultColumnIndex)
Get the column index of a column in a result set. If the column is not found, the default column index is returned. This is a workaround for a JDBC-ODBC bridge problem.

Parameters:
rs - the result set
columnName - the column name
defaultColumnIndex - the default column index
Returns:
the column index

readContents

public void readContents(java.sql.DatabaseMetaData meta)
                  throws java.sql.SQLException
Read the contents of this database from the database meta data.

Parameters:
meta - the database meta data
Throws:
java.sql.SQLException

quoteIdentifier

public java.lang.String quoteIdentifier(java.lang.String identifier)
Add double quotes around an identifier if required. For the H2 database, all identifiers are quoted.

Parameters:
identifier - the identifier
Returns:
the quoted identifier