org.teiid.metadata.Table.setSelectTransformation()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(14.9k)|赞(0)|评价(0)|浏览(252)

本文整理了Java中org.teiid.metadata.Table.setSelectTransformation()方法的一些代码示例,展示了Table.setSelectTransformation()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.setSelectTransformation()方法的具体详情如下:
包路径:org.teiid.metadata.Table
类名称:Table
方法名:setSelectTransformation

Table.setSelectTransformation介绍

暂无

代码示例

代码示例来源:origin: org.teiid/teiid-runtime

  1. private Table add_pg_am() {
  2. Table t = createView("pg_am"); //$NON-NLS-1$
  3. addColumn("oid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  4. addColumn("amname", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  5. String transformation = "SELECT 0 as oid, 'btree' as amname"; //$NON-NLS-1$
  6. t.setSelectTransformation(transformation);
  7. return t;
  8. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private void add_pg_inherits() {
  2. Table t = createView("pg_inherits"); //$NON-NLS-1$
  3. addColumn("inhrelid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  4. addColumn("inhparent", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  5. addColumn("inhseqno", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  6. String transformation = "SELECT null, null, null from SYS.Tables WHERE 1=2"; //$NON-NLS-1$
  7. t.setSelectTransformation(transformation);
  8. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private void add_pg_stats() {
  2. Table t = createView("pg_stats"); //$NON-NLS-1$
  3. addColumn("schemaname", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  4. addColumn("tablename", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  5. addColumn("attname", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  6. String transformation = "SELECT null, null, null from SYS.Tables WHERE 1=2"; //$NON-NLS-1$
  7. t.setSelectTransformation(transformation);
  8. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private Table add_pg_namespace() {
  2. Table t = createView("pg_namespace"); //$NON-NLS-1$
  3. addColumn("oid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  4. addColumn("nspname", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  5. addColumn("nspowner", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  6. String transformation = "SELECT pg_catalog.getOid(uid) as oid, t1.Name as nspname, 0 as nspowner " + //$NON-NLS-1$
  7. "FROM SYS.Schemas as t1"; //$NON-NLS-1$
  8. t.setSelectTransformation(transformation);
  9. return t;
  10. }

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. public void setViewDefinition(final String tableName, final String definition, boolean updateFunctional) {
  2. if (!assertInEditMode(Mode.SCHEMA)) {
  3. return;
  4. }
  5. assertGrant(Grant.Permission.Privilege.ALTER, Database.ResourceType.TABLE, getCurrentSchema().getTable(tableName));
  6. verifyTableExists(tableName).setSelectTransformation(definition);
  7. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private void add_pg_prepared_xacts() {
  2. Table t = createView("pg_prepared_xacts"); //$NON-NLS-1$
  3. //xid
  4. addColumn("transaction", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  5. addColumn("gid", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  6. addColumn("owner", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  7. addColumn("database", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  8. String transformation = "SELECT null, null, null, null from SYS.Tables WHERE 1=2"; //$NON-NLS-1$
  9. t.setSelectTransformation(transformation);
  10. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private Table add_infoSchemaTables() {
  2. Table t = createView("information_schema.tables"); //$NON-NLS-1$
  3. addColumn("table_catalog", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  4. addColumn("table_schema", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  5. addColumn("table_name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  6. addColumn("table_type", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  7. t.setSelectTransformation("select vdbname, schemaName, name," + //$NON-NLS-1$
  8. " case when IsSystem then 'SYSTEM ' else '' end || case when IsPhysical then 'BASE TABLE' else 'VIEW' end from sys.tables"); //$NON-NLS-1$
  9. return t;
  10. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private Table add_pg_description() {
  2. Table t = createView("pg_description"); //$NON-NLS-1$
  3. addColumn("objoid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  4. addColumn("classoid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  5. addColumn("objsubid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  6. addColumn("description", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  7. String transformation = "SELECT 0, null, null, null"; //$NON-NLS-1$
  8. t.setSelectTransformation(transformation);
  9. return t;
  10. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private Table add_pg_attrdef() {
  2. Table t = createView("pg_attrdef"); //$NON-NLS-1$
  3. addColumn("adrelid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  4. addColumn("adnum", DataTypeManager.DefaultDataTypes.SHORT, t); //$NON-NLS-1$
  5. addColumn("adbin", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  6. addColumn("adsrc", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  7. String transformation = "SELECT pg_catalog.getOid(t1.tableuid) as adrelid, convert(t1.Position, short) as adnum, " + //$NON-NLS-1$
  8. "case when t1.IsAutoIncremented then 'nextval(' else t1.DefaultValue end as adbin, " + //$NON-NLS-1$
  9. "case when t1.IsAutoIncremented then 'nextval(' else t1.DefaultValue end as adsrc " + //$NON-NLS-1$
  10. "FROM SYS.Columns as t1"; //$NON-NLS-1$
  11. t.setSelectTransformation(transformation);
  12. return t;
  13. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private Table add_infoSchemaViews() {
  2. Table t = createView("information_schema.views"); //$NON-NLS-1$
  3. addColumn("table_catalog", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  4. addColumn("table_schema", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  5. addColumn("table_name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  6. addColumn("check_option", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  7. addColumn("is_updatable", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  8. t.setSelectTransformation("select vdbname, schemaName, name, 'NONE', case when SupportsUpdates then 'YES' else 'NO' end from sys.tables where IsPhysical"); //$NON-NLS-1$
  9. return t;
  10. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private Table add_pg_user() {
  2. Table t = createView("pg_user"); //$NON-NLS-1$
  3. addColumn("oid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  4. addColumn("usename", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  5. addColumn("usesysid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  6. addColumn("usecreatedb", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$
  7. addColumn("usesuper", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$
  8. String transformation = "SELECT 0 as oid, " + //$NON-NLS-1$
  9. "user(false) as usename, 0 as usesysid," + //$NON-NLS-1$
  10. "false as usecreatedb, " + //$NON-NLS-1$
  11. "false as usesuper "; //$NON-NLS-1$
  12. t.setSelectTransformation(transformation);
  13. return t;
  14. }

代码示例来源:origin: org.teiid/teiid-engine

  1. public void setViewDefinition(final String tableName, final String definition) {
  2. if (!assertInEditMode(Mode.SCHEMA)) {
  3. return;
  4. }
  5. Table table = (Table)getSchemaRecord(tableName, ResourceType.TABLE);
  6. if (!table.isVirtual()) {
  7. throw new org.teiid.metadata.MetadataException(QueryPlugin.Event.TEIID31238,
  8. QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31238, table.getFullName()));
  9. }
  10. assertGrant(Grant.Permission.Privilege.ALTER, Database.ResourceType.TABLE, table);
  11. table.setSelectTransformation(definition);
  12. }

代码示例来源:origin: teiid/teiid

  1. public void setViewDefinition(final String tableName, final String definition) {
  2. if (!assertInEditMode(Mode.SCHEMA)) {
  3. return;
  4. }
  5. Table table = (Table)getSchemaRecord(tableName, ResourceType.TABLE);
  6. if (!table.isVirtual()) {
  7. throw new org.teiid.metadata.MetadataException(QueryPlugin.Event.TEIID31238,
  8. QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31238, table.getFullName()));
  9. }
  10. assertGrant(Grant.Permission.Privilege.ALTER, Database.ResourceType.TABLE, table);
  11. table.setSelectTransformation(definition);
  12. }

代码示例来源:origin: org.teiid/teiid-engine

  1. public static void alterView(final VDBMetaData vdb, final Table t, final String sql, boolean updateStore) {
  2. TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class);
  3. DatabaseStore store = vdb.getAttachment(DatabaseStore.class);
  4. try {
  5. Command command = QueryParser.getQueryParser().parseCommand(t.getSelectTransformation());
  6. QueryResolver.resolveCommand(command, metadata);
  7. MetadataValidator.determineDependencies(t, command);
  8. } catch (TeiidException e) {
  9. //should have been caught in validation, but this logic
  10. //is also not mature so since there is no lock on the vdb
  11. //it is possible that the plan is no longer valid at this point due
  12. //to a concurrent execution
  13. }
  14. t.setSelectTransformation(sql);
  15. t.setLastModified(System.currentTimeMillis());
  16. metadata.addToMetadataCache(t, "transformation/"+SQLConstants.Reserved.SELECT, null); //$NON-NLS-1$
  17. }

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. public static void alterView(final VDBMetaData vdb, final Table t, final String sql, boolean updateStore) {
  2. TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class);
  3. DatabaseStore store = vdb.getAttachment(DatabaseStore.class);
  4. try {
  5. Command command = QueryParser.getQueryParser().parseCommand(t.getSelectTransformation());
  6. QueryResolver.resolveCommand(command, metadata);
  7. MetadataValidator.determineDependencies(t, command);
  8. } catch (TeiidException e) {
  9. //should have been caught in validation, but this logic
  10. //is also not mature so since there is no lock on the vdb
  11. //it is possible that the plan is no longer valid at this point due
  12. //to a concurrent execution
  13. }
  14. t.setSelectTransformation(sql);
  15. t.setLastModified(System.currentTimeMillis());
  16. metadata.addToMetadataCache(t, "transformation/"+SQLConstants.Reserved.SELECT, null); //$NON-NLS-1$
  17. }

代码示例来源:origin: teiid/teiid

  1. public static void alterView(final VDBMetaData vdb, final Table t, final String sql, boolean updateStore) {
  2. TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class);
  3. DatabaseStore store = vdb.getAttachment(DatabaseStore.class);
  4. try {
  5. Command command = QueryParser.getQueryParser().parseCommand(t.getSelectTransformation());
  6. QueryResolver.resolveCommand(command, metadata);
  7. MetadataValidator.determineDependencies(t, command);
  8. } catch (TeiidException e) {
  9. //should have been caught in validation, but this logic
  10. //is also not mature so since there is no lock on the vdb
  11. //it is possible that the plan is no longer valid at this point due
  12. //to a concurrent execution
  13. }
  14. t.setSelectTransformation(sql);
  15. t.setLastModified(System.currentTimeMillis());
  16. metadata.addToMetadataCache(t, "transformation/"+SQLConstants.Reserved.SELECT, null); //$NON-NLS-1$
  17. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private Table add_infoSchemaReferentialConstraints() {
  2. Table t = createView("information_schema.referential_constraints"); //$NON-NLS-1$
  3. addColumn("constraint_catalog", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  4. addColumn("constraint_schema", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  5. addColumn("constraint_name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  6. addColumn("unique_constraint_catalog", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  7. addColumn("unique_constraint_schema", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  8. addColumn("unique_constraint_name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  9. addColumn("match_option", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  10. addColumn("update_rule", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  11. addColumn("delete_rule", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  12. t.setSelectTransformation("select PKTABLE_CAT, PKTABLE_SCHEM, PK_NAME, FKTABLE_CAT, FKTABLE_SCHEM, FK_NAME, 'NONE', 'NO ACTION', 'NO ACTION' FROM SYS.ReferenceKeyColumns " //$NON-NLS-1$
  13. + "group by PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME, PK_NAME"); //$NON-NLS-1$
  14. return t;
  15. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private Table add_infoSchemaKeyColumnUsage() {
  2. Table t = createView("information_schema.key_column_usage"); //$NON-NLS-1$
  3. addColumn("constraint_catalog", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  4. addColumn("constraint_schema", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  5. addColumn("constraint_name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  6. addColumn("table_catalog", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  7. addColumn("table_schema", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  8. addColumn("table_name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  9. addColumn("column_name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  10. addColumn("ordinal_position", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  11. addColumn("position_in_unique_constraint", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
  12. t.setSelectTransformation("select VDBName, SchemaName, KeyName, VDBName, SchemaName, TableName, Name, KeyColumns.Position, case when RefKeyUID is not null then KeyColumns.Position end " //$NON-NLS-1$
  13. + "FROM SYS.KeyColumns"); //$NON-NLS-1$
  14. return t;
  15. }

代码示例来源:origin: org.teiid/teiid-runtime

  1. private Table add_infoSchemaTableConstraints() {
  2. Table t = createView("information_schema.table_constraints"); //$NON-NLS-1$
  3. addColumn("constraint_catalog", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  4. addColumn("constraint_schema", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  5. addColumn("constraint_name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  6. addColumn("table_catalog", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  7. addColumn("table_schema", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  8. addColumn("table_name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  9. addColumn("constraint_type", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  10. addColumn("is_deferrable", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  11. addColumn("initially_deferred", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
  12. t.setSelectTransformation("select VDBName, SchemaName, Name, VDBName, SchemaName, TableName, upper(Keys.Type || case when Keys.Type in ('Primary', 'Foreign') then ' Key' else '' end), 'NO', 'NO' " //$NON-NLS-1$
  13. + "FROM SYS.Keys where Keys.Type in ('Primary', 'Foreign', 'Unique')"); //$NON-NLS-1$
  14. return t;
  15. }

代码示例来源:origin: teiid/teiid

  1. /**
  2. * Create a virtual group with default settings.
  3. */
  4. public static Table createVirtualGroup(String name, Schema model, QueryNode plan) {
  5. Table table = new Table();
  6. table.setName(name);
  7. model.addTable(table);
  8. table.setVirtual(true);
  9. table.setTableType(org.teiid.metadata.Table.Type.View);
  10. table.setSelectTransformation(plan.getQuery());
  11. return table;
  12. }

相关文章