當前位置: 首頁>>代碼示例>>Java>>正文


Java BoundStatement類代碼示例

本文整理匯總了Java中com.datastax.driver.core.BoundStatement的典型用法代碼示例。如果您正苦於以下問題:Java BoundStatement類的具體用法?Java BoundStatement怎麽用?Java BoundStatement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BoundStatement類屬於com.datastax.driver.core包,在下文中一共展示了BoundStatement類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPropertiesValueById

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
@Override
public Response getPropertiesValueById(String keyspaceName, String tableName, String id,
    String... properties) {
  long startTime = System.currentTimeMillis();
  ProjectLogger.log("Cassandra Service getPropertiesValueById method started at ==" + startTime,
      LoggerEnum.PERF_LOG);
  Response response = new Response();
  try {
    String selectQuery = CassandraUtil.getSelectStatement(keyspaceName, tableName, properties);
    PreparedStatement statement = connectionManager.getSession(keyspaceName).prepare(selectQuery);
    BoundStatement boundStatement = new BoundStatement(statement);
    ResultSet results =
        connectionManager.getSession(keyspaceName).execute(boundStatement.bind(id));
    response = CassandraUtil.createResponse(results);
  } catch (Exception e) {
    ProjectLogger.log(Constants.EXCEPTION_MSG_FETCH + tableName + " : " + e.getMessage(), e);
    throw new ProjectCommonException(ResponseCode.SERVER_ERROR.getErrorCode(),
        ResponseCode.SERVER_ERROR.getErrorMessage(), ResponseCode.SERVER_ERROR.getResponseCode());
  }
  long stopTime = System.currentTimeMillis();
  long elapsedTime = stopTime - startTime;
  ProjectLogger.log("Cassandra Service getPropertiesValueById method end at ==" + stopTime
      + " ,Total time elapsed = " + elapsedTime, LoggerEnum.PERF_LOG);
  return response;
}
 
開發者ID:project-sunbird,項目名稱:sunbird-utils,代碼行數:26,代碼來源:CassandraOperationImpl.java

示例2: getBoundStatementInsert

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * getBoundStatementInsert
 * @param userid
 * @param devicetoken
 * @param authcode
 * @param accesstoken
 * @param refreshtoken
 * @param ttl
 * @return Insert Query in the form of
 *           a BoundStatement ready for execution or to be added to
 *           a BatchStatement
 * @throws Exception
 */
public BoundStatement getBoundStatementInsert (
  Object userid,
  Object devicetoken,
  Object authcode,
  Object accesstoken,
  Object refreshtoken,
  Object ttl) throws Exception {

  return
    this.getQuery(kInsertName).getBoundStatement(
      userid,
      devicetoken,
      authcode,
      accesstoken,
      refreshtoken,
      ttl);
}
 
開發者ID:vangav,項目名稱:vos_instagram,代碼行數:31,代碼來源:AuthCodes.java

示例3: bindKeyValue

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * Binds Ignite cache key and value object to {@link PreparedStatement}.
 *
 * @param statement statement to which key and value object should be bind.
 * @param key key object.
 * @param val value object.
 * @return statement with bounded key and value.
 */
public BoundStatement bindKeyValue(PreparedStatement statement, Object key, Object val) {
    KeyPersistenceSettings keySettings = persistenceSettings.getKeyPersistenceSettings();
    Object[] keyValues = getBindingValues(keySettings.getStrategy(),
        keySettings.getSerializer(), keySettings.getFields(), key);
    ValuePersistenceSettings valSettings = persistenceSettings.getValuePersistenceSettings();
    Object[] valValues = getBindingValues(valSettings.getStrategy(),
        valSettings.getSerializer(), valSettings.getFields(), val);
    Object[] values = new Object[keyValues.length + valValues.length];
    int i = 0;
    for (Object keyVal : keyValues) {
        values[i] = keyVal;
        i++;
    }
    for (Object valVal : valValues) {
        values[i] = valVal;
        i++;
    }
    return statement.bind(values);
}
 
開發者ID:epam,項目名稱:Lagerta,代碼行數:28,代碼來源:PersistenceController.java

示例4: getBoundStatementInsert

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * getBoundStatementInsert
 * @param airportcode
 * @param latitude
 * @param longitude
 * @param continent
 * @param continentcode
 * @param country
 * @param countrycode
 * @param city
 * @param populationinmillions
 * @param addedyearmonthday
 * @return Insert Query in the form of
 *           a BoundStatement ready for execution or to be added to
 *           a BatchStatement
 * @throws Exception
 */
public BoundStatement getBoundStatementInsert (
  Object airportcode,
  Object latitude,
  Object longitude,
  Object continent,
  Object continentcode,
  Object country,
  Object countrycode,
  Object city,
  Object populationinmillions,
  Object addedyearmonthday) throws Exception {

  return
    this.getQuery(kInsertName).getBoundStatement(
      airportcode,
      latitude,
      longitude,
      continent,
      continentcode,
      country,
      countrycode,
      city,
      populationinmillions,
      addedyearmonthday);
}
 
開發者ID:vangav,項目名稱:vos_instagram_bots,代碼行數:43,代碼來源:Cities.java

示例5: getBoundStatementInsert

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * getBoundStatementInsert
 * @param email
 * @param password
 * @param userid
 * @return Insert Query in the form of
 *           a BoundStatement ready for execution or to be added to
 *           a BatchStatement
 * @throws Exception
 */
public BoundStatement getBoundStatementInsert (
  Object email,
  Object password,
  Object userid) throws Exception {

  return
    this.getQuery(kInsertName).getBoundStatement(
      email,
      password,
      userid);
}
 
開發者ID:vangav,項目名稱:vos_instagram,代碼行數:22,代碼來源:EmailCreds.java

示例6: getBoundStatementSelectTopSmallerThanOrEqualLimit

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * getBoundStatementSelectTopSmallerThanOrEqualLimit
 * @param yearmonthdaycountrycode
 * @param rank
 * @return SelectTopSmallerThanOrEqualLimit Query in the form of
 *           a BoundStatement ready for execution or to be added to
 *           a BatchStatement
 * @throws Exception
 */
public BoundStatement getBoundStatementSelectTopSmallerThanOrEqualLimit (
  Object yearmonthdaycountrycode,
  Object rank) throws Exception {

  return
    this.getQuery(kSelectTopSmallerThanOrEqualLimitName).getBoundStatement(
      yearmonthdaycountrycode,
      rank);
}
 
開發者ID:vangav,項目名稱:vos_instagram,代碼行數:19,代碼來源:PostsRankCountry.java

示例7: getBoundStatementSelectTopSmallerThanOrEqualLimit

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * getBoundStatementSelectTopSmallerThanOrEqualLimit
 * @param yearweekgridid
 * @param rank
 * @return SelectTopSmallerThanOrEqualLimit Query in the form of
 *           a BoundStatement ready for execution or to be added to
 *           a BatchStatement
 * @throws Exception
 */
public BoundStatement getBoundStatementSelectTopSmallerThanOrEqualLimit (
  Object yearweekgridid,
  Object rank) throws Exception {

  return
    this.getQuery(kSelectTopSmallerThanOrEqualLimitName).getBoundStatement(
      yearweekgridid,
      rank);
}
 
開發者ID:vangav,項目名稱:vos_instagram,代碼行數:19,代碼來源:UsersRankGrid.java

示例8: getBoundStatementDelete

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * getBoundStatementDelete
 * @param postid
 * @param userid
 * @return Delete Query in the form of
 *           a BoundStatement ready for execution or to be added to
 *           a BatchStatement
 * @throws Exception
 */
public BoundStatement getBoundStatementDelete (
  Object postid,
  Object userid) throws Exception {

  return
    this.getQuery(kDeleteName).getBoundStatement(
      postid,
      userid);
}
 
開發者ID:vangav,項目名稱:vos_instagram_jobs,代碼行數:19,代碼來源:PostLikesTime.java

示例9: insertMulti

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
@Override
	public Status insertMulti(List<TsPoint> points) {
		long costTime = 0L;
		if (points != null) {
			Cluster cluster = null;
			try {
//				cluster = Cluster.builder().addContactPoint(CASSADRA_URL).build();
//				Session session = cluster.connect(KEY_SPACE_NAME);
				Session session = SessionManager.getSession();
				BatchStatement batch = new BatchStatement();
				PreparedStatement ps = session.prepare(
						"INSERT INTO " + TABLE_NAME + "(timestamp,device_code,sensor_code,value) VALUES(?,?,?,?)");
				for (TsPoint point : points) {
					BoundStatement bs = ps.bind(new Date(point.getTimestamp()), point.getDeviceCode(),
							point.getSensorCode(), Double.parseDouble(point.getValue().toString()));
					batch.add(bs);
				}
				long startTime = System.nanoTime();
				session.execute(batch);
				long endTime = System.nanoTime();
				costTime = endTime - startTime;
				batch.clear();
//				session.close();
			} catch (Exception e) {
				e.printStackTrace();
			} finally {
				if (cluster != null)
					cluster.close();
			}
		}
//		System.out.println("costTime=" + costTime);
		return Status.OK(costTime);
	}
 
開發者ID:dbiir,項目名稱:ts-benchmark,代碼行數:34,代碼來源:CassandraDB.java

示例10: getBoundStatementSelectAfter

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * getBoundStatementSelectAfter
 * @param yearmonthdayhourcontroller
 * @param logtime
 * @return SelectAfter Query in the form of
 *           a BoundStatement ready for execution or to be added to
 *           a BatchStatement
 * @throws Exception
 */
public BoundStatement getBoundStatementSelectAfter (
  Object yearmonthdayhourcontroller,
  Object logtime) throws Exception {

  return
    this.getQuery(kSelectAfterName).getBoundStatement(
      yearmonthdayhourcontroller,
      logtime);
}
 
開發者ID:vangav,項目名稱:vos_instagram_jobs,代碼行數:19,代碼來源:HourlyControllersErrorLogs.java

示例11: request

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * Override to change what data from the statement are parsed into the span representing it. By
 * default, this sets the span name to the lower-camel case type name and tags {@link
 * CassandraTraceKeys#CASSANDRA_KEYSPACE} and {@link CassandraTraceKeys#CASSANDRA_QUERY} for bound
 * statements.
 *
 * <p>If you only want to change the span name, you can override {@link #spanName(Statement)}
 * instead.
 *
 * @see #spanName(Statement)
 */
public void request(Statement statement, SpanCustomizer customizer) {
  customizer.name(spanName(statement));
  String keyspace = statement.getKeyspace();
  if (keyspace != null) {
    customizer.tag(CassandraTraceKeys.CASSANDRA_KEYSPACE, statement.getKeyspace());
  }
  if (statement instanceof BoundStatement) {
    customizer.tag(CassandraTraceKeys.CASSANDRA_QUERY,
        ((BoundStatement) statement).preparedStatement().getQueryString());
  }
}
 
開發者ID:openzipkin,項目名稱:brave-cassandra,代碼行數:23,代碼來源:CassandraClientParser.java

示例12: getBoundStatementInsert

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * getBoundStatementInsert
 * @param postid
 * @param userid
 * @param commenttime
 * @return Insert Query in the form of
 *           a BoundStatement ready for execution or to be added to
 *           a BatchStatement
 * @throws Exception
 */
public BoundStatement getBoundStatementInsert (
  Object postid,
  Object userid,
  Object commenttime) throws Exception {

  return
    this.getQuery(kInsertName).getBoundStatement(
      postid,
      userid,
      commenttime);
}
 
開發者ID:vangav,項目名稱:vos_instagram_jobs,代碼行數:22,代碼來源:PostCommentsTime.java

示例13: getBoundStatementInsert

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * getBoundStatementInsert
 * @param messageid
 * @param message
 * @return Insert Query in the form of
 *           a BoundStatement ready for execution or to be added to
 *           a BatchStatement
 * @throws Exception
 */
public BoundStatement getBoundStatementInsert (
  Object messageid,
  Object message) throws Exception {

  return
    this.getQuery(kInsertName).getBoundStatement(
      messageid,
      message);
}
 
開發者ID:vangav,項目名稱:vos_whatsapp,代碼行數:19,代碼來源:Messages.java

示例14: getBoundStatementDelete

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
/**
 * getBoundStatementDelete
 * @param userid
 * @param devicetoken
 * @return Delete Query in the form of
 *           a BoundStatement ready for execution or to be added to
 *           a BatchStatement
 * @throws Exception
 */
public BoundStatement getBoundStatementDelete (
  Object userid,
  Object devicetoken) throws Exception {

  return
    this.getQuery(kDeleteName).getBoundStatement(
      userid,
      devicetoken);
}
 
開發者ID:vangav,項目名稱:vos_instagram,代碼行數:19,代碼來源:AuthCodes.java

示例15: execute

import com.datastax.driver.core.BoundStatement; //導入依賴的package包/類
void execute(Function<Session, BoundStatement> statement) {
  try (Cluster cluster = Cluster.builder()
      .addContactPointsWithPorts(Collections.singleton(cassandra.contactPoint()))
      .build(); Session session = cluster.connect()) {
    session.execute(statement.apply(session));
  }
}
 
開發者ID:openzipkin,項目名稱:brave-cassandra,代碼行數:8,代碼來源:ITTracing.java


注:本文中的com.datastax.driver.core.BoundStatement類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。