本文整理汇总了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());
}
}
示例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;
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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() : "");
}
示例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);
}
示例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);
}
}
示例12: visit
import net.sf.jsqlparser.statement.delete.Delete; //导入方法依赖的package包/类
@Override
public void visit(Delete delete) {
if (delete.getWhere() != null) {
delete.getWhere().accept(this);
}
}