Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

returns garbage when querying multiple rows #43

Open
rvwoens opened this issue Nov 11, 2014 · 6 comments
Open

returns garbage when querying multiple rows #43

rvwoens opened this issue Nov 11, 2014 · 6 comments
Assignees
Labels

Comments

@rvwoens
Copy link

rvwoens commented Nov 11, 2014

hi,
I'm trying this lib with cassandra 2.1.1 Maybe there is a cql protocol change, because I can't get a simple query that returns multiple rows to return the correct data. Maybe the NULL value is a problem?

in cqlsh:

cqlsh:testkeyspace> insert into animals(name,species,genus,family) values('pippi','dog', 'male','tiger');  
cqlsh:testkeyspace> insert into animals(name,species,genus,family) values('pippi2','dog', 'male','tiger');
cqlsh:testkeyspace> select * from animals;

 name   | family | genus | species | subspieces
--------+--------+-------+---------+------------
  pippi |  tiger |  male |     dog |       null
 pippi2 |  tiger |  male |     dog |       null

In php:

        $database = new evseevnn\Cassandra\Database($nodes, 'testkeyspace');
        $database->connect();
        $user2 = $database->query('SELECT * FROM animals ');
        var_dump($user2);

result:

array(2) {
  [0]=>
  array(5) {
    ["name"]=>
    string(5) "pippi"
    ["family"]=>
    string(5) "tiger"
    ["genus"]=>
    string(4) "male"
    ["species"]=>
    string(3) "dog"
    ["subspieces"]=>
    string(37) "�pippi2�tiger�male�dog���"
  }
  [1]=>
  array(5) {
    ["name"]=>
    NULL
    ["family"]=>
    NULL
    ["genus"]=>
    NULL
    ["species"]=>
    NULL
    ["subspieces"]=>
    NULL
  }
}
@LarsFronius
Copy link
Collaborator

I am investigating right now and it is definitely caused by null value types that are not handled correctly at the moment.

@rvwoens
Copy link
Author

rvwoens commented Nov 12, 2014

for your information, I switched to the duoshuo/php-cassandra library now. It is also using native socket communication on CQL 3 level, but it seems a bit more mature now. It also supports async calls.

@LarsFronius
Copy link
Collaborator

@rvwoens Have fun using collections then, they are definitely broken in the duoshuo one. We fixed the null value issue in https://github.com/eyeem/php-cassandra-binary already and the PR is just a matter of writing tests first. I think we also have better timeout handling and in general have tests to avoid breaking features in the future. Anyway, it's your decision, just my 2 cents on the different libraries and what I discovered so far. Maybe you want to rethink your decision :)

@CBox
Copy link

CBox commented Dec 27, 2014

What do I need to put in composer.json to get this version?
https://github.com/eyeem/php-cassandra-binary

I've get the fixed files manually by getting update these files (BinaryData.php, DataStream.php) and the null values as been fixed but I want it to be in the composer, I've try:
"eyeem/php-cassandra-binary" : "dev-master"

Thanks!

@LexLythius
Copy link

@LexLythius
Copy link

@CBox Please open a new issue for your problem/question. This one is about a bug on query return values, not composer dependency fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants