public interface Schema extends Named
Standard SQL object identifiers come in 3 parts:
[catalog].[schema].[object]
. The schema is an object that groups
a set of objects, where objects can be Table
, Sequence
,
Routine
and many other types of objects.
If your RDBMS supports schemas, and jOOQ supports using schemas with your RDBMS, then generated schemas references can be used to qualify objects
Example:
// Assuming import static org.jooq.impl.DSL.*;
using(configuration)
.select(SCHEMA.ACTOR.FIRST_NAME, SCHEMA.ACTOR.LAST_NAME)
.from(SCHEMA.ACTOR)
.fetch();
Compatibility:
Database products like SQLDialect.MYSQL
and related dialects, such as
SQLDialect.MARIADB
use catalogs ("databases") instead of schemas, and
lack schema support. For historic reasons, jOOQ treats MySQL catalogs as
schemas and does not support any catalog qualifier in MySQL.
Instances can be created using DSL.schema(Name)
and overloads.
Modifier and Type | Method and Description |
---|---|
Catalog |
getCatalog()
The catalog of this schema.
|
Sequence<?> |
getSequence(String name)
Get a sequence by its name (case-sensitive) in this schema, or
null if no such sequence exists. |
List<Sequence<?>> |
getSequences()
List all sequences contained in this schema.
|
Table<?> |
getTable(String name)
Get a table by its name (case-sensitive) in this schema, or
null if no such table exists. |
List<Table<?>> |
getTables()
List all tables contained in this schema.
|
UDT<?> |
getUDT(String name)
Get a UDT by its name (case-sensitive) in this schema, or
null if no such UDT exists. |
List<UDT<?>> |
getUDTs()
List all UDTs contained in this schema.
|
Stream<Sequence<?>> |
sequenceStream()
Stream all sequences contained in this schema.
|
Stream<Table<?>> |
tableStream()
Stream all tables contained in this schema.
|
Stream<UDT<?>> |
udtStream()
Stream all UDTs contained in this schema.
|
getComment, getName, getQualifiedName, getUnqualifiedName
Catalog getCatalog()
Table<?> getTable(String name)
null
if no such table exists.UDT<?> getUDT(String name)
null
if no such UDT exists.Copyright © 2020. All rights reserved.