public function __construct(ThriftConnection $connection, CqlPreparedResult $rawStatement, $query, $compression)
 {
     $this->_connection = $connection;
     $this->_host = $connection->socket()->getHost();
     $this->_rawStatement = $rawStatement;
     $this->_query = $query;
 }
Ejemplo n.º 2
0
 public static function setUpBeforeClass()
 {
     require_once __DIR__ . '/User.php';
     require_once __DIR__ . '/Person.php';
     require_once __DIR__ . '/CounterTest.php';
     require_once __DIR__ . '/KeyedUser.php';
     require_once __DIR__ . '/StaticMapper.php';
     require_once __DIR__ . '/IndexedMapper.php';
     $cassDb = \Packaged\Mappers\ThriftConnection::newConnection(['hosts' => '127.0.0.1']);
     $cassDb->setConnectTimeout(1000);
     $stmt = $cassDb->prepare('SELECT * FROM system.schema_keyspaces where keyspace_name = \'test_cassandra_mapper\'');
     if (!$cassDb->execute($stmt)) {
         $stmt = $cassDb->prepare('CREATE KEYSPACE "test_cassandra_mapper" WITH replication = {\'class\':\'SimpleStrategy\', \'replication_factor\':1};');
         $cassDb->execute($stmt);
     }
     $cassDb->setKeyspace('test_cassandra_mapper');
     $resolver = new \Packaged\Mappers\ConnectionResolver();
     $resolver->addConnection('cassdb', $cassDb);
     \Packaged\Mappers\BaseMapper::setConnectionResolver($resolver);
     CassUser::createTable();
     CassPerson::createTable();
     CounterTest::createTable();
 }
Ejemplo n.º 3
0
 public static function tearDownAfterClass()
 {
     $cassDb = \Packaged\Mappers\ThriftConnection::newConnection(['hosts' => '127.0.0.1']);
     $stmt = $cassDb->prepare('DROP KEYSPACE "test_cassandra_mapper"');
     $stmt->execute();
 }