kallaspriit / Cassandra-PHP-Client-Library

Cassandra PHP-based client library for managing and querying your Cassandra cluster
http://cassandra-php-client-library.com
103 stars 25 forks source link

If keyspace exists #4

Closed ghost closed 13 years ago

ghost commented 13 years ago

Hi, I've tried to check if keyspace exists, but I was getting errors. Checked few times, and problem is in getKeyspaceSchema/describeKeyspace(which I wanted to test against null). App showing the problem: $cassandra = Cassandra::createInstance($servers); $cassandra->createKeyspace("psycho_key"); $schema=$cassandra->getKeyspaceSchema("psycho_key"); print "check_1:<br>"; var_dump($schema); $cassandra->dropKeyspace("psycho_key"); print "<br>dropped"; $schema=$cassandra->getKeyspaceSchema("psycho_key"); print "<br>checked_2:"; var_dump($schema); , and the output is: check_1: array(5) { ["name"]=> string(10) "psycho_key" ["placement-strategy"]=> string(43) "org.apache.cassandra.locator.SimpleStrategy" ["placement-strategy-options"]=> NULL ["replication-factor"]=> int(1) ["column-families"]=> array(0) { } } dropped Fatal error: Uncaught exception 'cassandra_NotFoundException' in C:\Users\Maciekp\Documents\Programming\web\mine\SDKs\cassandra_php\thrift\Thrift.php:574 Stack trace: #0 C:\Users\Maciekp\Documents\Programming\web\mine\SDKs\cassandra_php\thrift\packages\cassandra\Cassandra.php(3380): TBase->_read('Cassandra_descr...', Array, Object(TBinaryProtocolAccelerated)) #1 C:\Users\Maciekp\Documents\Programming\web\mine\SDKs\cassandra_php\thrift\packages\cassandra\Cassandra.php(1235): cassandra_Cassandra_describe_keyspace_result->read(Object(TBinaryProtocolAccelerated)) #2 C:\Users\Maciekp\Documents\Programming\web\mine\SDKs\cassandra_php\thrift\packages\cassandra\Cassandra.php(1196): CassandraClient->recv_describe_keyspace() #3 [internal function]: CassandraClient->describe_keyspace('psycho_key') #4 C:\Users\Maciekp\Documents\Programming\web\mine\SDKs\cassandra_php\Cassandra.php(968): call_user_func_array(Array, Array) #5 C:\Users\Maciekp\Documents\Programming\web\mine\SDKs\cassandra_php\Cassandra.php(1001): Cassandra->call('descri in C:\Users\Maciekp\Documents\Programming\web\mine\SDKs\cassandra_php\Cassandra.php on line 976

ghost commented 13 years ago

Besides, such a function could be useful(cassandra->keyspaceExists("keyspace_2");)