当前位置: 首页>>代码示例>>Java>>正文


Java PreparedStatement.setConsistencyLevel方法代码示例

本文整理汇总了Java中com.datastax.driver.core.PreparedStatement.setConsistencyLevel方法的典型用法代码示例。如果您正苦于以下问题:Java PreparedStatement.setConsistencyLevel方法的具体用法?Java PreparedStatement.setConsistencyLevel怎么用?Java PreparedStatement.setConsistencyLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.datastax.driver.core.PreparedStatement的用法示例。


在下文中一共展示了PreparedStatement.setConsistencyLevel方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepare

import com.datastax.driver.core.PreparedStatement; //导入方法依赖的package包/类
/**
 * prepare
 * prepares param workerQuery if it's not already prepared
 * @param workerQuery
 * @throws Exception
 */
private void prepare (
  WorkerQuery workerQuery) throws Exception {
  
  if (this.preparedStatements.containsKey(
        workerQuery.getPreparedStatementString() ) == true) {
    
    return;
  }

  PreparedStatement preparedStatement =
    Cassandra.i().makePreparedStatementSync(
      workerQuery.getPreparedStatementString() );
  
  preparedStatement.setConsistencyLevel(workerQuery.getConsistencyLevel() );
  
  this.preparedStatements.put(
    workerQuery.getPreparedStatementString(),
    preparedStatement);
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:26,代码来源:WorkerExecutor.java

示例2: prepare

import com.datastax.driver.core.PreparedStatement; //导入方法依赖的package包/类
private PreparedStatement prepare(final String query) {
    PreparedStatement preStat = session.prepare(query);

    if (settings != null) {
        if (settings.getConsistency() != null) {
            preStat.setConsistencyLevel(settings.getConsistency());
        }

        if (settings.getSerialConsistency() != null) {
            preStat.setSerialConsistencyLevel(settings.getSerialConsistency());
        }

        if (settings.getRetryPolicy() != null) {
            preStat.setRetryPolicy(settings.getRetryPolicy());
        }

        if (settings.isTraceQuery()) {
            preStat.enableTracing();
        } else {
            preStat.disableTracing();
        }
    }

    return preStat;
}
 
开发者ID:landawn,项目名称:AbacusUtil,代码行数:26,代码来源:CassandraExecutor.java

示例3: SchemaStatement

import com.datastax.driver.core.PreparedStatement; //导入方法依赖的package包/类
public SchemaStatement(Timer timer, StressSettings settings, DataSpec spec,
                       PreparedStatement statement, Integer thriftId, ConsistencyLevel cl, ValidationType validationType)
{
    super(timer, settings, spec);
    this.statement = statement;
    this.thriftId = thriftId;
    this.cl = cl;
    this.validationType = validationType;
    argumentIndex = new int[statement.getVariables().size()];
    bindBuffer = new Object[argumentIndex.length];
    int i = 0;
    for (ColumnDefinitions.Definition definition : statement.getVariables())
        argumentIndex[i++] = spec.partitionGenerator.indexOf(definition.getName());

    statement.setConsistencyLevel(JavaDriverClient.from(cl));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:SchemaStatement.java

示例4: SchemaStatement

import com.datastax.driver.core.PreparedStatement; //导入方法依赖的package包/类
public SchemaStatement(Timer timer, StressSettings settings, DataSpec spec,
                       PreparedStatement statement, Integer thriftId, ConsistencyLevel cl)
{
    super(timer, settings, spec);
    this.statement = statement;
    this.thriftId = thriftId;
    this.cl = cl;
    argumentIndex = new int[statement.getVariables().size()];
    bindBuffer = new Object[argumentIndex.length];
    definitions = statement.getVariables();
    int i = 0;
    for (ColumnDefinitions.Definition definition : definitions)
        argumentIndex[i++] = spec.partitionGenerator.indexOf(definition.getName());

    statement.setConsistencyLevel(JavaDriverClient.from(cl));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:17,代码来源:SchemaStatement.java

示例5: prepareStatement

import com.datastax.driver.core.PreparedStatement; //导入方法依赖的package包/类
/**
 * Create and configure a Prepared CQL statement
 */
protected PreparedStatement prepareStatement(String cql) {
    PreparedStatement preparedStatement = getSessionHolder().getSession().prepare(cql);
    if (consistencyLevel != null) {
        preparedStatement.setConsistencyLevel(consistencyLevel);
    }
    return preparedStatement;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:CassandraEndpoint.java

示例6: setConsistencyLevel

import com.datastax.driver.core.PreparedStatement; //导入方法依赖的package包/类
public ReadyStatements setConsistencyLevel(ConsistencyLevel defaultConsistencyLevel) {
    for (ReadyStatement readyStatment: readyStatements) {
        PreparedStatement preparedStatement = readyStatment.getPreparedStatement();
        preparedStatement.setConsistencyLevel(defaultConsistencyLevel);
    }
    return this;
}
 
开发者ID:jshook,项目名称:testclient,代码行数:8,代码来源:ReadyStatements.java

示例7: load

import com.datastax.driver.core.PreparedStatement; //导入方法依赖的package包/类
@Override
public PreparedStatement load(String query) throws Exception {
	PreparedStatement stmt = session.prepare(query);
	stmt.setConsistencyLevel(readConsistencyLevel);
	if (tracingEnabled) {
		stmt.enableTracing();
	}
	return stmt;
}
 
开发者ID:WizeCommerce,项目名称:hecuba,代码行数:10,代码来源:DataStaxBasedSharedHecubaClientManager.java

示例8: visaOfferData

import com.datastax.driver.core.PreparedStatement; //导入方法依赖的package包/类
public void visaOfferData(List<VisaOffers> list,int batchsize){

		
		PreparedStatement ps = session.prepare(
				      "INSERT INTO emmd.visatable " +
				      "(org_id, alrt_id, alrt_bid_id,acct_fundg_src_cd,acct_fundg_src_subtyp_cd) " +
					     "VALUES (?, ?, ?,?,?);");
		ps.setConsistencyLevel(ConsistencyLevel.ONE);
		
		BatchStatement batch = new BatchStatement();
		
        StringBuilder sb = new StringBuilder("BEGIN BATCH \n");

      //  Profiler profiler = new Profiler();
        long count=list.size();
        int i =0;
        for (VisaOffers visa : list){
        	i++;
        	batch.add(ps.bind(visa.getAccountId(),visa.getAlertId(),visa.getMaxUpcId(),visa.getAcct_fundg_src_cd(),visa.getAcct_fundg_src_subtyp_cd()));
        	if(i%100000 ==0 )
    		{
    			System.out.println("Number of rows inserted so far..."+ i);
    		}
    		
        	if(i%batchsize ==0 ){
        		//System.out.println("Iteration"+ i);
        		//session.executeAsync(batch);
        		 ResultSet results = session.execute(batch);
        	      ExecutionInfo executionInfo = results.getExecutionInfo();
    			 // QueryTrace queryTrace = executionInfo.getQueryTrace();
    		 // System.out.println("Trace id: %s\n\n"+ "hosts"+  executionInfo.getQueriedHost()+"consistency"+ executionInfo.getAchievedConsistencyLevel());
        		batch.clear();
        	}
		}

		if (i%batchsize >0 ){

			session.execute(batch);
			//session.executeAsync(batch);
			batch.clear();
			sb=null;
		}
		
	}
 
开发者ID:manisrinivasan,项目名称:VAlert,代码行数:45,代码来源:VisaDao.java


注:本文中的com.datastax.driver.core.PreparedStatement.setConsistencyLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。