hypertable example in c++

1k views Asked by At

where i can find an sample code for hypertable or else can any one post an sample for hypertable with c++

3

There are 3 answers

1
Reno On

If you meant the source code for hypertable

otherwise here is the manual

You can use this HQL tutorial or look at this example

0
Manish Trivedi On

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

0
Bise On
#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一起编译