PageRenderTime 15ms CodeModel.GetById 12ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.1-rc2/hive/external/service/src/test/php/test_service.php

#
PHP | 17 lines | 12 code | 1 blank | 4 comment | 0 complexity | 8a522283b9cef9b0d6aac0d0cb1c7289 MD5 | raw file
 1<?php
 2// set THRIFT_ROOT to php directory of the hive distribution
 3$GLOBALS['THRIFT_ROOT'] = '/lib/php/';
 4// load the required files for connecting to Hive
 5require_once $GLOBALS['THRIFT_ROOT'] . 'packages/hive_service/ThriftHive.php';
 6require_once $GLOBALS['THRIFT_ROOT'] . 'transport/TSocket.php';
 7require_once $GLOBALS['THRIFT_ROOT'] . 'protocol/TBinaryProtocol.php';
 8// Set up the transport/protocol/client
 9$transport = new TSocket('localhost', 10000);
10$protocol = new TBinaryProtocol($transport);
11$client = new ThriftHiveClient($protocol);
12$transport->open();
13
14// run queries, metadata calls etc
15$client->execute('SELECT * from src');
16var_dump($client->fetchAll());
17$transport->close();