Java Code Examples for com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlInsertStatement#getQuery()
The following examples show how to use
com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlInsertStatement#getQuery() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DruidInsertParser.java From dble with GNU General Public License v2.0 | 6 votes |
private boolean parserNoSharding(ServerConnection sc, String contextSchema, SchemaInfo schemaInfo, RouteResultset rrs, MySqlInsertStatement insert) throws SQLException { String noShardingNode = RouterUtil.isNoSharding(schemaInfo.getSchemaConfig(), schemaInfo.getTable()); if (noShardingNode != null) { // table with single datanode and has autoIncrement property TableConfig tbConfig = schemaInfo.getSchemaConfig().getTables().get(schemaInfo.getTable()); if (tbConfig != null && tbConfig.isAutoIncrement()) { return false; } StringPtr noShardingNodePr = new StringPtr(noShardingNode); Set<String> schemas = new HashSet<>(); if (insert.getQuery() != null) { SQLSelectStatement selectStmt = new SQLSelectStatement(insert.getQuery()); if (!SchemaUtil.isNoSharding(sc, insert.getQuery().getQuery(), insert, selectStmt, contextSchema, schemas, noShardingNodePr)) { return false; } } routeToNoSharding(schemaInfo.getSchemaConfig(), rrs, schemas, noShardingNodePr); return true; } return false; }
Example 2
Source File: DruidInsertParser.java From Mycat2 with GNU General Public License v3.0 | 2 votes |
/** * 是否为批量插入:insert into ...values (),()...或 insert into ...select..... * @param insertStmt * @return */ private boolean isMultiInsert(MySqlInsertStatement insertStmt) { return (insertStmt.getValuesList() != null && insertStmt.getValuesList().size() > 1) || insertStmt.getQuery() != null; }
Example 3
Source File: RouterUtil.java From Mycat2 with GNU General Public License v3.0 | 2 votes |
/** * 是否为批量插入:insert into ...values (),()...或 insert into ...select..... * * @param insertStmt * @return */ private static boolean isMultiInsert(MySqlInsertStatement insertStmt) { return (insertStmt.getValuesList() != null && insertStmt.getValuesList().size() > 1) || insertStmt.getQuery() != null; }
Example 4
Source File: MySqlInsertParser.java From baymax with Apache License 2.0 | 2 votes |
/** * 是否为批量插入:insert into ...values (),()...或 insert into ...select..... * @param insertStmt * @return */ private boolean isMultiInsert(MySqlInsertStatement insertStmt) { return (insertStmt.getValuesList() != null && insertStmt.getValuesList().size() > 1) || insertStmt.getQuery() != null; }