Permalink
Browse files

Add 1.1 compatibility module

* Generated Thrift bindings from 1.1 spec
* V11 module; use this as default
* Allow passing a :cql_version option to Database#initialize
  • Loading branch information...
1 parent 0800b87 commit 1993a046b4475af6289139a9a55fc275756c49da @outoftime outoftime committed May 21, 2012
View
@@ -16,7 +16,7 @@
module CassandraCQL; end;
unless CassandraCQL.respond_to?(:CASSANDRA_VERSION)
- require "cassandra-cql/1.0"
+ require "cassandra-cql/1.1"
end
here = File.expand_path(File.dirname(__FILE__))
View
@@ -0,0 +1,7 @@
+module CassandraCQL
+ def self.CASSANDRA_VERSION
+ "1.1"
+ end
+end
+
+require "#{File.expand_path(File.dirname(__FILE__))}/../cassandra-cql"
@@ -0,0 +1,6 @@
+module CassandraCQL
+ module V11
+ class Result < CassandraCQL::Result
+ end
+ end
+end
@@ -0,0 +1,6 @@
+module CassandraCQL
+ module V11
+ class Statement < CassandraCQL::Statement
+ end
+ end
+end
@@ -32,6 +32,7 @@ def initialize(servers, options={}, thrift_client_options={})
}.merge(thrift_client_options)
@keyspace = @options[:keyspace]
+ @cql_version = @options[:cql_version]
@servers = servers
connect!
execute("USE #{@keyspace}")
@@ -41,6 +42,7 @@ def connect!
@connection = ThriftClient.new(CassandraCQL::Thrift::Client, @servers, @thrift_client_options)
obj = self
@connection.add_callback(:post_connect) do
+ @connection.set_cql_version(@cql_version) if @cql_version
execute("USE #{@keyspace}")
@connection.login(@auth_request) if @auth_request
end
Oops, something went wrong.

0 comments on commit 1993a04

Please sign in to comment.