Under 1.9 the yaml library doesn't add the is_binary_data? method to String. This pull request fixes that issue.
Also, there are errors and deprecation notices from calling Object#type under 1.9 (under 1.8.7 it works the same as Object#class). These errors and deprecations were being caused because Statement#execute returns nil if the result is void?. This was causing the following errors in the test suite:
2) execute when performing keyspace operations should set keyspace without compression
Failure/Error: Statement.new(handle, "use keyspace1").execute
undefined method `type' for nil:NilClass
# ./lib/cassandra-cql/result.rb:17:in `void?'
# ./lib/cassandra-cql/statement.rb:51:in `execute'
# ./spec/statement_spec.rb:25:in `block (3 levels) in <top (required)>'
All tests pass (with the exception of a single pending test) under 1.9.2-p290 after this pull request and issue #6.
Always return result from Statement#execute.
Fix is_binary_data? was removed in 1.9. Add binary_data? utility func…
I had originally written it this way but it became awkward to test for nil all the time when returning nil instead seemed appropriate in all cases. Why do you prefer it this way?
That's not actually supposed to be calling Object#type at all .. type is an attribute of a CassandraThrift::CqlResult. If you look in the fixtures, it specifies type in result_for_void_operations.yml and it should be referring to that. I don't know why in 1.9 it seems to want to ignore that. That's why I check to see if it's void?, meaning the type == 2, and return nil if so.
It looks like the code itself is fine and the spec was incorrectly returning nil instead of a VOID resultset. I've updated the tests to hopefully remove those errors for you. Run this in your environment and see if that fixes the nil trouble you were having.
The specs all pass properly using 1d762f0 (current HEAD of master branch). Now the only test failures that I have are related to calls to String#is_binary_data? (commit ca0559c) and the Time precision issue (that is being fixed in SimpleUUID).
Would you like me to close this request, and open another for just the String#is_binary_data? fix?
Yes, that would be excellent.