[#5467] Add Sequence.getCatalog() and Table.getCatalog() for convenience
This commit is contained in:
parent
cbb671994f
commit
c8d04634bb
@ -120,6 +120,11 @@ package org.jooq;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -207,6 +207,22 @@ public interface DSLContext extends Scope , AutoCloseable {
|
||||
*/
|
||||
Meta meta(InformationSchema schema);
|
||||
|
||||
/**
|
||||
* Export a catalog to the {@link InformationSchema} format.
|
||||
* <p>
|
||||
* This allows for serialising schema meta information as XML using JAXB.
|
||||
* See also {@link Constants#XSD_META} for details.
|
||||
*/
|
||||
InformationSchema informationSchema(Catalog catalog);
|
||||
|
||||
/**
|
||||
* Export a schema to the {@link InformationSchema} format.
|
||||
* <p>
|
||||
* This allows for serialising schema meta information as XML using JAXB.
|
||||
* See also {@link Constants#XSD_META} for details.
|
||||
*/
|
||||
InformationSchema informationSchema(Schema schema);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX APIs for creating scope for transactions, mocking, batching, etc.
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -64,6 +64,12 @@ public interface EnumType {
|
||||
*/
|
||||
String getLiteral();
|
||||
|
||||
/**
|
||||
* The catalog of the enum type, if applicable. Otherwise, this returns
|
||||
* <code>null</code>
|
||||
*/
|
||||
Catalog getCatalog();
|
||||
|
||||
/**
|
||||
* The schema of the enum type, if applicable (Postgres schema-scope enum
|
||||
* type only). Otherwise, this returns <code>null</code>
|
||||
|
||||
@ -49,6 +49,11 @@ package org.jooq;
|
||||
*/
|
||||
public interface Package extends QueryPart {
|
||||
|
||||
/**
|
||||
* Get the package catalog.
|
||||
*/
|
||||
Catalog getCatalog();
|
||||
|
||||
/**
|
||||
* Get the package schema
|
||||
*/
|
||||
|
||||
@ -93,6 +93,11 @@ public interface Routine<T> extends QueryPart {
|
||||
// XXX: Meta information
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get the routine catalog.
|
||||
*/
|
||||
Catalog getCatalog();
|
||||
|
||||
/**
|
||||
* Get the routine schema
|
||||
*/
|
||||
|
||||
@ -66,6 +66,11 @@ public interface Sequence<T extends Number> extends QueryPart {
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Get the sequence catalog.
|
||||
*/
|
||||
Catalog getCatalog();
|
||||
|
||||
/**
|
||||
* Get the sequence schema
|
||||
*/
|
||||
|
||||
@ -79,6 +79,11 @@ import org.jooq.impl.DSL;
|
||||
*/
|
||||
public interface Table<R extends Record> extends TableLike<R> {
|
||||
|
||||
/**
|
||||
* Get the table catalog.
|
||||
*/
|
||||
Catalog getCatalog();
|
||||
|
||||
/**
|
||||
* Get the table schema.
|
||||
*/
|
||||
|
||||
@ -125,6 +125,11 @@ public interface UDT<R extends UDTRecord<R>> extends QueryPart {
|
||||
*/
|
||||
Field<?>[] fields(int... fieldIndexes);
|
||||
|
||||
/**
|
||||
* Get the UDT catalog.
|
||||
*/
|
||||
Catalog getCatalog();
|
||||
|
||||
/**
|
||||
* Get the UDT schema
|
||||
*/
|
||||
|
||||
@ -75,6 +75,7 @@ import org.jooq.AggregateFunction;
|
||||
import org.jooq.AttachableInternal;
|
||||
import org.jooq.BindContext;
|
||||
import org.jooq.Binding;
|
||||
import org.jooq.Catalog;
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Context;
|
||||
@ -854,6 +855,11 @@ public abstract class AbstractRoutine<T> extends AbstractQueryPart implements Ro
|
||||
return Collections.unmodifiableList(allParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Catalog getCatalog() {
|
||||
return getSchema() == null ? null : getSchema().getCatalog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Schema getSchema() {
|
||||
return schema;
|
||||
|
||||
@ -66,6 +66,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.jooq.Binding;
|
||||
import org.jooq.Catalog;
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Comparator;
|
||||
import org.jooq.Condition;
|
||||
@ -269,6 +270,11 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
|
||||
// XXX: Table API
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final Catalog getCatalog() {
|
||||
return getSchema() == null ? null : getSchema().getCatalog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public /* non-final */ Schema getSchema() {
|
||||
return tableschema;
|
||||
|
||||
@ -394,6 +394,12 @@ package org.jooq.impl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -378,6 +378,20 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
return new InformationSchemaMetaImpl(configuration(), schema);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InformationSchema informationSchema(Catalog catalog) {
|
||||
return informationSchema0(catalog.getSchemas());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InformationSchema informationSchema(Schema schema) {
|
||||
return informationSchema0(Arrays.asList(schema));
|
||||
}
|
||||
|
||||
private final InformationSchema informationSchema0(List<Schema> schemas) {
|
||||
return InformationSchemaExport.export(schemas);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX APIs for creating scope for transactions, mocking, batching, etc.
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import org.jooq.Catalog;
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Package;
|
||||
@ -72,6 +73,11 @@ public class PackageImpl extends AbstractQueryPart implements Package {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Catalog getCatalog() {
|
||||
return getSchema() == null ? null : getSchema().getCatalog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Schema getSchema() {
|
||||
return schema;
|
||||
|
||||
@ -49,6 +49,7 @@ import static org.jooq.impl.DSL.field;
|
||||
import static org.jooq.impl.DSL.inline;
|
||||
import static org.jooq.impl.DSL.select;
|
||||
|
||||
import org.jooq.Catalog;
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Context;
|
||||
@ -96,6 +97,11 @@ public class SequenceImpl<T extends Number> extends AbstractQueryPart implements
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Catalog getCatalog() {
|
||||
return getSchema() == null ? null : getSchema().getCatalog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Schema getSchema() {
|
||||
return schema;
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
package org.jooq.impl;
|
||||
|
||||
import org.jooq.Binding;
|
||||
import org.jooq.Catalog;
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Converter;
|
||||
@ -76,6 +77,11 @@ public class UDTImpl<R extends UDTRecord<R>> extends AbstractQueryPart implement
|
||||
this.schema = schema;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Catalog getCatalog() {
|
||||
return getSchema() == null ? null : getSchema().getCatalog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public /* non-final */ Schema getSchema() {
|
||||
return schema;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user