[jOOQ/jOOQ#9483] Add XMLDatabase support
This includes: - [jOOQ/jOOQ#15745] TableDefinition.getTable() should return better meta data
This commit is contained in:
parent
85c42745ee
commit
ca4964b9aa
@ -38,8 +38,6 @@
|
||||
|
||||
package org.jooq.meta;
|
||||
|
||||
import static org.jooq.impl.DSL.table;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -49,7 +47,10 @@ import java.util.Set;
|
||||
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableOptions;
|
||||
import org.jooq.TableOptions.TableType;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.TableImpl;
|
||||
|
||||
/**
|
||||
* A base implementation for table definitions.
|
||||
@ -260,7 +261,21 @@ implements
|
||||
|
||||
@Override
|
||||
public final Table<Record> getTable() {
|
||||
return table(getQualifiedName());
|
||||
return new TableImpl<>(getQualifiedNamePart(), null, null, null, DSL.comment(getComment()), getTableOptions());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOptions getTableOptions() {
|
||||
if (isTableValuedFunction())
|
||||
return TableOptions.function(getSource());
|
||||
else if (isMaterializedView())
|
||||
return TableOptions.materializedView(getSource());
|
||||
else if (isView())
|
||||
return TableOptions.view(getSource());
|
||||
else if (isTemporary())
|
||||
return TableOptions.temporaryTable();
|
||||
else
|
||||
return TableOptions.table();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -42,6 +42,7 @@ import java.util.List;
|
||||
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.TableOptions;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -175,6 +176,11 @@ public interface TableDefinition extends Definition {
|
||||
*/
|
||||
Table<Record> getTable();
|
||||
|
||||
/**
|
||||
* The {@link TableOptions} providing additional information about the table.
|
||||
*/
|
||||
TableOptions getTableOptions();
|
||||
|
||||
/**
|
||||
* The parameters of this table if this is a table-valued function.
|
||||
*/
|
||||
|
||||
@ -555,13 +555,14 @@ public class XMLDatabase extends AbstractDatabase {
|
||||
switch (table.getTableType()) {
|
||||
case GLOBAL_TEMPORARY: tableType = TableType.TEMPORARY; break;
|
||||
case VIEW: tableType = TableType.VIEW; break;
|
||||
case MATERIALIZED_VIEW:tableType = TableType.MATERIALIZED_VIEW; break;
|
||||
case BASE_TABLE:
|
||||
default: tableType = TableType.TABLE; break;
|
||||
}
|
||||
|
||||
String source = null;
|
||||
|
||||
if (tableType == TableType.VIEW) {
|
||||
if (tableType == TableType.VIEW || tableType == TableType.MATERIALIZED_VIEW) {
|
||||
|
||||
viewLoop:
|
||||
for (View view : info().getViews()) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user