예제 #1
0
  void prepare_alter_schema_version_session() {
    // Create a new session for altering node2 and node3 system tables
    std::string ip_prefix = inst.ccm->get_ip_prefix();
    std::stringstream whitelist_hosts;
    whitelist_hosts << ip_prefix << "2," << ip_prefix << "3";
    cass_cluster_set_whitelist_filtering(inst.cluster, whitelist_hosts.str().c_str());
    schema_alter_session = cass_session_new();
    test_utils::CassFuturePtr connect_future(cass_session_connect(schema_alter_session, inst.cluster));
    test_utils::wait_and_check_error(connect_future.get());

    std::string update_peer("UPDATE system.peers SET schema_version=? WHERE peer='" + ip_prefix + "1'");
    test_utils::CassFuturePtr prepared_future(cass_session_prepare_n(schema_alter_session, update_peer.data(), update_peer.size()));
    test_utils::wait_and_check_error(prepared_future.get());
    schema_alter_prepared = test_utils::CassPreparedPtr(cass_future_get_prepared(prepared_future.get()));
  }
예제 #2
0
const CassPrepared* prepare_statement(CassSession* session, std::string query) {
  test_utils::CassFuturePtr prepared_future(cass_session_prepare_n(session,
                                                                   query.data(), query.size()));
  test_utils::wait_and_check_error(prepared_future.get());
  return cass_future_get_prepared(prepared_future.get());
}