Package org.teiid.metadata

Examples of org.teiid.metadata.Table


    t.setSelectTransformation(transformation);     
    return t;   
  }
 
  private Table add_pg_database() throws TranslatorException  {
    Table t = createView("pg_database"); //$NON-NLS-1$
    addColumn("oid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
    addColumn("datname", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
    addColumn("encoding", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
    addColumn("datlastsysoid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
    // this is is boolean type but the query coming in is in the form dataallowconn = 't'
    addColumn("datallowconn", DataTypeManager.DefaultDataTypes.CHAR, t); //$NON-NLS-1$
    addColumn("datconfig", DataTypeManager.DefaultDataTypes.OBJECT, t); //$NON-NLS-1$
    addColumn("datacl", DataTypeManager.DefaultDataTypes.OBJECT, t); //$NON-NLS-1$
    addColumn("datdba", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
    addColumn("dattablespace", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
   
    String transformation = "SELECT 0 as oid, " + //$NON-NLS-1$
        "'teiid' as datname, " + //$NON-NLS-1$
        "6 as encoding, " + //$NON-NLS-1$
        "100000 as datlastsysoid, " + //$NON-NLS-1$
        "convert('t', char) as datallowconn, " + //$NON-NLS-1$
        "null, " + //$NON-NLS-1$
        "null, " + //$NON-NLS-1$
        "0 as datdba, " + //$NON-NLS-1$
        "0 as dattablespace" ; //$NON-NLS-1$
    t.setSelectTransformation(transformation)
    return t;
  }
View Full Code Here


    t.setSelectTransformation(transformation)
    return t;
  }
 
  private Table add_pg_user() throws TranslatorException  {
    Table t = createView("pg_user"); //$NON-NLS-1$
    addColumn("oid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
    addColumn("usename", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
    addColumn("usecreatedb", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$
    addColumn("usesuper", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$
   
    String transformation = "SELECT 0 as oid, " + //$NON-NLS-1$
        "null as usename, " + //$NON-NLS-1$
        "false as usecreatedb, " + //$NON-NLS-1$
        "false as usesuper "; //$NON-NLS-1$
    t.setSelectTransformation(transformation)
    return t;
  }
View Full Code Here

    t.setSelectTransformation(transformation)
    return t;
  }
 
  private Table add_matpg_relatt() throws TranslatorException  {
    Table t = createView("matpg_relatt"); //$NON-NLS-1$
    addColumn("attrelid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
    addColumn("attnum", DataTypeManager.DefaultDataTypes.SHORT, t); //$NON-NLS-1$
    addColumn("attname", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
    addColumn("relname", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
    addColumn("nspname", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
    addColumn("autoinc", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$
    addColumn("typoid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
   
    addPrimaryKey("pk_matpg_relatt_names", Arrays.asList("attname", "relname", "nspname"), t); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
    addIndex("idx_matpg_relatt_ids", true, Arrays.asList("attrelid", "attnum"), t); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    String transformation = "select pg_class.oid as attrelid, attnum, attname, relname, nspname, IsAutoIncremented as autoinc, cast((select p.value from SYS.Properties p where p.name = 'pg_type:oid' and p.uid = SYS.Columns.uid) as integer) as typoid " + //$NON-NLS-1$
        "from pg_attribute, pg_class, pg_namespace, SYS.Columns " + //$NON-NLS-1$
        "where pg_attribute.attrelid = pg_class.oid and pg_namespace.oid = relnamespace" + //$NON-NLS-1$
        " and SchemaName = nspname and TableName = relname and Name = attname"//$NON-NLS-1$
    t.setSelectTransformation(transformation);
    t.setMaterialized(true);
    return t;
  }
View Full Code Here

    t.setMaterialized(true);
    return t;
  }
 
  private Table add_matpg_datatype() throws TranslatorException  {
    Table t = createView("matpg_datatype"); //$NON-NLS-1$
    addColumn("oid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
    addColumn("typname", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
    addColumn("name", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
    addColumn("uid", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
    addColumn("typlen", DataTypeManager.DefaultDataTypes.SHORT, t); //$NON-NLS-1$
   
    addPrimaryKey("matpg_datatype_names", Arrays.asList("oid", "name"), t); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    addIndex("matpg_datatype_ids", true, Arrays.asList("typname", "oid"), t); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    String transformation = "select pt.oid as oid, pt.typname as typname, t.Name name, t.UID, pt.typlen from pg_catalog.pg_type pt JOIN (select (CASE "+//$NON-NLS-1$
    "WHEN (Name = 'clob' OR Name = 'blob') THEN 'lo' " +//$NON-NLS-1$
    "WHEN (Name = 'byte' ) THEN 'short' " +//$NON-NLS-1$
    "WHEN (Name = 'time' ) THEN 'datetime' " + //$NON-NLS-1$
    "WHEN (Name = 'biginteger' ) THEN 'decimal' " +//$NON-NLS-1$
    "WHEN (Name = 'bigdecimal' ) THEN 'decimal' " +//$NON-NLS-1$
    "ELSE Name END) as pg_name, Name, UID from SYS.DataTypes) as t ON t.pg_name = pt.typname"//$NON-NLS-1$
    t.setSelectTransformation(transformation);
    t.setMaterialized(true);
    return t;
 
View Full Code Here

      return false;
    }
   
  @Override
  public void getMetadata(MetadataFactory metadataFactory, Object connection) throws TranslatorException {
    Table t = metadataFactory.addTable("Stock"); //$NON-NLS-1$
    metadataFactory.addColumn("symbol", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
    metadataFactory.addColumn("last", DataTypeManager.DefaultDataTypes.DOUBLE, t); //$NON-NLS-1$
    metadataFactory.addColumn("date", DataTypeManager.DefaultDataTypes.DATE, t); //$NON-NLS-1$
    metadataFactory.addColumn("time", DataTypeManager.DefaultDataTypes.TIME, t); //$NON-NLS-1$
    metadataFactory.addColumn("change", DataTypeManager.DefaultDataTypes.DOUBLE, t); //$NON-NLS-1$
View Full Code Here

    if (s == null) {
      return;
    }
    long ts = System.currentTimeMillis();
    for (String name:objectNames) {
      Table table = s.getTables().get(name);
      if (table == null) {
        continue;
      }
      if (data) {
        table.setLastDataModification(ts);
      } else {
        table.setLastModified(ts);
      }
    }
  }
View Full Code Here

 
  @Override
  public void setColumnStats(String vdbName, int vdbVersion,
      String schemaName, String tableName, String columnName,
      ColumnStats stats) {
    Table t = getTable(vdbName, vdbVersion, schemaName, tableName);
    if (t == null) {
      return;
    }
    for (Column c : t.getColumns()) {
      if (c.getName().equalsIgnoreCase(columnName)) {
        c.setColumnStats(stats);
        t.setLastModified(System.currentTimeMillis());
        break;
      }
    }
  }
View Full Code Here

  }
 
  @Override
  public void setTableStats(String vdbName, int vdbVersion,
      String schemaName, String tableName, TableStats stats) {
    Table t = getTable(vdbName, vdbVersion, schemaName, tableName);
    if (t == null) {
      return;
    }
    t.setTableStats(stats);
    t.setLastModified(System.currentTimeMillis());
  }
View Full Code Here

 
  @Override
  public void setInsteadOfTriggerDefinition(String vdbName, int vdbVersion,
      String schema, String viewName, TriggerEvent triggerEvent,
      String triggerDefinition, Boolean enabled) {
    Table t = getTable(vdbName, vdbVersion, schema, viewName);
    if (t == null) {
      return;
    }
    DdlPlan.alterInsteadOfTrigger(this.vdbRepository.getVDB(vdbName, vdbVersion), t, triggerDefinition, enabled, triggerEvent);
  }
View Full Code Here

  }
 
  @Override
  public void setViewDefinition(String vdbName, int vdbVersion,
      String schema, String viewName, String definition) {
    Table t = getTable(vdbName, vdbVersion, schema, viewName);
    if (t == null) {
      return;
    }
    DdlPlan.alterView(this.vdbRepository.getVDB(vdbName, vdbVersion), t, definition);
  }
View Full Code Here

TOP

Related Classes of org.teiid.metadata.Table

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.