Package com.skyline.energy.dataaccess.jdbc

Examples of com.skyline.energy.dataaccess.jdbc.SqlExecuteContext


      return null;
    }
  }
 
  private boolean canUseOld(DataSource txDataSource) {
    SqlExecuteContext sqlContext = SqlExecuteContextHolder.getContext();
    if(sqlContext.getSqlType() == SqlType.UPDATE && txDataSource instanceof MasterDataSource) {
      return true;
    }
    return false;
  }
View Full Code Here


      return null;
    }
  }

  private boolean canUseOld(DataSource txDataSource) {
    SqlExecuteContext sqlContext = SqlExecuteContextHolder.getContext();
    NodeDataSource nodeDataSource = (NodeDataSource) txDataSource;
    if(nodeDataSource.getShard() == caculateShard(sqlContext.getShardParam())) {
      return true;
    }
    return false;
  }
View Full Code Here

    }
    throw new DataAccessException("can't parse return type of [" + componentType);
  }

  private void initContext(ShardDefinition definition, Object[] args, SqlType sqlType) {
    SqlExecuteContext context = new SqlExecuteContext();
    context.setSqlType(sqlType);
   
    Integer shardParamIndex = definition.getShardParamIndex();
    if(shardParamIndex != null) {
      Method shardGetter = definition.getShardGetter();
      String shardParamName = definition.getShardParamName();
      String shardTable = definition.getShardTable();
      Object value =CommonUtils.fetchVlaue(shardGetter, shardParamIndex, args, shardParamName);
      context.setShardParam(new ShardParam(shardTable, value));
    }
   
    SqlExecuteContextHolder.setContext(context);
  }
View Full Code Here

TOP

Related Classes of com.skyline.energy.dataaccess.jdbc.SqlExecuteContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.