com.alibaba.druid.sql.ast.expr.SQLLiteralExpr Java Examples
The following examples show how to use
com.alibaba.druid.sql.ast.expr.SQLLiteralExpr.
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: ServerLoadDataInfileHandler.java From Mycat2 with GNU General Public License v3.0 | 5 votes |
private RouteResultset buildResultSet(Map<String, LoadData> routeMap) { statement.setLocal(true);//强制local SQLLiteralExpr fn = new SQLCharExpr(fileName); //默认druid会过滤掉路径的分隔符,所以这里重新设置下 statement.setFileName(fn); String srcStatement = statement.toString(); RouteResultset rrs = new RouteResultset(srcStatement, ServerParse.LOAD_DATA_INFILE_SQL); rrs.setLoadData(true); rrs.setStatement(srcStatement); rrs.setAutocommit(serverConnection.isAutocommit()); rrs.setFinishedRoute(true); int size = routeMap.size(); RouteResultsetNode[] routeResultsetNodes = new RouteResultsetNode[size]; int index = 0; for (String dn : routeMap.keySet()) { RouteResultsetNode rrNode = new RouteResultsetNode(dn, ServerParse.LOAD_DATA_INFILE_SQL, srcStatement); rrNode.setSource(rrs); rrNode.setTotalNodeSize(size); rrNode.setStatement(srcStatement); LoadData newLoadData = new LoadData(); ObjectUtil.copyProperties(loadData, newLoadData); newLoadData.setLocal(true); LoadData loadData1 = routeMap.get(dn); // if (isHasStoreToFile) if (loadData1.getFileName()!=null)//此处判断是否有保存分库load的临时文件dn1.txt/dn2.txt,不是判断是否有clientTemp.txt { newLoadData.setFileName(loadData1.getFileName()); } else { newLoadData.setData(loadData1.getData()); } rrNode.setLoadData(newLoadData); routeResultsetNodes[index] = rrNode; index++; } rrs.setNodes(routeResultsetNodes); return rrs; }