Sha256: f9552bb5c5a25195d1e97d341accd72ac31754e5c77ae7ad235ca00f35a2e5c2
Contents?: true
Size: 991 Bytes
Versions: 1
Compression:
Stored size: 991 Bytes
Contents
module CassandraCQL class Statement def self.sanitize(statement, bind_vars=[]) return statement if bind_vars.empty? bind_vars = bind_vars.dup expected_bind_vars = statement.count("?") raise Error::InvalidBindVariable, "Wrong number of bound variables (statement expected #{expected_bind_vars}, was #{bind_vars.size})" if expected_bind_vars != bind_vars.size statement.gsub(/\?/) do quote(cast_to_cql(bind_vars.shift)) end end end end module CassandraObject module Connection extend ActiveSupport::Concern module ClassMethods def adapter @@adapter ||= adapter_class.new(config) end def adapter_class case config[:adapter] when 'hstore' CassandraObject::Adapters::HstoreAdapter when nil, 'cassandra' CassandraObject::Adapters::CassandraAdapter else raise "Unknown adapter #{config[:adapter]}" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gotime-cassandra_object-4.12.2 | lib/cassandra_object/connection.rb |