net.sf.jsqlparser.schema.Table.getSchemaName()方法的使用及代码示例

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

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

Table.getSchemaName介绍

暂无

代码示例

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

  1. private static List getTableColumns(ISession session, Table table) throws IOException {
  2. List colNames = new ArrayList();
  3. String tableName = table.getSchemaName() + "." + table.getName();
  4. SeColumnDefinition[] cols = session.describe(tableName);
  5. for (int i = 0; i < cols.length; i++) {
  6. String colName = cols[i].getName();
  7. colName = tableName + "." + colName;
  8. colNames.add(colName);
  9. }
  10. return colNames;
  11. }
  12. }

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

  1. String tableName = qt.getSchemaName() + "." + qt.getName();
  2. SeColumnDefinition[] cols;
  3. try {

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

  1. @Override
  2. public void visit(Table table) {
  3. if (!withTCEs.contains(table.getFullyQualifiedName().toLowerCase())) {
  4. RelationID relationId = idfac.createRelationID(table.getSchemaName(), table.getName());
  5. relations.add(relationId);
  6. }
  7. }

代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core

  1. @Override
  2. public void visit(Table table) {
  3. if (!withTCEs.contains(table.getFullyQualifiedName().toLowerCase())) {
  4. RelationID relationId = idfac.createRelationID(table.getSchemaName(), table.getName());
  5. relations.add(relationId);
  6. }
  7. }

代码示例来源:origin: org.opencadc/cadc-adql

  1. @Override
  2. public void visit(Table table)
  3. {
  4. log.debug("visit(table)" + table);
  5. String tabName = table.getWholeTableName();
  6. log.debug("looking for " + tabName + " in conversion map...");
  7. Table ntab = map.get(tabName);
  8. log.debug("found: " + ntab);
  9. if (ntab != null)
  10. {
  11. log.debug("convert: " + table.getSchemaName() + "." + table.getName()
  12. + " -> " + ntab.getSchemaName() + "." + ntab.getName());
  13. table.setName(ntab.getName());
  14. table.setSchemaName(ntab.getSchemaName());
  15. // leave alias intact
  16. }
  17. }
  18. }

代码示例来源:origin: org.geotools/gt-arcsde

  1. private static List getTableColumns(ISession session, Table table) throws IOException {
  2. List colNames = new ArrayList();
  3. String tableName = table.getSchemaName() + "." + table.getName();
  4. SeColumnDefinition[] cols = session.describe(tableName);
  5. for (int i = 0; i < cols.length; i++) {
  6. String colName = cols[i].getName();
  7. colName = tableName + "." + colName;
  8. colNames.add(colName);
  9. }
  10. return colNames;
  11. }
  12. }

代码示例来源:origin: org.opencadc/cadc-adql

  1. @Override
  2. public void visit(Column column)
  3. {
  4. log.debug("visit(column)" + column);
  5. Table table = column.getTable();
  6. log.debug("table: " + table);
  7. if (table != null && table.getName() != null)
  8. {
  9. String tabName = table.getWholeTableName();
  10. log.debug("looking for " + tabName + " in conversion map...");
  11. Table ntab = map.get(tabName);
  12. log.debug("found: " + ntab);
  13. if (ntab != null)
  14. {
  15. log.debug("convert: " + table.getSchemaName() + "." + table.getName()
  16. + " -> " + ntab.getSchemaName() + "." + ntab.getName());
  17. table.setName(ntab.getName());
  18. table.setSchemaName(ntab.getSchemaName());
  19. // leave alias intact
  20. }
  21. }
  22. }
  23. }

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

  1. public ImmutableMap<QualifiedAttributeID, Term> expandStar(ImmutableMap<QualifiedAttributeID, Term> attributes, Table table) {
  2. RelationID id = idfac.createRelationID(table.getSchemaName(), table.getName());
  3. return attributes.entrySet().stream()
  4. .filter(e -> e.getKey().getRelation() != null && e.getKey().getRelation().equals(id))
  5. .collect(ImmutableCollectors.toMap(
  6. e -> new QualifiedAttributeID(null, e.getKey().getAttribute()),
  7. Map.Entry::getValue));
  8. }

代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core

  1. public ImmutableMap<QualifiedAttributeID, Term> expandStar(ImmutableMap<QualifiedAttributeID, Term> attributes, Table table) {
  2. RelationID id = idfac.createRelationID(table.getSchemaName(), table.getName());
  3. return attributes.entrySet().stream()
  4. .filter(e -> e.getKey().getRelation() != null && e.getKey().getRelation().equals(id))
  5. .collect(ImmutableCollectors.toMap(
  6. e -> new QualifiedAttributeID(null, e.getKey().getAttribute()),
  7. Map.Entry::getValue));
  8. }

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

  1. @Override
  2. public void visit(AllTableColumns allTableColumns) {
  3. Table table = allTableColumns.getTable();
  4. RelationID id = idfac.createRelationID(table.getSchemaName(), table.getName());
  5. map = attributes.entrySet().stream()
  6. .filter(e -> e.getKey().getRelation() != null && e.getKey().getRelation().equals(id))
  7. .collect(ImmutableCollectors.toMap(
  8. e -> new QualifiedAttributeID(null, e.getKey().getAttribute()),
  9. Map.Entry::getValue));
  10. }

代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core

  1. @Override
  2. public void visit(AllTableColumns allTableColumns) {
  3. Table table = allTableColumns.getTable();
  4. RelationID id = idfac.createRelationID(table.getSchemaName(), table.getName());
  5. map = attributes.entrySet().stream()
  6. .filter(e -> e.getKey().getRelation() != null && e.getKey().getRelation().equals(id))
  7. .collect(ImmutableCollectors.toMap(
  8. e -> new QualifiedAttributeID(null, e.getKey().getAttribute()),
  9. Map.Entry::getValue));
  10. }

代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-core

  1. @Override
  2. public void visit(Table table) {
  3. if (!withTCEs.contains(table.getFullyQualifiedName().toLowerCase())) {
  4. RelationID relationId = idfac.createRelationID(table.getSchemaName(), table.getName());
  5. relations.add(relationId);
  6. if (inSubSelect && subSelectAlias != null) {
  7. // ONLY SIMPLE SUBSELECTS, WITH ONE TABLE: see WhereClauseVisitor and ProjectionVisitor
  8. RelationID subSelectAliasId = idfac.createRelationID(null, subSelectAlias.getName());
  9. tables.put(subSelectAliasId, relationId);
  10. }
  11. else {
  12. Alias as = table.getAlias();
  13. RelationID aliasId = (as != null) ? idfac.createRelationID(null, as.getName()) : relationId;
  14. tables.put(aliasId, relationId);
  15. }
  16. }
  17. }

代码示例来源:origin: diennea/herddb

  1. private Statement buildTruncateStatement(String defaultTableSpace, Truncate truncate) throws StatementExecutionException {
  2. if (truncate.getTable() == null) {
  3. throw new StatementExecutionException("missing table name");
  4. }
  5. String tableSpace = truncate.getTable().getSchemaName();
  6. if (tableSpace == null) {
  7. tableSpace = defaultTableSpace;
  8. }
  9. String tableName = truncate.getTable().getName();
  10. return new TruncateTableStatement(tableSpace, tableName);
  11. }

代码示例来源:origin: diennea/herddb

  1. static TableRef buildFrom(Table fromTable, String defaultTableSpace) {
  2. String tableSpace = fromTable.getSchemaName();
  3. String tableName = fromTable.getName();
  4. String tableAlias = tableName;
  5. if (fromTable.getAlias() != null && fromTable.getAlias().getName() != null) {
  6. tableAlias = fromTable.getAlias().getName();
  7. }
  8. if (tableSpace == null) {
  9. tableSpace = defaultTableSpace;
  10. }
  11. return new TableRef(tableSpace, tableName, tableAlias);
  12. }

代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core

  1. @Override
  2. public void visit(SelectExpressionItem selectExpressionItem) {
  3. Expression expr = selectExpressionItem.getExpression();
  4. QuotedID name = getSelectItemAliasedId(selectExpressionItem);
  5. final Term var;
  6. if (expr instanceof Column) {
  7. Column column = (Column) expr;
  8. QuotedID columnId = idfac.createAttributeID(column.getColumnName());
  9. Table table = column.getTable();
  10. RelationID tableId = (table == null || table.getName() == null)
  11. ? null : idfac.createRelationID(table.getSchemaName(), table.getName());
  12. QualifiedAttributeID attr = new QualifiedAttributeID(tableId, columnId);
  13. var = attributes.get(attr);
  14. if (var == null)
  15. throw new InvalidSelectQueryRuntimeException("Column not found", selectExpressionItem);
  16. }
  17. else {
  18. // whether the complex expression has an alias already been checked
  19. var = createVariable(name);
  20. }
  21. map = ImmutableMap.of(new QualifiedAttributeID(null, name), var);
  22. }
  23. }

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

  1. @Override
  2. public void visit(SelectExpressionItem selectExpressionItem) {
  3. Expression expr = selectExpressionItem.getExpression();
  4. QuotedID name = getSelectItemAliasedId(selectExpressionItem);
  5. final Term var;
  6. if (expr instanceof Column) {
  7. Column column = (Column) expr;
  8. QuotedID columnId = idfac.createAttributeID(column.getColumnName());
  9. Table table = column.getTable();
  10. RelationID tableId = (table == null || table.getName() == null)
  11. ? null : idfac.createRelationID(table.getSchemaName(), table.getName());
  12. QualifiedAttributeID attr = new QualifiedAttributeID(tableId, columnId);
  13. var = attributes.get(attr);
  14. if (var == null)
  15. throw new InvalidSelectQueryRuntimeException("Column not found", selectExpressionItem);
  16. }
  17. else {
  18. // whether the complex expression has an alias already been checked
  19. var = createVariable(name);
  20. }
  21. map = ImmutableMap.of(new QualifiedAttributeID(null, name), var);
  22. }
  23. }

代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-core

  1. private Term getVariable(Column expression) {
  2. QuotedID column = idfac.createAttributeID(expression.getColumnName());
  3. RelationID relation = null;
  4. if (expression.getTable().getName() != null)
  5. relation = idfac.createRelationID(expression.getTable().getSchemaName(), expression.getTable().getName());
  6. QualifiedAttributeID qa = new QualifiedAttributeID(relation, column);
  7. return lookupTable.get(qa);
  8. }

代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-core

  1. public static void normalizeColumnName(QuotedIDFactory idfac, Column tableColumn) {
  2. QuotedID columnName = idfac.createAttributeID(tableColumn.getColumnName());
  3. tableColumn.setColumnName(columnName.getSQLRendering());
  4. Table table = tableColumn.getTable();
  5. RelationID tableName = idfac.createRelationID(table.getSchemaName(), table.getName());
  6. table.setSchemaName(tableName.getSchemaSQLRendering());
  7. table.setName(tableName.getTableNameSQLRendering());
  8. }

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

  1. @Override
  2. public void visit(Table tableName) {
  3. RelationID id = idfac.createRelationID(tableName.getSchemaName(), tableName.getName());
  4. // construct the predicate using the table name
  5. DatabaseRelationDefinition relation = metadata.getDatabaseRelation(id);
  6. if (relation == null)
  7. throw new InvalidSelectQueryRuntimeException("Table " + id + " not found in metadata", tableName);
  8. relationIndex++;
  9. RelationID alias = (tableName.getAlias() != null)
  10. ? idfac.createRelationID(null, tableName.getAlias().getName())
  11. : relation.getID();
  12. ImmutableMap<QuotedID, Term> attributes = relation.getAttributes().stream()
  13. .collect(ImmutableCollectors.toMap(Attribute::getID,
  14. attribute -> createVariable(attribute.getID())));
  15. // DEFAULT SCHEMA
  16. // TODO: to be improved
  17. if ((tableName.getAlias() == null) &&
  18. relation.getID().getSchemaName() != null &&
  19. metadata.getDatabaseRelation(relation.getID().getSchemalessID()).equals(relation))
  20. result = RAExpressionAttributes.create(attributes, alias, relation.getID().getSchemalessID());
  21. else
  22. result = RAExpressionAttributes.create(attributes, alias);
  23. }

代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core

  1. @Override
  2. public void visit(Table tableName) {
  3. RelationID id = idfac.createRelationID(tableName.getSchemaName(), tableName.getName());
  4. // construct the predicate using the table name
  5. DatabaseRelationDefinition relation = metadata.getDatabaseRelation(id);
  6. if (relation == null)
  7. throw new InvalidSelectQueryRuntimeException("Table " + id + " not found in metadata", tableName);
  8. relationIndex++;
  9. RelationID alias = (tableName.getAlias() != null)
  10. ? idfac.createRelationID(null, tableName.getAlias().getName())
  11. : relation.getID();
  12. ImmutableMap<QuotedID, Term> attributes = relation.getAttributes().stream()
  13. .collect(ImmutableCollectors.toMap(Attribute::getID,
  14. attribute -> createVariable(attribute.getID())));
  15. // DEFAULT SCHEMA
  16. // TODO: to be improved
  17. if ((tableName.getAlias() == null) &&
  18. relation.getID().getSchemaName() != null &&
  19. metadata.getDatabaseRelation(relation.getID().getSchemalessID()).equals(relation))
  20. result = RAExpressionAttributes.create(attributes, alias, relation.getID().getSchemalessID());
  21. else
  22. result = RAExpressionAttributes.create(attributes, alias);
  23. }

相关文章