本文整理了Java中net.sf.jsqlparser.statement.delete.Delete
类的一些代码示例,展示了Delete
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Delete
类的具体详情如下:
包路径:net.sf.jsqlparser.statement.delete.Delete
类名称:Delete
暂无
代码示例来源:origin: JSQLParser/JSqlParser
@Override
public void visit(Delete delete) {
visit(delete.getTable());
if (delete.getJoins() != null) {
for (Join join : delete.getJoins()) {
join.getRightItem().accept(this);
}
}
if (delete.getWhere() != null) {
delete.getWhere().accept(this);
}
}
代码示例来源:origin: baomidou/mybatis-plus
/**
* delete 语句处理
*/
@Override
public void processDelete(Delete delete) {
if (tenantHandler.doTableFilter(delete.getTable().getName())) {
// 过滤退出执行
return;
}
delete.setWhere(this.andExpression(delete.getTable(), delete.getWhere()));
}
代码示例来源:origin: JSQLParser/JSqlParser
final public Delete Delete() throws ParseException {Delete delete = new Delete();
Table table = null;
List<Table> tables = new ArrayList<Table>();
case K_WHERE:{
where = WhereClause();
delete.setWhere(where);
break;
case K_ORDER:{
orderByElements = OrderByElements();
delete.setOrderByElements(orderByElements);
break;
case K_LIMIT:{
limit = PlainLimit();
delete.setLimit(limit);
break;
delete.setTables(tables);
if (joins != null && joins.size() > 0)
delete.setJoins(joins);
delete.setTable(table);
return delete;
代码示例来源:origin: alibaba/mdrill
public void deParse(Delete delete) {
buffer.append("DELETE FROM " + delete.getTable().getWholeTableName());
if (delete.getWhere() != null) {
buffer.append(" WHERE ");
delete.getWhere().accept(expressionVisitor);
}
}
public ExpressionVisitor getExpressionVisitor() {
代码示例来源:origin: JSQLParser/JSqlParser
public void deParse(Delete delete) {
buffer.append("DELETE");
if (delete.getTables() != null && delete.getTables().size() > 0) {
for (Table table : delete.getTables()) {
buffer.append(" ").append(table.getFullyQualifiedName());
}
}
buffer.append(" FROM ").append(delete.getTable().toString());
if (delete.getJoins() != null) {
for (Join join : delete.getJoins()) {
if (join.isSimple()) {
buffer.append(", ").append(join);
} else {
buffer.append(" ").append(join);
}
}
}
if (delete.getWhere() != null) {
buffer.append(" WHERE ");
delete.getWhere().accept(expressionVisitor);
}
if (delete.getOrderByElements() != null) {
new OrderByDeParser(expressionVisitor, buffer).deParse(delete.getOrderByElements());
}
if (delete.getLimit() != null) {
new LimitDeparser(buffer).deParse(delete.getLimit());
}
}
代码示例来源:origin: codingapi/tx-lcn
if (delete.getTables().size() == 0) {
delete.setTables(Collections.singletonList(delete.getTable()));
List<String> tables = new ArrayList<>(delete.getTables().size());
List<String> primaryKeys = new ArrayList<>(3);
List<String> columns = new ArrayList<>();
for (Table table : delete.getTables()) {
TableStruct tableStruct = tableStructAnalyser.analyse(connection, table.getName());
tableStruct.getColumns().forEach((k, v) -> {
.setUnitId(unitId)
.setRollbackInfo(rollbackInfo)
.setSqlWhere(delete.getWhere().toString())
.setColumns(columns)
.setPrimaryKeys(primaryKeys)
代码示例来源:origin: com.eas.platypus/platypus-js-sql-parser
public void deParse(Delete aDelete) {
buffer
.append(aDelete.getComment() != null ? aDelete.getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "")
.append("Delete").append(aDelete.getFromComment() != null ? " " + aDelete.getFromComment() + ExpressionDeParser.LINE_SEPARATOR : "").append(" From ")
.append(aDelete.getTable().getComment() != null ? aDelete.getTable().getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append(aDelete.getTable().getWholeTableName());
if (aDelete.getWhere() != null) {
buffer.append(aDelete.getWhereComment() != null ? " " + aDelete.getWhereComment() : "").append(ExpressionDeParser.LINE_SEPARATOR).append(" Where ");
aDelete.getWhere().accept(expressionVisitor);
}
buffer.append(!"".equals(aDelete.getEndComment()) ? " " + aDelete.getEndComment() : "");
}
代码示例来源:origin: vincentrussell/sql-to-mongo-db-query-converter
public Builder setJSqlParser(CCJSqlParser jSqlParser) throws com.github.vincentrussell.query.mongodb.sql.converter.ParseException, ParseException {
final Statement statement = jSqlParser.Statement();
if (Select.class.isAssignableFrom(statement.getClass())) {
sqlCommandType = SQLCommandType.SELECT;
final PlainSelect plainSelect = (PlainSelect)(((Select)statement).getSelectBody());
SqlUtils.isTrue(plainSelect != null, "could not parseNaturalLanguageDate SELECT statement from query");
SqlUtils.isTrue(plainSelect.getFromItem()!=null,"could not find table to query. Only one simple table name is supported.");
whereClause = plainSelect.getWhere();
isDistinct = (plainSelect.getDistinct() != null);
isCountAll = SqlUtils.isCountAll(plainSelect.getSelectItems());
SqlUtils.isTrue(plainSelect.getFromItem() != null, "could not find table to query. Only one simple table name is supported.");
table = plainSelect.getFromItem().toString();
limit = SqlUtils.getLimit(plainSelect.getLimit());
orderByElements1 = plainSelect.getOrderByElements();
selectItems = plainSelect.getSelectItems();
joins = plainSelect.getJoins();
groupBys = SqlUtils.getGroupByColumnReferences(plainSelect);
SqlUtils.isTrue(plainSelect.getFromItem() != null, "could not find table to query. Only one simple table name is supported.");
} else if (Delete.class.isAssignableFrom(statement.getClass())) {
sqlCommandType = SQLCommandType.DELETE;
Delete delete = (Delete)statement;
SqlUtils.isTrue(delete.getTables().size() == 0, "there should only be on table specified for deletes");
table = delete.getTable().toString();
whereClause = delete.getWhere();
}
return this;
}
代码示例来源:origin: baomidou/mybatis-plus
@Override
public void processDelete(Delete delete) {
Assert.notNull(delete.getWhere(), "Prohibition of full table deletion");
}
代码示例来源:origin: diennea/herddb
@Override
public void visit(Delete s) {
visit(s.getTable());
if (s.getOrderByElements() != null) {
s.getOrderByElements().forEach(o -> {
o.accept(this);
});
}
if (s.getWhere() != null) {
s.getWhere().accept(this);
}
}
代码示例来源:origin: wxbty/meepo
public static List<String> name_delete_table(String sql) throws JSQLParserException {
net.sf.jsqlparser.statement.Statement statement = CCJSqlParserUtil.parse(sql);
Delete updateStatement = (Delete) statement;
Table update_table = updateStatement.getTable();
List<String> str_table = new ArrayList<>();
if (update_table != null) {
str_table.add(update_table.toString());
}
return str_table;
}
代码示例来源:origin: alibaba/mdrill
final public Delete Delete() throws ParseException {
Delete delete = new Delete();
Table table = null;
Expression where = null;
jj_consume_token(K_DELETE);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case K_FROM:
jj_consume_token(K_FROM);
break;
default:
jj_la1[15] = jj_gen;
;
}
table = TableWithAlias();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case K_WHERE:
where = WhereClause();
delete.setWhere(where);
break;
default:
jj_la1[16] = jj_gen;
;
}
delete.setTable(table);
{if (true) return delete;}
throw new Error("Missing return statement in function");
}
代码示例来源:origin: com.eas.platypus/platypus-js-sql-parser
final public Delete Delete() throws ParseException {Delete delete = new Delete();
Table table = null;
Alias alias = null;
delete.setComment(tk.specialToken.image);
tk = jj_consume_token(K_FROM);
if (tk.specialToken != null) {
delete.setFromComment(tk.specialToken.image);
tk = jj_consume_token(K_WHERE);
if (tk.specialToken != null) {
delete.setWhereComment(tk.specialToken.image);
delete.setWhere(where);
break;
delete.setTable(table);
{if ("" != null) return delete;}
throw new Error("Missing return statement in function");
代码示例来源:origin: diennea/herddb
public String getTableSpace(Statement statement) throws ScriptException {
String tableName = null;
if (statement instanceof Insert) {
Insert st = (Insert) statement;
tableName = st.getTable().getFullyQualifiedName();
} else if (statement instanceof Update) {
Update st = (Update) statement;
tableName = st.getTables().get(0).getFullyQualifiedName();
} else if (statement instanceof Delete) {
Delete st = (Delete) statement;
tableName = st.getTables().get(0).getFullyQualifiedName();
} else if (statement instanceof Truncate) {
Truncate st = (Truncate) statement;
tableName = st.getTable().getFullyQualifiedName();
} else if (statement instanceof Drop) {
Drop st = (Drop) statement;
tableName = st.getName().getFullyQualifiedName();
} else if (statement instanceof CreateTable) {
CreateTable st = (CreateTable) statement;
tableName = st.getTable().getFullyQualifiedName();
} else if (statement instanceof Alter) {
Alter st = (Alter) statement;
tableName = st.getTable().getFullyQualifiedName();
} else {
return null;
}
return mapTableNameToSchema(tableName);
}
代码示例来源:origin: com.github.jsqlparser/jsqlparser
public void deParse(Delete delete) {
buffer.append("DELETE");
if (delete.getTables() != null && delete.getTables().size() > 0) {
for (Table table : delete.getTables()) {
buffer.append(" ").append(table.getFullyQualifiedName());
}
}
buffer.append(" FROM ").append(delete.getTable().toString());
if (delete.getJoins() != null) {
for (Join join : delete.getJoins()) {
if (join.isSimple()) {
buffer.append(", ").append(join);
} else {
buffer.append(" ").append(join);
}
}
}
if (delete.getWhere() != null) {
buffer.append(" WHERE ");
delete.getWhere().accept(expressionVisitor);
}
if (delete.getOrderByElements() != null) {
new OrderByDeParser(expressionVisitor, buffer).deParse(delete.getOrderByElements());
}
if (delete.getLimit() != null) {
new LimitDeparser(buffer).deParse(delete.getLimit());
}
}
代码示例来源:origin: org.opencadc/cadc-jsqlparser-compat
public void deParse(Delete delete) {
buffer.append("DELETE FROM " + delete.getTable().getWholeTableName());
if (delete.getWhere() != null) {
buffer.append(" WHERE ");
delete.getWhere().accept(expressionVisitor);
}
}
public ExpressionVisitor getExpressionVisitor() {
代码示例来源:origin: baomidou/mybatis-plus
@Test
void deleteWhereParser() throws Exception {
Delete delete = (Delete) CCJSqlParserUtil.parse("delete from tableName t");
Assertions.assertNull(delete.getWhere());
}
}
代码示例来源:origin: Blazebit/blaze-persistence
} else if (statement instanceof Delete) {
Delete delete = (Delete) statement;
return Collections.singletonList(delete.getTable());
代码示例来源:origin: org.opencadc/cadc-jsqlparser-compat
final public Delete Delete() throws ParseException {Delete delete = new Delete();
Table table = null;
Expression where = null;
jj_consume_token(K_DELETE);
switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
case K_FROM:{
jj_consume_token(K_FROM);
break;
}
default:
jj_la1[15] = jj_gen;
;
}
table = TableWithAlias();
switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
case K_WHERE:{
where = WhereClause();
delete.setWhere(where);
break;
}
default:
jj_la1[16] = jj_gen;
;
}
delete.setTable(table);
{if ("" != null) return delete;}
throw new Error("Missing return statement in function");
}
代码示例来源:origin: baomidou/mybatis-plus
} else if (statement instanceof Delete) {
Delete delete = (Delete) statement;
where = delete.getWhere();
table = delete.getTable();
joins = delete.getJoins();
内容来源于网络,如有侵权,请联系作者删除!