本文整理了Java中net.sf.jsqlparser.schema.Table
类的一些代码示例,展示了Table
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table
类的具体详情如下:
包路径:net.sf.jsqlparser.schema.Table
类名称:Table
[英]A table. It can have an alias and the schema name it belongs to.
[中]一张桌子。它可以有别名和它所属的架构名称。
代码示例来源:origin: baomidou/mybatis-plus
Expression rightExpression = ((BinaryExpression) expression).getRightExpression();
if (joinTable != null && rightExpression instanceof Column) {
if (Objects.equals(((Column) rightExpression).getTable().getName(), table.getAlias().getName())) {
validUseIndex(table, ((Column) rightExpression).getColumnName(), connection);
validUseIndex(joinTable, ((Column) leftExpression).getColumnName(), connection);
} else {
validUseIndex(joinTable, ((Column) rightExpression).getColumnName(), connection);
代码示例来源:origin: alibaba/mdrill
Table table = null;
if (name3 != null) {
table = new Table(name1, name2);
colName = name3;
} else if (name2 != null) {
table = new Table(null, name1);
colName = name2;
} else {
table = new Table(null, null);
colName = name1;
{if (true) return new Column(table, colName);}
throw new Error("Missing return statement in function");
代码示例来源:origin: JSQLParser/JSqlParser
@Override
public void visit(Column tableColumn) {
final Table table = tableColumn.getTable();
String tableName = null;
if (table != null) {
if (table.getAlias() != null) {
tableName = table.getAlias().getName();
} else {
tableName = table.getFullyQualifiedName();
}
}
if (tableName != null && !tableName.isEmpty()) {
buffer.append(tableName).append(".");
}
buffer.append(tableColumn.getColumnName());
}
代码示例来源:origin: alibaba/mdrill
public void visit(Table tableName) {
buffer.append(tableName.getWholeTableName());
String alias = tableName.getAlias();
if (alias != null && !alias.equals("")) {
buffer.append(" AS " + alias);
}
}
代码示例来源:origin: JSQLParser/JSqlParser
@Override
public void visit(Table tableName) {
buffer.append(tableName.getFullyQualifiedName());
Alias alias = tableName.getAlias();
if (alias != null) {
buffer.append(alias);
}
Pivot pivot = tableName.getPivot();
if (pivot != null) {
pivot.accept(this);
}
MySQLIndexHint indexHint = tableName.getIndexHint();
if (indexHint != null) {
buffer.append(indexHint);
}
}
代码示例来源: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: geotools/geotools
public static Column qualify(
ISession session, Map<String, Object> tableAliases, Column column) {
Table table = column.getTable();
String columnName = column.getColumnName();
Table unaliasedTable = (Table) tableAliases.get(table.getName());
Table qualifiedTable;
if (unaliasedTable == null) {
// not an aliased table, qualify it
qualifiedTable = TableQualifier.qualify(session, table);
} else {
// AllTableColumns is refering to an aliased table in the FROM
// clause,
// replace its table by the original one to get rid of the alias
qualifiedTable = unaliasedTable;
}
Column qualifiedColumn = new Column();
qualifiedColumn.setColumnName(columnName);
qualifiedColumn.setTable(qualifiedTable);
return qualifiedColumn;
}
}
代码示例来源:origin: geotools/geotools
final Table qualifiedTable = new Table();
final String databaseName;
final String userName;
qualifiedTable.setName(table.getName());
qualifiedTable.setAlias(table.getAlias());
qualifiedTable.setSchemaName(qualifiedSchema.toUpperCase());
代码示例来源: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: baomidou/mybatis-plus
/**
* 租户字段别名设置
* <p>tableName.tenantId 或 tableAlias.tenantId</p>
*
* @param table 表对象
* @return 字段
*/
protected Column getAliasColumn(Table table) {
StringBuilder column = new StringBuilder();
if (null == table.getAlias()) {
column.append(table.getName());
} else {
column.append(table.getAlias().getName());
}
column.append(StringPool.DOT);
column.append(tenantHandler.getTenantIdColumn());
return new Column(column.toString());
}
}
代码示例来源:origin: JSQLParser/JSqlParser
@Override
public void visit(Column tableColumn) {
if (allowColumnProcessing && tableColumn.getTable() != null && tableColumn.getTable().getName() != null) {
visit(tableColumn.getTable());
}
}
代码示例来源:origin: pagehelper/Mybatis-PageHelper
allColumnsTables.add(((AllTableColumns) item).getTable().getName());
((Column) expression).setTable(null);
String table = ((Column) expression).getTable().getName();
if (table == null) { // 表名为空
if (allColumns ||
(allColumnsTables.size() == 1 && plainSelect.getJoins() == null) ||
aliases.contains(((Column) expression).getColumnName())) {
代码示例来源: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: it.unibz.inf.ontop/ontop-obdalib-core
@Override
public void visit(Table table) {
//obtain the column names from the metadata
RelationID tableID = idfac.createRelationID(table.getSchemaName(), table.getName());
RelationDefinition tableDefinition = metadata.getRelation(tableID);
if (tableDefinition == null)
throw new RuntimeException("Definition not found for table '" + table + "'.");
Table tableName;
if (aliasSubselect != null)
tableName = new Table(aliasSubselect);
else if (table.getAlias() != null) //use the alias if present
tableName = new Table(table.getAlias().getName());
else
tableName = table;
for (Attribute att : tableDefinition.getAttributes()) {
// ROMAN (9 Oct 2015)
// the unquoted name is used for comparisons
Column columnNameUnquoted = new Column(tableName, att.getID().getSQLRendering());
if (variables.contains(columnNameUnquoted.getFullyQualifiedName(), att.getID().getName())) {
// properly quoted name if necessary
Column columnName = new Column(tableName, att.getID().getSQLRendering());
columns.add(new SelectExpressionItem(columnName));
}
}
}
代码示例来源: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: com.intoverflow.booster/booster-core
@Override
public void visit(Column column) {
Table table = column.getTable();
if (table == null || StringUtils.isBlank(table.getName())) {
Table t = new Table(tableName);
if (tableAlias != null) {
t.setAlias(new Alias(tableAlias, false));
}
column.setTable(t);
}
}
});
代码示例来源:origin: com.intoverflow.booster/booster-core
@Override
public void visit(Column column) {
net.sf.jsqlparser.schema.Table table = column.getTable();
if (table == null) {
table = new net.sf.jsqlparser.schema.Table(mainAlias);
column.setTable(table);
} else {
if (StringUtils.isBlank(table.getName())) {
table.setName(mainAlias);
}
}
}
});
代码示例来源:origin: com.eas.platypus/platypus-js-sql-parser
public void visit(Column tableColumn) {
buffer.append(tableColumn.getComment() != null ? tableColumn.getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "");
if (tableColumn.getTable().getName() != null) {
String tableName = tableColumn.getTable().getWholeTableName();
buffer.append(tableName).append(".");
}
buffer.append(tableColumn.getColumnName());
}
代码示例来源: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: geotools/geotools
Table unaliasedTable = (Table) tableAliases.get(qt.getName());
String tableName = qt.getSchemaName() + "." + qt.getName();
SeColumnDefinition[] cols;
try {
String colName = cols[i].getName();
Column column = new Column();
column.setTable(qt);
column.setColumnName(colName);
内容来源于网络,如有侵权,请联系作者删除!