• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SQLDeleteStatement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.alibaba.druid.sql.ast.statement.SQLDeleteStatement的典型用法代码示例。如果您正苦于以下问题:Java SQLDeleteStatement类的具体用法?Java SQLDeleteStatement怎么用?Java SQLDeleteStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SQLDeleteStatement类属于com.alibaba.druid.sql.ast.statement包,在下文中一共展示了SQLDeleteStatement类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: SQLDeleteBuilderImpl

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
public SQLDeleteBuilderImpl(String sql, String dbType){
    List<SQLStatement> stmtList = SQLUtils.parseStatements(sql, dbType);

    if (stmtList.size() == 0) {
        throw new IllegalArgumentException("not support empty-statement :" + sql);
    }

    if (stmtList.size() > 1) {
        throw new IllegalArgumentException("not support multi-statement :" + sql);
    }

    SQLDeleteStatement stmt = (SQLDeleteStatement) stmtList.get(0);
    this.stmt = stmt;
    this.dbType = dbType;
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:16,代码来源:SQLDeleteBuilderImpl.java


示例2: where

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
@Override
public SQLDeleteBuilder where(String expr) {
    SQLDeleteStatement delete = getSQLDeleteStatement();

    SQLExpr exprObj = SQLUtils.toSQLExpr(expr, dbType);
    delete.setWhere(exprObj);

    return this;
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:10,代码来源:SQLDeleteBuilderImpl.java


示例3: whereAnd

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
@Override
public SQLDeleteBuilder whereAnd(String expr) {
    SQLDeleteStatement delete = getSQLDeleteStatement();

    SQLExpr exprObj = SQLUtils.toSQLExpr(expr, dbType);
    SQLExpr newCondition = SQLUtils.buildCondition(SQLBinaryOperator.BooleanAnd, exprObj, false, delete.getWhere());
    delete.setWhere(newCondition);

    return this;
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:11,代码来源:SQLDeleteBuilderImpl.java


示例4: whereOr

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
@Override
public SQLDeleteBuilder whereOr(String expr) {
    SQLDeleteStatement delete = getSQLDeleteStatement();

    SQLExpr exprObj = SQLUtils.toSQLExpr(expr, dbType);
    SQLExpr newCondition = SQLUtils.buildCondition(SQLBinaryOperator.BooleanOr, exprObj, false, delete.getWhere());
    delete.setWhere(newCondition);

    return this;
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:11,代码来源:SQLDeleteBuilderImpl.java


示例5: createSQLDeleteStatement

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
public SQLDeleteStatement createSQLDeleteStatement() {
    if (JdbcConstants.ORACLE.equals(dbType)) {
        return new OracleDeleteStatement();    
    }
    
    if (JdbcConstants.MYSQL.equals(dbType)) {
        return new MySqlDeleteStatement();    
    }
    
    if (JdbcConstants.POSTGRESQL.equals(dbType)) {
        return new PGDeleteStatement();    
    }
    
    return new SQLDeleteStatement();
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:16,代码来源:SQLDeleteBuilderImpl.java


示例6: create

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
/**
 * Create the compatible Query object
 * based on the SQL query.
 *
 * @param sql The SQL query.
 * @return Query object.
 */
public static QueryAction create(Client client, String sql) throws SqlParseException, SQLFeatureNotSupportedException {
	sql = sql.replaceAll("\n"," ");
       String firstWord = sql.substring(0, sql.indexOf(' '));
       switch (firstWord.toUpperCase()) {
		case "SELECT":
			SQLQueryExpr sqlExpr = (SQLQueryExpr) toSqlExpr(sql);
               if(isMulti(sqlExpr)){
                   MultiQuerySelect multiSelect = new SqlParser().parseMultiSelect((SQLUnionQuery) sqlExpr.getSubQuery().getQuery());
                   handleSubQueries(client,multiSelect.getFirstSelect());
                   handleSubQueries(client,multiSelect.getSecondSelect());
                   return new MultiQueryAction(client, multiSelect);
               }
               else if(isJoin(sqlExpr,sql)){
                   JoinSelect joinSelect = new SqlParser().parseJoinSelect(sqlExpr);
                   handleSubQueries(client, joinSelect.getFirstTable());
                   handleSubQueries(client, joinSelect.getSecondTable());
                   return ESJoinQueryActionFactory.createJoinAction(client, joinSelect);
               }
               else {
                   Select select = new SqlParser().parseSelect(sqlExpr);
                   handleSubQueries(client, select);
                   return handleSelect(client, select);
               }
		case "DELETE":
               SQLStatementParser parser = createSqlStatementParser(sql);
			SQLDeleteStatement deleteStatement = parser.parseDeleteStatement();
			Delete delete = new SqlParser().parseDelete(deleteStatement);
			return new DeleteQueryAction(client, delete);
           case "SHOW":
               return new ShowQueryAction(client,sql);
		default:
			throw new SQLFeatureNotSupportedException(String.format("Unsupported query: %s", sql));
	}
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:42,代码来源:ESActionFactory.java


示例7: getType

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
@Override
public SqlType getType() {
    if (sqlStatement instanceof SQLSelectStatement)
        return SqlType.SELECT;
    if (sqlStatement instanceof SQLUpdateStatement) return SqlType.UPDATE;

    if (sqlStatement instanceof SQLInsertStatement)

        return SqlType.INSERT;
    if (sqlStatement instanceof SQLDeleteStatement)
        return SqlType.DELETE;
    return null;
}
 
开发者ID:maniaclee,项目名称:shardy,代码行数:14,代码来源:DruidSqlParser.java


示例8: getStatementType

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
public SQLStatementType getStatementType() {
    if (sqlStatement instanceof SQLSelectStatement) {
        return SQLStatementType.SELECT;
    }
    if (sqlStatement instanceof SQLInsertStatement) {
        return SQLStatementType.INSERT;
    }
    if (sqlStatement instanceof SQLUpdateStatement) {
        return SQLStatementType.UPDATE;
    }
    if (sqlStatement instanceof SQLDeleteStatement) {
        return SQLStatementType.DELETE;
    }
    throw new SQLParserException("Unsupported SQL statement: [%s]", sqlStatement);
}
 
开发者ID:balancebeam,项目名称:sherlock,代码行数:16,代码来源:SQLParseEngine.java


示例9: getSQLVisitor

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
private static SQLASTOutputVisitor getSQLVisitor(DatabaseType databaseType,SQLStatement sqlStatement) {
    if (sqlStatement instanceof SQLSelectStatement) {
        return ClassUtil.newInstance(SQLVisitorRegistry.getSelectVistor(databaseType));
    }
    if (sqlStatement instanceof SQLInsertStatement) {
        return ClassUtil.newInstance(SQLVisitorRegistry.getInsertVistor(databaseType));
    }
    if (sqlStatement instanceof SQLUpdateStatement) {
        return ClassUtil.newInstance(SQLVisitorRegistry.getUpdateVistor(databaseType));
    }
    if (sqlStatement instanceof SQLDeleteStatement) {
        return ClassUtil.newInstance(SQLVisitorRegistry.getDeleteVistor(databaseType));
    }
    throw new SQLParserException("Unsupported SQL statement: [%s]", sqlStatement);
}
 
开发者ID:balancebeam,项目名称:sherlock,代码行数:16,代码来源:SQLParserFactory.java


示例10: getOwnerTableName

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
/**
     * 从between语句中获取字段所属的表名。
     * 对于容易出现ambiguous的(字段不知道到底属于哪个表),实际应用中必须使用别名来避免歧义
     * @param betweenExpr
     * @param column
     * @return
     */
    private String getOwnerTableName(SQLBetweenExpr betweenExpr,String column) {
        if(tableStats.size() == 1) {//只有一个表,直接返回这一个表名
            return tableStats.keySet().iterator().next().getName();
        } else if(tableStats.size() == 0) {//一个表都没有,返回空串
            return "";
        } else {//多个表名
            for (Column col : columns.keySet())
            {
                if(col.getName().equals(column)) {
                    return col.getTable();
                }
            }
//            for(Column col : columns) {//从columns中找表名
//                if(col.getName().equals(column)) {
//                    return col.getTable();
//                }
//            }

            //前面没找到表名的,自己从parent中解析

            SQLObject parent = betweenExpr.getParent();
            if(parent instanceof SQLBinaryOpExpr)
            {
                parent=parent.getParent();
            }

            if(parent instanceof MySqlSelectQueryBlock) {
                MySqlSelectQueryBlock select = (MySqlSelectQueryBlock) parent;
                if(select.getFrom() instanceof SQLJoinTableSource) {//多表连接
                    SQLJoinTableSource joinTableSource = (SQLJoinTableSource)select.getFrom();
                    return joinTableSource.getLeft().toString();//将left作为主表,此处有不严谨处,但也是实在没有办法,如果要准确,字段前带表名或者表的别名即可
                } else if(select.getFrom() instanceof SQLExprTableSource) {//单表
                    return select.getFrom().toString();
                }
            }
            else if(parent instanceof SQLUpdateStatement) {
                SQLUpdateStatement update = (SQLUpdateStatement) parent;
                return update.getTableName().getSimpleName();
            } else if(parent instanceof SQLDeleteStatement) {
                SQLDeleteStatement delete = (SQLDeleteStatement) parent;
                return delete.getTableName().getSimpleName();
            } else {
                
            }
        }
        return "";
    }
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:55,代码来源:MycatSchemaStatVisitor.java


示例11: getSQLDeleteStatement

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
public SQLDeleteStatement getSQLDeleteStatement() {
    if (stmt == null) {
        stmt = createSQLDeleteStatement();
    }
    return stmt;
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:7,代码来源:SQLDeleteBuilderImpl.java


示例12: WhereParser

import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement; //导入依赖的package包/类
public WhereParser(SqlParser sqlParser, SQLDeleteStatement delete) {
    this.sqlParser = sqlParser;
    this.delete = delete;
    this.where = delete.getWhere();
}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:6,代码来源:WhereParser.java



注:本文中的com.alibaba.druid.sql.ast.statement.SQLDeleteStatement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EMOptions类代码示例发布时间:2022-05-22
下一篇:
Java CompactionState类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap