PageRenderTime 44ms CodeModel.GetById 13ms RepoModel.GetById 0ms 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
Possible License(s): Apache-2.0, BSD-3-Clause, JSON, CPL-1.0
  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
  5. require_once $GLOBALS['THRIFT_ROOT'] . 'packages/hive_service/ThriftHive.php';
  6. require_once $GLOBALS['THRIFT_ROOT'] . 'transport/TSocket.php';
  7. require_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. // run queries, metadata calls etc
  14. $client->execute('SELECT * from src');
  15. var_dump($client->fetchAll());
  16. $transport->close();