[jOOQ/jOOQ#9399] Move DSLContext.informationSchema() to Meta
This commit is contained in:
parent
5cb09b1b77
commit
ee8735b6b1
@ -312,56 +312,50 @@ public interface DSLContext extends Scope , AutoCloseable {
|
||||
Meta meta(Source... scripts);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Convenience method for {@link Meta#informationSchema()}.
|
||||
*
|
||||
* @see #meta(Catalog...)
|
||||
* @see Meta#informationSchema()
|
||||
*/
|
||||
InformationSchema informationSchema(Catalog catalog);
|
||||
|
||||
/**
|
||||
* Export a set of catalogs 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.
|
||||
* Convenience method for {@link Meta#informationSchema()}.
|
||||
*
|
||||
* @see #meta(Catalog...)
|
||||
* @see Meta#informationSchema()
|
||||
*/
|
||||
InformationSchema informationSchema(Catalog... catalogs);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Convenience method for {@link Meta#informationSchema()}.
|
||||
*
|
||||
* @see #meta(Schema...)
|
||||
* @see Meta#informationSchema()
|
||||
*/
|
||||
InformationSchema informationSchema(Schema schema);
|
||||
|
||||
/**
|
||||
* Export a set of schemas 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.
|
||||
* Convenience method for {@link Meta#informationSchema()}.
|
||||
*
|
||||
* @see #meta(Schema...)
|
||||
* @see Meta#informationSchema()
|
||||
*/
|
||||
InformationSchema informationSchema(Schema... schemas);
|
||||
|
||||
/**
|
||||
* Export a table to the {@link InformationSchema} format.
|
||||
* <p>
|
||||
* Exporting a single table will not include any foreign key definitions in
|
||||
* the exported data.
|
||||
* <p>
|
||||
* This allows for serialising schema meta information as XML using JAXB.
|
||||
* See also {@link Constants#XSD_META} for details.
|
||||
* Convenience method for {@link Meta#informationSchema()}.
|
||||
*
|
||||
* @see #meta(Table...)
|
||||
* @see Meta#informationSchema()
|
||||
*/
|
||||
InformationSchema informationSchema(Table<?> table);
|
||||
|
||||
/**
|
||||
* Export a set of tables to the {@link InformationSchema} format.
|
||||
* <p>
|
||||
* Only those foreign keys whose referenced table is also included in the
|
||||
* export will be exported.
|
||||
* <p>
|
||||
* This allows for serialising schema meta information as XML using JAXB.
|
||||
* See also {@link Constants#XSD_META} for details.
|
||||
* Convenience method for {@link Meta#informationSchema()}.
|
||||
*
|
||||
* @see #meta(Table...)
|
||||
* @see Meta#informationSchema()
|
||||
*/
|
||||
InformationSchema informationSchema(Table<?>... table);
|
||||
|
||||
|
||||
@ -218,4 +218,12 @@ public interface Meta extends Scope {
|
||||
* objects
|
||||
*/
|
||||
Queries ddl(DDLExportConfiguration configuration) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Export 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() throws DataAccessException;
|
||||
}
|
||||
|
||||
@ -59,6 +59,7 @@ import org.jooq.Sequence;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.UniqueKey;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
import org.jooq.util.xml.jaxb.InformationSchema;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
@ -294,4 +295,11 @@ abstract class AbstractMeta extends AbstractScope implements Meta, Serializable
|
||||
public /* non-final */ Queries ddl(DDLExportConfiguration exportConfiguration) throws DataAccessException {
|
||||
return new DDL(this, exportConfiguration).queries();
|
||||
}
|
||||
|
||||
// [#9396] TODO Fix this. Subclasses should not need to override this to get
|
||||
// correct results
|
||||
@Override
|
||||
public /* non-final */ InformationSchema informationSchema() throws DataAccessException {
|
||||
return InformationSchemaExport.exportCatalogs(configuration(), getCatalogs());
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@ import org.jooq.Sequence;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.UniqueKey;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
import org.jooq.util.xml.jaxb.InformationSchema;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
@ -116,4 +117,9 @@ final class TableMetaImpl extends AbstractMeta {
|
||||
public Queries ddl(DDLExportConfiguration exportConfiguration) throws DataAccessException {
|
||||
return new DDL(this, exportConfiguration).queries(tables);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InformationSchema informationSchema() throws DataAccessException {
|
||||
return InformationSchemaExport.exportTables(configuration(), getTables());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user