evseevnn-zz / php-cassandra-binary

PHP library for Cassandra database via a binary protocol.
http://evseevnn.github.io/php-cassandra-binary/
MIT License
69 stars 33 forks source link

Cannot create keyspace #37

Closed penfold45 closed 10 years ago

penfold45 commented 10 years ago

Hi I am trying to create a key space from php code if it does not exist. When I do the following

$temp_connection = new \evseevnn\Cassandra\Database($this->getNodes());
$temp_connection->query("CREATE KEYSPACE " . $keyspace . " WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };");

I get lots and lots of the following error

Warning: socket_read() expects parameter 1 to be resource, null given in vendor/evseevnn/php-cassandra-binary/src/Connection.php on line 75

The first line (the connection) works fine no issues it appears to be when I call "->query()"

Is this something I am doing wrong?

evseevnn-zz commented 10 years ago

@LarsFronius We have a test verifies this functionality?

LarsFronius commented 10 years ago

Sure, actually a new keyspace is created before every testclass. @evseevnn @penfold45 , please check here how to create a keyspace: https://github.com/evseevnn/php-cassandra-binary/blob/master/tests/Setup/QueryTestCase.php#L19 Assumption: You are missing a

$temp_connection->connect();

before you do the query.

penfold45 commented 10 years ago

oops very sorry about that. Yes I am not connecting.