iconara / cql-rb

Cassandra CQL 3 binary protocol driver for Ruby
106 stars 31 forks source link

Encoding problem with prepared statment #129

Closed mhakeem closed 1 year ago

mhakeem commented 8 years ago

Hi there,

I'm facing problems when I insert tweet objects (in JSON) as blob in Cassandra when using prepared statement. This is the exception I get:

<Encoding::UndefinedConversionError: U+201C from UTF-8 to ASCII-8BIT> @ /usr/local/rvm/gems/ruby-2.3.0/gems/cql-rb-2.0.5/lib/cql/protocol/type_converter.rb:256:in `encode'

The same code works when using regular execute function instead of prepared statement. Also, the prepared statement works fine when I change the data type of the field in cassandra from blob to text, however, I have some specific use cases where I would like to use blob and this is giving me a lot of problems.

Any suggestions?

iconara commented 8 years ago

This gem is not maintained anymore, development was moved to https://github.com/datastax/ruby-driver two years ago.

mhakeem commented 8 years ago

I know that. We have a code base that relies on the older cassandra-rb gem and this gem's name conflicts with datastax's ruby driver. It breaks everything. We can't change the code that uses the thrift client based gem 'cassandra-rb' and this restricts using the new ruby driver. I know that the datastax's gem doesn't support thrift. Is there any other way you suggest so that we don't have to refactor/rewrite our old code and work with both thrift & CQL?

iconara commented 8 years ago

If you fix the problem and submit a pull request I can release a bugfix.