本文整理了Java中net.sf.jsqlparser.schema.Table.getSchemaName()
方法的一些代码示例,展示了Table.getSchemaName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getSchemaName()
方法的具体详情如下:
包路径:net.sf.jsqlparser.schema.Table
类名称:Table
方法名:getSchemaName
暂无
代码示例来源:origin: geotools/geotools
private static List getTableColumns(ISession session, Table table) throws IOException {
List colNames = new ArrayList();
String tableName = table.getSchemaName() + "." + table.getName();
SeColumnDefinition[] cols = session.describe(tableName);
for (int i = 0; i < cols.length; i++) {
String colName = cols[i].getName();
colName = tableName + "." + colName;
colNames.add(colName);
}
return colNames;
}
}
代码示例来源:origin: geotools/geotools
String tableName = qt.getSchemaName() + "." + qt.getName();
SeColumnDefinition[] cols;
try {
代码示例来源:origin: ontop/ontop
@Override
public void visit(Table table) {
if (!withTCEs.contains(table.getFullyQualifiedName().toLowerCase())) {
RelationID relationId = idfac.createRelationID(table.getSchemaName(), table.getName());
relations.add(relationId);
}
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core
@Override
public void visit(Table table) {
if (!withTCEs.contains(table.getFullyQualifiedName().toLowerCase())) {
RelationID relationId = idfac.createRelationID(table.getSchemaName(), table.getName());
relations.add(relationId);
}
}
代码示例来源:origin: org.opencadc/cadc-adql
@Override
public void visit(Table table)
{
log.debug("visit(table)" + table);
String tabName = table.getWholeTableName();
log.debug("looking for " + tabName + " in conversion map...");
Table ntab = map.get(tabName);
log.debug("found: " + ntab);
if (ntab != null)
{
log.debug("convert: " + table.getSchemaName() + "." + table.getName()
+ " -> " + ntab.getSchemaName() + "." + ntab.getName());
table.setName(ntab.getName());
table.setSchemaName(ntab.getSchemaName());
// leave alias intact
}
}
}
代码示例来源:origin: org.geotools/gt-arcsde
private static List getTableColumns(ISession session, Table table) throws IOException {
List colNames = new ArrayList();
String tableName = table.getSchemaName() + "." + table.getName();
SeColumnDefinition[] cols = session.describe(tableName);
for (int i = 0; i < cols.length; i++) {
String colName = cols[i].getName();
colName = tableName + "." + colName;
colNames.add(colName);
}
return colNames;
}
}
代码示例来源:origin: org.opencadc/cadc-adql
@Override
public void visit(Column column)
{
log.debug("visit(column)" + column);
Table table = column.getTable();
log.debug("table: " + table);
if (table != null && table.getName() != null)
{
String tabName = table.getWholeTableName();
log.debug("looking for " + tabName + " in conversion map...");
Table ntab = map.get(tabName);
log.debug("found: " + ntab);
if (ntab != null)
{
log.debug("convert: " + table.getSchemaName() + "." + table.getName()
+ " -> " + ntab.getSchemaName() + "." + ntab.getName());
table.setName(ntab.getName());
table.setSchemaName(ntab.getSchemaName());
// leave alias intact
}
}
}
}
代码示例来源:origin: ontop/ontop
public ImmutableMap<QualifiedAttributeID, Term> expandStar(ImmutableMap<QualifiedAttributeID, Term> attributes, Table table) {
RelationID id = idfac.createRelationID(table.getSchemaName(), table.getName());
return attributes.entrySet().stream()
.filter(e -> e.getKey().getRelation() != null && e.getKey().getRelation().equals(id))
.collect(ImmutableCollectors.toMap(
e -> new QualifiedAttributeID(null, e.getKey().getAttribute()),
Map.Entry::getValue));
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core
public ImmutableMap<QualifiedAttributeID, Term> expandStar(ImmutableMap<QualifiedAttributeID, Term> attributes, Table table) {
RelationID id = idfac.createRelationID(table.getSchemaName(), table.getName());
return attributes.entrySet().stream()
.filter(e -> e.getKey().getRelation() != null && e.getKey().getRelation().equals(id))
.collect(ImmutableCollectors.toMap(
e -> new QualifiedAttributeID(null, e.getKey().getAttribute()),
Map.Entry::getValue));
}
代码示例来源:origin: ontop/ontop
@Override
public void visit(AllTableColumns allTableColumns) {
Table table = allTableColumns.getTable();
RelationID id = idfac.createRelationID(table.getSchemaName(), table.getName());
map = attributes.entrySet().stream()
.filter(e -> e.getKey().getRelation() != null && e.getKey().getRelation().equals(id))
.collect(ImmutableCollectors.toMap(
e -> new QualifiedAttributeID(null, e.getKey().getAttribute()),
Map.Entry::getValue));
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core
@Override
public void visit(AllTableColumns allTableColumns) {
Table table = allTableColumns.getTable();
RelationID id = idfac.createRelationID(table.getSchemaName(), table.getName());
map = attributes.entrySet().stream()
.filter(e -> e.getKey().getRelation() != null && e.getKey().getRelation().equals(id))
.collect(ImmutableCollectors.toMap(
e -> new QualifiedAttributeID(null, e.getKey().getAttribute()),
Map.Entry::getValue));
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-core
@Override
public void visit(Table table) {
if (!withTCEs.contains(table.getFullyQualifiedName().toLowerCase())) {
RelationID relationId = idfac.createRelationID(table.getSchemaName(), table.getName());
relations.add(relationId);
if (inSubSelect && subSelectAlias != null) {
// ONLY SIMPLE SUBSELECTS, WITH ONE TABLE: see WhereClauseVisitor and ProjectionVisitor
RelationID subSelectAliasId = idfac.createRelationID(null, subSelectAlias.getName());
tables.put(subSelectAliasId, relationId);
}
else {
Alias as = table.getAlias();
RelationID aliasId = (as != null) ? idfac.createRelationID(null, as.getName()) : relationId;
tables.put(aliasId, relationId);
}
}
}
代码示例来源:origin: diennea/herddb
private Statement buildTruncateStatement(String defaultTableSpace, Truncate truncate) throws StatementExecutionException {
if (truncate.getTable() == null) {
throw new StatementExecutionException("missing table name");
}
String tableSpace = truncate.getTable().getSchemaName();
if (tableSpace == null) {
tableSpace = defaultTableSpace;
}
String tableName = truncate.getTable().getName();
return new TruncateTableStatement(tableSpace, tableName);
}
代码示例来源:origin: diennea/herddb
static TableRef buildFrom(Table fromTable, String defaultTableSpace) {
String tableSpace = fromTable.getSchemaName();
String tableName = fromTable.getName();
String tableAlias = tableName;
if (fromTable.getAlias() != null && fromTable.getAlias().getName() != null) {
tableAlias = fromTable.getAlias().getName();
}
if (tableSpace == null) {
tableSpace = defaultTableSpace;
}
return new TableRef(tableSpace, tableName, tableAlias);
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core
@Override
public void visit(SelectExpressionItem selectExpressionItem) {
Expression expr = selectExpressionItem.getExpression();
QuotedID name = getSelectItemAliasedId(selectExpressionItem);
final Term var;
if (expr instanceof Column) {
Column column = (Column) expr;
QuotedID columnId = idfac.createAttributeID(column.getColumnName());
Table table = column.getTable();
RelationID tableId = (table == null || table.getName() == null)
? null : idfac.createRelationID(table.getSchemaName(), table.getName());
QualifiedAttributeID attr = new QualifiedAttributeID(tableId, columnId);
var = attributes.get(attr);
if (var == null)
throw new InvalidSelectQueryRuntimeException("Column not found", selectExpressionItem);
}
else {
// whether the complex expression has an alias already been checked
var = createVariable(name);
}
map = ImmutableMap.of(new QualifiedAttributeID(null, name), var);
}
}
代码示例来源:origin: ontop/ontop
@Override
public void visit(SelectExpressionItem selectExpressionItem) {
Expression expr = selectExpressionItem.getExpression();
QuotedID name = getSelectItemAliasedId(selectExpressionItem);
final Term var;
if (expr instanceof Column) {
Column column = (Column) expr;
QuotedID columnId = idfac.createAttributeID(column.getColumnName());
Table table = column.getTable();
RelationID tableId = (table == null || table.getName() == null)
? null : idfac.createRelationID(table.getSchemaName(), table.getName());
QualifiedAttributeID attr = new QualifiedAttributeID(tableId, columnId);
var = attributes.get(attr);
if (var == null)
throw new InvalidSelectQueryRuntimeException("Column not found", selectExpressionItem);
}
else {
// whether the complex expression has an alias already been checked
var = createVariable(name);
}
map = ImmutableMap.of(new QualifiedAttributeID(null, name), var);
}
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-core
private Term getVariable(Column expression) {
QuotedID column = idfac.createAttributeID(expression.getColumnName());
RelationID relation = null;
if (expression.getTable().getName() != null)
relation = idfac.createRelationID(expression.getTable().getSchemaName(), expression.getTable().getName());
QualifiedAttributeID qa = new QualifiedAttributeID(relation, column);
return lookupTable.get(qa);
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-core
public static void normalizeColumnName(QuotedIDFactory idfac, Column tableColumn) {
QuotedID columnName = idfac.createAttributeID(tableColumn.getColumnName());
tableColumn.setColumnName(columnName.getSQLRendering());
Table table = tableColumn.getTable();
RelationID tableName = idfac.createRelationID(table.getSchemaName(), table.getName());
table.setSchemaName(tableName.getSchemaSQLRendering());
table.setName(tableName.getTableNameSQLRendering());
}
代码示例来源:origin: ontop/ontop
@Override
public void visit(Table tableName) {
RelationID id = idfac.createRelationID(tableName.getSchemaName(), tableName.getName());
// construct the predicate using the table name
DatabaseRelationDefinition relation = metadata.getDatabaseRelation(id);
if (relation == null)
throw new InvalidSelectQueryRuntimeException("Table " + id + " not found in metadata", tableName);
relationIndex++;
RelationID alias = (tableName.getAlias() != null)
? idfac.createRelationID(null, tableName.getAlias().getName())
: relation.getID();
ImmutableMap<QuotedID, Term> attributes = relation.getAttributes().stream()
.collect(ImmutableCollectors.toMap(Attribute::getID,
attribute -> createVariable(attribute.getID())));
// DEFAULT SCHEMA
// TODO: to be improved
if ((tableName.getAlias() == null) &&
relation.getID().getSchemaName() != null &&
metadata.getDatabaseRelation(relation.getID().getSchemalessID()).equals(relation))
result = RAExpressionAttributes.create(attributes, alias, relation.getID().getSchemalessID());
else
result = RAExpressionAttributes.create(attributes, alias);
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-mapping-sql-core
@Override
public void visit(Table tableName) {
RelationID id = idfac.createRelationID(tableName.getSchemaName(), tableName.getName());
// construct the predicate using the table name
DatabaseRelationDefinition relation = metadata.getDatabaseRelation(id);
if (relation == null)
throw new InvalidSelectQueryRuntimeException("Table " + id + " not found in metadata", tableName);
relationIndex++;
RelationID alias = (tableName.getAlias() != null)
? idfac.createRelationID(null, tableName.getAlias().getName())
: relation.getID();
ImmutableMap<QuotedID, Term> attributes = relation.getAttributes().stream()
.collect(ImmutableCollectors.toMap(Attribute::getID,
attribute -> createVariable(attribute.getID())));
// DEFAULT SCHEMA
// TODO: to be improved
if ((tableName.getAlias() == null) &&
relation.getID().getSchemaName() != null &&
metadata.getDatabaseRelation(relation.getID().getSchemalessID()).equals(relation))
result = RAExpressionAttributes.create(attributes, alias, relation.getID().getSchemalessID());
else
result = RAExpressionAttributes.create(attributes, alias);
}
内容来源于网络,如有侵权,请联系作者删除!