当前位置: 首页>>代码示例>>Java>>正文


Java Delete.getWhere方法代码示例

本文整理汇总了Java中net.sf.jsqlparser.statement.delete.Delete.getWhere方法的典型用法代码示例。如果您正苦于以下问题:Java Delete.getWhere方法的具体用法?Java Delete.getWhere怎么用?Java Delete.getWhere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jsqlparser.statement.delete.Delete的用法示例。


在下文中一共展示了Delete.getWhere方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDeleteMutation

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
private Mutation createDeleteMutation(Delete delete, boolean generateParameterMetaData) throws SQLException
{
	String table = unquoteIdentifier(delete.getTable().getFullyQualifiedName());
	getParameterStore().setTable(table);
	Expression where = delete.getWhere();
	if (where == null)
	{
		// Delete all
		return Mutation.delete(table, KeySet.all());
	}
	else
	{
		// Delete one
		DeleteKeyBuilder keyBuilder = new DeleteKeyBuilder(getConnection().getTable(table),
				generateParameterMetaData);
		visitDeleteWhereClause(where, keyBuilder, generateParameterMetaData);
		return Mutation.delete(table, keyBuilder.getKeyBuilder().build());
	}
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:20,代码来源:CloudSpannerPreparedStatement.java

示例2: parse

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
public Set<String> parse(Delete delete) {
	
	Set<String> tableSet = new HashSet<String>();
	
	if (delete != null) {
		Table table = delete.getTable();
		if (table != null) {
			tableSet.add(table.getName());
		}
		
		Expression expression = delete.getWhere();
		if (expression != null) {
			tableSet.addAll(parseExpression(expression));
		}
	}
	return tableSet;
}
 
开发者ID:PinaeOS,项目名称:timon,代码行数:18,代码来源:DeleteParser.java

示例3: deParse

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
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());
	}

}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:33,代码来源:DeleteDeParser.java

示例4: visit

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
@Override
public void visit(Delete delete) {
    tables.add(delete.getTable().getName());
    if (delete.getWhere() != null) {
        delete.getWhere().accept(this);
    }
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:8,代码来源:TablesNamesFinder.java

示例5: visit

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
@Override
public void visit(Delete delete) {
    tables.add(delete.getTable(), table -> table.getName());
    if (delete.getWhere() != null) {
        delete.getWhere().accept(this);
    }
}
 
开发者ID:justice-code,项目名称:QiuQiu,代码行数:8,代码来源:ReplaceTablesNamesFinder.java

示例6: buildDeleteStatement

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
private ExecutionPlan buildDeleteStatement(String defaultTableSpace, Delete s, boolean returnValues) throws StatementExecutionException {
    net.sf.jsqlparser.schema.Table fromTable = s.getTable();
    String tableSpace = fromTable.getSchemaName();
    String tableName = fromTable.getName();
    if (tableSpace == null) {
        tableSpace = defaultTableSpace;
    }
    TableSpaceManager tableSpaceManager = manager.getTableSpaceManager(tableSpace);
    if (tableSpaceManager == null) {
        throw new StatementExecutionException("no such tablespace " + tableSpace + " here at " + manager.getNodeId());
    }
    AbstractTableManager tableManager = tableSpaceManager.getTableManager(tableName);
    if (tableManager == null) {
        throw new StatementExecutionException("no such table " + tableName + " in tablespace " + tableSpace);
    }
    Table table = tableManager.getTable();

    // Perform a scan and then delete each row
    SQLRecordPredicate where = s.getWhere() != null ? new SQLRecordPredicate(table, table.name, s.getWhere()) : null;
    if (where != null) {
        Expression expressionWhere = s.getWhere();
        discoverIndexOperations(expressionWhere, table, table.name, where, tableSpaceManager);
    }

    DMLStatement st = new DeleteStatement(tableSpace, tableName, null, where).setReturnValues(returnValues);
    return ExecutionPlan.simple(st);

}
 
开发者ID:diennea,项目名称:herddb,代码行数:29,代码来源:SQLPlanner.java

示例7: visit

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:diennea,项目名称:herddb,代码行数:13,代码来源:JdbcQueryRewriter.java

示例8: visit

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
@Override
public void visit(Delete delete)
{
	delete.getTable().accept(this);
    if (delete.getWhere() != null)
    {
        delete.getWhere().accept(this);
    }
}
 
开发者ID:sogou-biztech,项目名称:compass,代码行数:10,代码来源:TableRenameVisitor.java

示例9: deParse

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
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() : "");
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:12,代码来源:DeleteDeParser.java

示例10: parseTypeSpecific

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
@Override
protected void parseTypeSpecific() throws NoSuchTableException {
	Delete delete = (Delete) statement;
	MetaRepo repo = MetaRepo.getInstance();
	
	String tableName = delete.getTable().getName();
	table = repo.getDB().getTable(tableName);
	
	objectDelete = (delete.getWhere() instanceof JdbcParameter);
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:11,代码来源:DeleteQueryParser.java

示例11: createMutations

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
private Mutations createMutations(String sql, boolean forceUpdate, boolean generateParameterMetaData)
		throws SQLException
{
	try
	{
		if (getConnection().isReadOnly())
		{
			throw new CloudSpannerSQLException("The connection is in read-only mode. Mutations are not allowed.",
					Code.FAILED_PRECONDITION);
		}
		if (isDDLStatement())
		{
			throw new CloudSpannerSQLException(
					"Cannot create mutation for DDL statement. Expected INSERT, UPDATE or DELETE",
					Code.INVALID_ARGUMENT);
		}
		Statement statement = CCJSqlParserUtil.parse(sanitizeSQL(sql));
		if (statement instanceof Insert)
		{
			Insert insertStatement = (Insert) statement;
			if (generateParameterMetaData || insertStatement.getSelect() == null)
				return new Mutations(createInsertMutation(insertStatement, generateParameterMetaData));
			return new Mutations(createInsertWithSelectStatement(insertStatement, forceUpdate));
		}
		else if (statement instanceof Update)
		{
			Update updateStatement = (Update) statement;
			if (updateStatement.getSelect() != null)
				throw new CloudSpannerSQLException(
						"UPDATE statement using SELECT is not supported. Try to re-write the statement as an INSERT INTO ... SELECT A, B, C FROM TABLE WHERE ... ON DUPLICATE KEY UPDATE",
						Code.INVALID_ARGUMENT);
			if (updateStatement.getTables().size() > 1)
				throw new CloudSpannerSQLException(
						"UPDATE statement using multiple tables is not supported. Try to re-write the statement as an INSERT INTO ... SELECT A, B, C FROM TABLE WHERE ... ON DUPLICATE KEY UPDATE",
						Code.INVALID_ARGUMENT);

			if (generateParameterMetaData || isSingleRowWhereClause(
					getConnection().getTable(unquoteIdentifier(updateStatement.getTables().get(0).getName())),
					updateStatement.getWhere()))
				return new Mutations(createUpdateMutation(updateStatement, generateParameterMetaData));
			// Translate into an 'INSERT ... SELECT ... ON DUPLICATE KEY
			// UPDATE'-statement
			String insertSQL = createInsertSelectOnDuplicateKeyUpdateStatement(updateStatement);
			return createMutations(insertSQL, true, false);
		}
		else if (statement instanceof Delete)
		{
			Delete deleteStatement = (Delete) statement;
			if (generateParameterMetaData || deleteStatement.getWhere() == null
					|| isSingleRowWhereClause(
							getConnection().getTable(unquoteIdentifier(deleteStatement.getTable().getName())),
							deleteStatement.getWhere()))
				return new Mutations(createDeleteMutation(deleteStatement, generateParameterMetaData));
			return new Mutations(createDeleteWorker(deleteStatement));
		}
		else
		{
			throw new CloudSpannerSQLException(
					"Unrecognized or unsupported SQL-statment: Expected one of INSERT, UPDATE or DELETE. Please note that batching of prepared statements is not supported for SELECT-statements.",
					Code.INVALID_ARGUMENT);
		}
	}
	catch (JSQLParserException | IllegalArgumentException | TokenMgrError e)
	{
		throw new CloudSpannerSQLException(PARSE_ERROR + sql + ": " + e.getLocalizedMessage(),
				Code.INVALID_ARGUMENT, e);
	}
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:69,代码来源:CloudSpannerPreparedStatement.java

示例12: visit

import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
@Override
public void visit(Delete delete) {
    if (delete.getWhere() != null) {
        delete.getWhere().accept(this);
    }
}
 
开发者ID:hellojavaer,项目名称:ddal,代码行数:7,代码来源:JSQLBaseVisitor.java


注:本文中的net.sf.jsqlparser.statement.delete.Delete.getWhere方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。