开发者

hypertable example in c++

开发者 https://www.devze.com 2023-02-12 14:36 出处:网络
where i can find an sample co开发者_运维百科de for hypertable or else can any one post an sample for hypertable with c++If you meant the source code for hypertable

where i can find an sample co开发者_运维百科de for hypertable or else can any one post an sample for hypertable with c++


If you meant the source code for hypertable

otherwise here is the manual

You can use this HQL tutorial or look at this example


see this:: http://blog.hypertable.com/ and download hypertable project :: http://www.hypertable.org/


#ifndef BOOST_FOREACH
#define BOOST_FOREACH 0
#endif

#include "Common/Compat.h"
#include "Common/System.h"

#include <arpa/inet.h>
#include <iostream>
#include <fstream>
#include "ThriftBroker/Client.h"
#include "ThriftBroker/gen-cpp/HqlService.h"
#include "ThriftBroker/ThriftHelper.h"
#include "ThriftBroker/SerializedCellsReader.h"

using namespace Hypertable;
using namespace Hypertable::ThriftGen;

int main (int argc, char **argv)
{
    Thrift::Client *client = new Thrift::Client("localhost", 38080);
    if (!client->namespace_exists("/"))
    {
        delete client;
        return 0;
    }
   Namespace ns = client->namespace_open("/");
   HqlResult result;
   client->hql_query(result, ns, "select * from foo");
   std::cout << result << std::endl;
   client->namespace_close(ns);
   delete client;
   return 0;
}

将其和/opt/hypertable/current/include/ThriftBroker/gen-cpp文件夹下的 Client_constants.cpp、Client_types.cpp、ClientService.cpp、Hql_constants.cpp、Hql_types.cpp、HqlService.cpp一起编译

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号