org.jooq.util
Class AbstractDatabase

java.lang.Object
  extended by org.jooq.util.AbstractDatabase
All Implemented Interfaces:
Database
Direct Known Subclasses:
ASEDatabase, CUBRIDDatabase, DB2Database, DerbyDatabase, H2Database, HSQLDBDatabase, IngresDatabase, MySQLDatabase, OracleDatabase, PostgresDatabase, SQLiteDatabase, SQLServerDatabase, SybaseDatabase

public abstract class AbstractDatabase
extends Object
implements Database

A base implementation for all types of databases.

Author:
Lukas Eder

Constructor Summary
AbstractDatabase()
           
 
Method Summary
 boolean dateAsTimestamp()
          Whether DATE columns should be treated as TIMESTAMP columns
 ArrayDefinition getArray(SchemaDefinition schema, String name)
          Get a ARRAY defined in this database by name
 ArrayDefinition getArray(SchemaDefinition schema, String name, boolean ignoreCase)
          Get a ARRAY defined in this database by name
 List<ArrayDefinition> getArrays(SchemaDefinition schema)
          The Arrays defined in this database
protected abstract  List<ArrayDefinition> getArrays0()
          Retrieve ALL ARRAYs from the database.
 CustomType getConfiguredCustomType(String name)
          Get a specific configured custom type by its name
 List<CustomType> getConfiguredCustomTypes()
          Database objects matching any of these field names will be generated as custom types
 List<EnumType> getConfiguredEnumTypes()
          Database objects matching any of these field names will be generated as enum types
 ForcedType getConfiguredForcedType(Definition definition)
          Get the configured forced type object for any given Definition, or null if no ForcedType matches the definition.
 List<ForcedType> getConfiguredForcedTypes()
          Database objects matching any of these field names will be generated as forced types
 List<MasterDataTable> getConfiguredMasterDataTables()
          Database objects matching any of these table names will be generated as master data tables.
 Connection getConnection()
          The database connection
protected  DataTypeDefinition getDataTypeForMAX_VAL(SchemaDefinition schema, BigInteger value)
          Get the data type considering a known max value
 org.jooq.SQLDialect getDialect()
          Get the dialect for this database
 EnumDefinition getEnum(SchemaDefinition schema, String name)
          Get an enum UDT defined in this database by name
 EnumDefinition getEnum(SchemaDefinition schema, String name, boolean ignoreCase)
          Get an enum UDT defined in this database by name
 List<EnumDefinition> getEnums(SchemaDefinition schema)
          The enum UDTs defined in this database
protected abstract  List<EnumDefinition> getEnums0()
          Retrieve ALL enum UDTs from the database.
 String[] getExcludes()
          Database objects matching any of these regular expressions will not be generated.
 String[] getIncludes()
          Only database objects matching any of these regular expressions will be generated.
 List<String> getInputSchemata()
          The input schemata are the schemata that jooq-meta is reading data from
 MasterDataTableDefinition getMasterDataTable(SchemaDefinition schema, String name)
          Get a master data table in this database by name
 MasterDataTableDefinition getMasterDataTable(SchemaDefinition schema, String name, boolean ignoreCase)
          Get a master data table in this database by name
 List<MasterDataTableDefinition> getMasterDataTables(SchemaDefinition schema)
          The master data tables contained in this database (for schema Database.getSchema(String))
 String getOutputSchema(String inputSchema)
          Deprecated. 
 List<PackageDefinition> getPackages(SchemaDefinition schema)
          The packages contained in this database
protected abstract  List<PackageDefinition> getPackages0()
          Retrieve ALL packages from the database.
 Relations getRelations()
          Retrieve the schema's primary key / foreign key relations
protected  Relations getRelations0()
          Retrieve ALL relations from the database.
 List<RoutineDefinition> getRoutines(SchemaDefinition schema)
          The stored routines (procedures and functions) contained in this database
protected abstract  List<RoutineDefinition> getRoutines0()
          Retrieve ALL stored routines (functions and procedures) from the database.
 SchemaDefinition getSchema(String inputName)
          Get a schema defined in this database by name
 List<SchemaDefinition> getSchemata()
          The schemata generated from this database
 List<SequenceDefinition> getSequences(SchemaDefinition schema)
          The sequences contained in this database
protected abstract  List<SequenceDefinition> getSequences0()
          Retrieve ALL sequences from the database.
 TableDefinition getTable(SchemaDefinition schema, String name)
          Get a table in this database by name
 TableDefinition getTable(SchemaDefinition schema, String name, boolean ignoreCase)
          Get a table in this database by name
 List<TableDefinition> getTables(SchemaDefinition schema)
          The tables contained in this database
protected abstract  List<TableDefinition> getTables0()
          Retrieve ALL tables from the database.
 UDTDefinition getUDT(SchemaDefinition schema, String name)
          Get a UDT defined in this database by name
 UDTDefinition getUDT(SchemaDefinition schema, String name, boolean ignoreCase)
          Get a UDT defined in this database by name
 List<UDTDefinition> getUDTs(SchemaDefinition schema)
          The UDTs defined in this database
protected abstract  List<UDTDefinition> getUDTs0()
          Retrieve ALL UDTs from the database.
 boolean isArrayType(String dataType)
          Check whether a type is an array type
protected abstract  void loadForeignKeys(DefaultRelations r)
          Retrieve foreign keys and store them to relations.
protected abstract  void loadPrimaryKeys(DefaultRelations r)
          Retrieve primary keys and store them to relations
protected abstract  void loadUniqueKeys(DefaultRelations r)
          Retrieve non-primary unique keys and store them to relations
 void setConfiguredCustomTypes(List<CustomType> configuredCustomTypes)
          Database objects matching any of these field names will be generated as custom types
 void setConfiguredEnumTypes(List<EnumType> configuredEnumTypes)
          Database objects matching any of these field names will be generated as enum types
 void setConfiguredForcedTypes(List<ForcedType> configuredForcedTypes)
          Database objects matching any of these field names will be generated as forced types
 void setConfiguredMasterDataTables(List<MasterDataTable> configuredMasterDataTables)
          Database objects matching any of these table names will be generated as master data tables.
 void setConfiguredSchemata(List<Schema> schemata)
          The input and output schemata
 void setConnection(Connection connection)
          Initialise a connection to this database
 void setDateAsTimestamp(boolean dateAsTimestamp)
          Whether DATE columns should be treated as TIMESTAMP columns
 void setExcludes(String[] excludes)
          Database objects matching any of these regular expressions will not be generated.
 void setIncludes(String[] includes)
          Only database objects matching any of these regular expressions will be generated.
 void setSupportsUnsignedTypes(boolean supportsUnsignedTypes)
          Whether this database supports unsigned types
 boolean supportsUnsignedTypes()
          Whether this database supports unsigned types
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jooq.util.Database
create
 

Constructor Detail

AbstractDatabase

public AbstractDatabase()
Method Detail

getDialect

public final org.jooq.SQLDialect getDialect()
Description copied from interface: Database
Get the dialect for this database

Specified by:
getDialect in interface Database

setConnection

public final void setConnection(Connection connection)
Description copied from interface: Database
Initialise a connection to this database

Specified by:
setConnection in interface Database

getConnection

public final Connection getConnection()
Description copied from interface: Database
The database connection

Specified by:
getConnection in interface Database

getSchemata

public final List<SchemaDefinition> getSchemata()
Description copied from interface: Database
The schemata generated from this database

Specified by:
getSchemata in interface Database

getSchema

public final SchemaDefinition getSchema(String inputName)
Description copied from interface: Database
Get a schema defined in this database by name

Specified by:
getSchema in interface Database

getInputSchemata

public final List<String> getInputSchemata()
Description copied from interface: Database
The input schemata are the schemata that jooq-meta is reading data from

Specified by:
getInputSchemata in interface Database

getOutputSchema

@Deprecated
public String getOutputSchema(String inputSchema)
Deprecated. 

Description copied from interface: Database
The output schema is the schema used by jooq-codegen in class names

Specified by:
getOutputSchema in interface Database

setConfiguredSchemata

public final void setConfiguredSchemata(List<Schema> schemata)
Description copied from interface: Database
The input and output schemata

Specified by:
setConfiguredSchemata in interface Database

setExcludes

public final void setExcludes(String[] excludes)
Description copied from interface: Database
Database objects matching any of these regular expressions will not be generated.

Specified by:
setExcludes in interface Database

getExcludes

public final String[] getExcludes()
Description copied from interface: Database
Database objects matching any of these regular expressions will not be generated.

Specified by:
getExcludes in interface Database

setIncludes

public final void setIncludes(String[] includes)
Description copied from interface: Database
Only database objects matching any of these regular expressions will be generated.

Specified by:
setIncludes in interface Database

getIncludes

public final String[] getIncludes()
Description copied from interface: Database
Only database objects matching any of these regular expressions will be generated.

Specified by:
getIncludes in interface Database

setConfiguredMasterDataTables

public final void setConfiguredMasterDataTables(List<MasterDataTable> configuredMasterDataTables)
Description copied from interface: Database
Database objects matching any of these table names will be generated as master data tables.

Specified by:
setConfiguredMasterDataTables in interface Database

getConfiguredMasterDataTables

public final List<MasterDataTable> getConfiguredMasterDataTables()
Description copied from interface: Database
Database objects matching any of these table names will be generated as master data tables.

Specified by:
getConfiguredMasterDataTables in interface Database

setConfiguredEnumTypes

public final void setConfiguredEnumTypes(List<EnumType> configuredEnumTypes)
Description copied from interface: Database
Database objects matching any of these field names will be generated as enum types

Specified by:
setConfiguredEnumTypes in interface Database

getConfiguredEnumTypes

public final List<EnumType> getConfiguredEnumTypes()
Description copied from interface: Database
Database objects matching any of these field names will be generated as enum types

Specified by:
getConfiguredEnumTypes in interface Database

setConfiguredCustomTypes

public final void setConfiguredCustomTypes(List<CustomType> configuredCustomTypes)
Description copied from interface: Database
Database objects matching any of these field names will be generated as custom types

Specified by:
setConfiguredCustomTypes in interface Database

getConfiguredCustomTypes

public final List<CustomType> getConfiguredCustomTypes()
Description copied from interface: Database
Database objects matching any of these field names will be generated as custom types

Specified by:
getConfiguredCustomTypes in interface Database

getConfiguredCustomType

public final CustomType getConfiguredCustomType(String name)
Description copied from interface: Database
Get a specific configured custom type by its name

Specified by:
getConfiguredCustomType in interface Database

setConfiguredForcedTypes

public final void setConfiguredForcedTypes(List<ForcedType> configuredForcedTypes)
Description copied from interface: Database
Database objects matching any of these field names will be generated as forced types

Specified by:
setConfiguredForcedTypes in interface Database

getConfiguredForcedTypes

public final List<ForcedType> getConfiguredForcedTypes()
Description copied from interface: Database
Database objects matching any of these field names will be generated as forced types

Specified by:
getConfiguredForcedTypes in interface Database

setSupportsUnsignedTypes

public final void setSupportsUnsignedTypes(boolean supportsUnsignedTypes)
Description copied from interface: Database
Whether this database supports unsigned types

Specified by:
setSupportsUnsignedTypes in interface Database

supportsUnsignedTypes

public final boolean supportsUnsignedTypes()
Description copied from interface: Database
Whether this database supports unsigned types

Specified by:
supportsUnsignedTypes in interface Database

setDateAsTimestamp

public final void setDateAsTimestamp(boolean dateAsTimestamp)
Description copied from interface: Database
Whether DATE columns should be treated as TIMESTAMP columns

Specified by:
setDateAsTimestamp in interface Database

dateAsTimestamp

public final boolean dateAsTimestamp()
Description copied from interface: Database
Whether DATE columns should be treated as TIMESTAMP columns

Specified by:
dateAsTimestamp in interface Database

getSequences

public final List<SequenceDefinition> getSequences(SchemaDefinition schema)
Description copied from interface: Database
The sequences contained in this database

Specified by:
getSequences in interface Database

getTables

public final List<TableDefinition> getTables(SchemaDefinition schema)
Description copied from interface: Database
The tables contained in this database

Specified by:
getTables in interface Database

getTable

public final TableDefinition getTable(SchemaDefinition schema,
                                      String name)
Description copied from interface: Database
Get a table in this database by name

Specified by:
getTable in interface Database

getTable

public final TableDefinition getTable(SchemaDefinition schema,
                                      String name,
                                      boolean ignoreCase)
Description copied from interface: Database
Get a table in this database by name

Specified by:
getTable in interface Database

getMasterDataTables

public final List<MasterDataTableDefinition> getMasterDataTables(SchemaDefinition schema)
Description copied from interface: Database
The master data tables contained in this database (for schema Database.getSchema(String))

Specified by:
getMasterDataTables in interface Database

getMasterDataTable

public final MasterDataTableDefinition getMasterDataTable(SchemaDefinition schema,
                                                          String name)
Description copied from interface: Database
Get a master data table in this database by name

Specified by:
getMasterDataTable in interface Database

getMasterDataTable

public final MasterDataTableDefinition getMasterDataTable(SchemaDefinition schema,
                                                          String name,
                                                          boolean ignoreCase)
Description copied from interface: Database
Get a master data table in this database by name

Specified by:
getMasterDataTable in interface Database

getEnums

public final List<EnumDefinition> getEnums(SchemaDefinition schema)
Description copied from interface: Database
The enum UDTs defined in this database

Specified by:
getEnums in interface Database

getConfiguredForcedType

public final ForcedType getConfiguredForcedType(Definition definition)
Description copied from interface: Database
Get the configured forced type object for any given Definition, or null if no ForcedType matches the definition.

Specified by:
getConfiguredForcedType in interface Database

getEnum

public final EnumDefinition getEnum(SchemaDefinition schema,
                                    String name)
Description copied from interface: Database
Get an enum UDT defined in this database by name

Specified by:
getEnum in interface Database

getEnum

public final EnumDefinition getEnum(SchemaDefinition schema,
                                    String name,
                                    boolean ignoreCase)
Description copied from interface: Database
Get an enum UDT defined in this database by name

Specified by:
getEnum in interface Database

getArrays

public final List<ArrayDefinition> getArrays(SchemaDefinition schema)
Description copied from interface: Database
The Arrays defined in this database

Specified by:
getArrays in interface Database

getArray

public final ArrayDefinition getArray(SchemaDefinition schema,
                                      String name)
Description copied from interface: Database
Get a ARRAY defined in this database by name

Specified by:
getArray in interface Database

getArray

public final ArrayDefinition getArray(SchemaDefinition schema,
                                      String name,
                                      boolean ignoreCase)
Description copied from interface: Database
Get a ARRAY defined in this database by name

Specified by:
getArray in interface Database

getUDTs

public final List<UDTDefinition> getUDTs(SchemaDefinition schema)
Description copied from interface: Database
The UDTs defined in this database

Specified by:
getUDTs in interface Database

getUDT

public final UDTDefinition getUDT(SchemaDefinition schema,
                                  String name)
Description copied from interface: Database
Get a UDT defined in this database by name

Specified by:
getUDT in interface Database

getUDT

public final UDTDefinition getUDT(SchemaDefinition schema,
                                  String name,
                                  boolean ignoreCase)
Description copied from interface: Database
Get a UDT defined in this database by name

Specified by:
getUDT in interface Database

getRelations

public final Relations getRelations()
Description copied from interface: Database
Retrieve the schema's primary key / foreign key relations

Specified by:
getRelations in interface Database

getRoutines

public final List<RoutineDefinition> getRoutines(SchemaDefinition schema)
Description copied from interface: Database
The stored routines (procedures and functions) contained in this database

Specified by:
getRoutines in interface Database

getPackages

public final List<PackageDefinition> getPackages(SchemaDefinition schema)
Description copied from interface: Database
The packages contained in this database

Specified by:
getPackages in interface Database

getRelations0

protected final Relations getRelations0()
                                 throws SQLException
Retrieve ALL relations from the database.

Throws:
SQLException

isArrayType

public final boolean isArrayType(String dataType)
Description copied from interface: Database
Check whether a type is an array type

Specified by:
isArrayType in interface Database

loadPrimaryKeys

protected abstract void loadPrimaryKeys(DefaultRelations r)
                                 throws SQLException
Retrieve primary keys and store them to relations

Throws:
SQLException

loadUniqueKeys

protected abstract void loadUniqueKeys(DefaultRelations r)
                                throws SQLException
Retrieve non-primary unique keys and store them to relations

Throws:
SQLException

loadForeignKeys

protected abstract void loadForeignKeys(DefaultRelations r)
                                 throws SQLException
Retrieve foreign keys and store them to relations. Unique keys are already loaded.

Throws:
SQLException

getSequences0

protected abstract List<SequenceDefinition> getSequences0()
                                                   throws SQLException
Retrieve ALL sequences from the database. This will be filtered in getTables(SchemaDefinition)

Throws:
SQLException

getTables0

protected abstract List<TableDefinition> getTables0()
                                             throws SQLException
Retrieve ALL tables from the database. This will be filtered in getTables(SchemaDefinition)

Throws:
SQLException

getRoutines0

protected abstract List<RoutineDefinition> getRoutines0()
                                                 throws SQLException
Retrieve ALL stored routines (functions and procedures) from the database. This will be filtered in getRoutines(SchemaDefinition)

Throws:
SQLException

getPackages0

protected abstract List<PackageDefinition> getPackages0()
                                                 throws SQLException
Retrieve ALL packages from the database. This will be filtered in getPackages(SchemaDefinition)

Throws:
SQLException

getEnums0

protected abstract List<EnumDefinition> getEnums0()
                                           throws SQLException
Retrieve ALL enum UDTs from the database. This will be filtered in getEnums(SchemaDefinition)

Throws:
SQLException

getUDTs0

protected abstract List<UDTDefinition> getUDTs0()
                                         throws SQLException
Retrieve ALL UDTs from the database. This will be filtered in getEnums(SchemaDefinition)

Throws:
SQLException

getArrays0

protected abstract List<ArrayDefinition> getArrays0()
                                             throws SQLException
Retrieve ALL ARRAYs from the database. This will be filtered in getArrays(SchemaDefinition)

Throws:
SQLException

getDataTypeForMAX_VAL

protected final DataTypeDefinition getDataTypeForMAX_VAL(SchemaDefinition schema,
                                                         BigInteger value)
Get the data type considering a known max value



Copyright © 2012. All Rights Reserved.