void CCassandraLogAgent::executeUpdateLogStatement(StringBuffer& st) { cassSession->connect(); CassandraFuture futurePrep(cass_session_prepare_n(cassSession->querySession(), st.str(), st.length())); futurePrep.wait("prepare statement"); Owned<CassandraPrepared> prepared = new CassandraPrepared(cass_future_get_prepared(futurePrep), NULL); CassandraStatement statement(prepared.getClear()); CassandraFuture future(cass_session_execute(cassSession->querySession(), statement)); future.wait("execute"); cassSession->disconnect(); }
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())); }
CassFuture* cass_session_prepare(CassSession* session, const char* query) { return cass_session_prepare_n(session, query, strlen(query)); }
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()); }
CassFuture* cass_session_prepare(CassSession* session, const char* query) { return cass_session_prepare_n(session, query, SAFE_STRLEN(query)); }