예제 #1
0
 private RouteResultset routeSelect(
     SchemaConfig schema,
     QueryTreeNode ast,
     RouteResultset rrs,
     String stmt,
     LayerCachePool cachePool)
     throws SQLNonTransientException {
   ResultSetNode rsNode = ((CursorNode) ast).getResultSetNode();
   if (rsNode instanceof SelectNode) {
     if (((SelectNode) rsNode).getFromList().isEmpty()) {
       // if it is a sql about system info, such as select charset etc.
       return RouterUtil.routeToSingleNode(rrs, schema.getRandomDataNode(), stmt);
     }
   }
   // standard SELECT operation
   SelectParseInf parsInf = new SelectParseInf();
   parsInf.ctx = new ShardingParseInfo();
   SelectSQLAnalyser.analyse(parsInf, ast);
   return tryRouteForTables(ast, true, rrs, schema, parsInf.ctx, stmt, cachePool);
 }