Skip to content

Instantly share code, notes, and snippets.

@tagomoris
Created March 10, 2011 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tagomoris/863657 to your computer and use it in GitHub Desktop.
Save tagomoris/863657 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use local::lib "./extlib/";
use Thrift;
use Thrift::Socket;
use Thrift::BufferedTransport;
use Thrift::BinaryProtocol;
use ThriftHive;
my $socket = Thrift::Socket->new("localhost", 10000);
$socket->setSendTimeout(600 * 1000); # 10min.
$socket->setRecvTimeout(600 * 1000);
my $transport = Thrift::BufferedTransport->new($socket);
my $protocol = Thrift::BinaryProtocol->new($transport);
my $client = ThriftHiveClient->new($protocol);
eval {
$transport->open();
$client->execute("select count(*) from p");
use Data::Dumper;
warn Dumper $client->fetchAll();
$transport->close();
};
if ($@) { print $@->{message}, "\n"; };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment