@Override public SQLName getReferencedTableName() { if (referencedTable == null) { return null; } return referencedTable.getName(); }
public SQLName getTableName() { if (tableSource instanceof SQLExprTableSource) { return ((SQLExprTableSource) tableSource).getName(); } if (tableSource instanceof SQLJoinTableSource) { SQLTableSource left = ((SQLJoinTableSource) tableSource).getLeft(); if (left instanceof SQLExprTableSource) { return ((SQLExprTableSource) left).getName(); } } return null; }
boolean acceptDropTable(SQLDropTableStatement x) { for (SQLExprTableSource table : x.getTableSources()) { String schemaName = table.getSchema(); Schema schema = findSchema(schemaName, false); if (schema == null) { continue; } long nameHashCode64 = table.getName().nameHashCode64(); schema.objects.remove(nameHashCode64); } return true; }
boolean acceptDropIndex(SQLDropIndexStatement x) { SQLName table = x.getTableName().getName(); SchemaObject object = findTable(table); if (object != null) { SQLCreateTableStatement stmt = (SQLCreateTableStatement) object.getStatement(); if (stmt != null) { stmt.apply(x); return true; } } return false; }
private void statAllColumn(SQLAllColumnExpr x, SQLExprTableSource tableSource) { SQLExprTableSource exprTableSource = tableSource; SQLName expr = exprTableSource.getName();
@Override public SQLName getReferencedTableName() { if (referencedTable == null) { return null; } return referencedTable.getName(); }
public boolean visit(SQLUpdateStatement x) { if (repository != null && x.getParent() == null) { repository.resolve(x); } setMode(x, Mode.Update); SQLTableSource tableSource = x.getTableSource(); if (tableSource instanceof SQLExprTableSource) { SQLName identName = ((SQLExprTableSource) tableSource).getName(); TableStat stat = getTableStat(identName); stat.incrementUpdateCount(); } else { tableSource.accept(this); } accept(x.getFrom()); accept(x.getItems()); accept(x.getWhere()); return false; }
SchemaObject tableObject = null; SQLName name = like.getName(); if (name != null) { tableObject = findTable(name);
public boolean apply(SQLCommentStatement x) { SQLName on = x.getOn().getName(); SQLExpr comment = x.getComment(); if (comment == null) { return false; } SQLCommentStatement.Type type = x.getType(); if (type == SQLCommentStatement.Type.TABLE) { if (!SQLUtils.nameEquals(getName(), on)) { return false; } setComment(comment.clone()); return true; } else if (type == SQLCommentStatement.Type.COLUMN) { SQLPropertyExpr propertyExpr = (SQLPropertyExpr) on; if (!SQLUtils.nameEquals(getName(), (SQLName) propertyExpr.getOwner())) { return false; } SQLColumnDefinition column = this.findColumn( propertyExpr.nameHashCode64()); if (column != null) { column.setComment(comment.clone()); } return true; } return false; }
public SQLName getTableName() { if (tableSource instanceof SQLExprTableSource) { return ((SQLExprTableSource) tableSource).getName(); } if (tableSource instanceof SQLJoinTableSource) { SQLTableSource left = ((SQLJoinTableSource) tableSource).getLeft(); if (left instanceof SQLExprTableSource) { return ((SQLExprTableSource) left).getName(); } } return null; }
SQLName tableName = table.getName();
boolean acceptDropTable(SQLDropTableStatement x) { for (SQLExprTableSource table : x.getTableSources()) { String schemaName = table.getSchema(); Schema schema = findSchema(schemaName, false); if (schema == null) { continue; } long nameHashCode64 = table.getName().nameHashCode64(); schema.objects.remove(nameHashCode64); } return true; }
boolean acceptDropIndex(SQLDropIndexStatement x) { SQLName table = x.getTableName().getName(); SchemaObject object = findTable(table); if (object != null) { SQLCreateTableStatement stmt = (SQLCreateTableStatement) object.getStatement(); if (stmt != null) { stmt.apply(x); return true; } } return false; }
private void statAllColumn(SQLAllColumnExpr x, SQLExprTableSource tableSource) { SQLExprTableSource exprTableSource = tableSource; SQLName expr = exprTableSource.getName();
public boolean visit(SQLUpdateStatement x) { if (repository != null && x.getParent() == null) { repository.resolve(x); } setMode(x, Mode.Update); SQLTableSource tableSource = x.getTableSource(); if (tableSource instanceof SQLExprTableSource) { SQLName identName = ((SQLExprTableSource) tableSource).getName(); TableStat stat = getTableStat(identName); stat.incrementUpdateCount(); } else { tableSource.accept(this); } accept(x.getFrom()); accept(x.getItems()); accept(x.getWhere()); return false; }
public boolean apply(SQLCommentStatement x) { SQLName on = x.getOn().getName(); SQLExpr comment = x.getComment(); if (comment == null) { return false; } SQLCommentStatement.Type type = x.getType(); if (type == SQLCommentStatement.Type.TABLE) { if (!SQLUtils.nameEquals(getName(), on)) { return false; } setComment(comment.clone()); return true; } else if (type == SQLCommentStatement.Type.COLUMN) { SQLPropertyExpr propertyExpr = (SQLPropertyExpr) on; if (!SQLUtils.nameEquals(getName(), (SQLName) propertyExpr.getOwner())) { return false; } SQLColumnDefinition column = this.findColumn( propertyExpr.nameHashCode64()); if (column != null) { column.setComment(comment.clone()); } return true; } return false; }
SchemaObject tableObject = null; SQLName name = like.getName(); if (name != null) { tableObject = findTable(name);
SQLName tableName = table.getName();
private void addTableAlias(SQLTableSource from, SQLIdentifierExpr expr) { if (StringUtils.isNotEmpty(from.getAlias())) { addTableAlias(from.getAlias(), expr); } else if (from instanceof SQLExprTableSource) { addTableAlias(((SQLExprTableSource) from).getName().getSimpleName(), expr); } }
private void parseMerge(SQLMergeStatement mergeStatement) { val into = mergeStatement.getInto(); if (into instanceof SQLExprTableSource) { val exprInto = (SQLExprTableSource) into; addTableAlias(into.getAlias(), exprInto.getName().getSimpleName()); } mergeStatement.getOn().accept(getAdapter()); val updateClause = mergeStatement.getUpdateClause(); if (updateClause != null) { val items = updateClause.getItems(); walkUpdateItems(items); } val insertClause = mergeStatement.getInsertClause(); if (insertClause != null) { val secureFieldsIndices = walkInsertColumns(insertClause.getColumns()); walkInsertValues(secureFieldsIndices, insertClause.getValues()); } }