gotime-cassandra_object 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'gotime-cassandra_object'
5
- s.version = '4.0.0'
5
+ s.version = '4.0.1'
6
6
  s.description = 'Cassandra ActiveModel'
7
7
  s.summary = 'Cassandra ActiveModel'
8
8
  s.authors = ["Michael Koziarski", "gotime"]
@@ -46,7 +46,6 @@ module CassandraObject
46
46
  include Savepoints
47
47
 
48
48
  include Serialization
49
- include Mocking
50
49
 
51
50
  def initialize(attributes=nil)
52
51
  @new_record = true
@@ -1,3 +1,20 @@
1
+ module CassandraCQL
2
+ class Statement
3
+ def self.sanitize(statement, bind_vars=[])
4
+ return statement if bind_vars.empty?
5
+
6
+ bind_vars = bind_vars.dup
7
+ expected_bind_vars = statement.count("?")
8
+
9
+ raise Error::InvalidBindVariable, "Wrong number of bound variables (statement expected #{expected_bind_vars}, was #{bind_vars.size})" if expected_bind_vars != bind_vars.size
10
+
11
+ statement.gsub(/\?/) do
12
+ quote(cast_to_cql(bind_vars.shift))
13
+ end
14
+ end
15
+ end
16
+ end
17
+
1
18
  module CassandraObject
2
19
  module Connection
3
20
  extend ActiveSupport::Concern
@@ -16,8 +16,6 @@ module CassandraObject
16
16
  autoload :Identity
17
17
  autoload :Inspect
18
18
  autoload :Serialization
19
- autoload :Collection
20
- autoload :Mocking
21
19
  autoload :Batches
22
20
  autoload :FinderMethods
23
21
  autoload :Savepoints
@@ -4,6 +4,10 @@ class CassandraObject::ConnectionTest < CassandraObject::TestCase
4
4
  class TestObject < CassandraObject::Base
5
5
  end
6
6
 
7
+ test "sanitize supports question marks" do
8
+ assert_equal 'hello ?', CassandraCQL::Statement.sanitize('hello ?')
9
+ end
10
+
7
11
  test 'establish_connection' do
8
12
  # TestObject.establish_connection(
9
13
  # keyspace: 'place_directory_development',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gotime-cassandra_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-10 00:00:00.000000000 Z
13
+ date: 2012-08-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
@@ -120,7 +120,6 @@ files:
120
120
  - lib/cassandra_object/belongs_to/builder.rb
121
121
  - lib/cassandra_object/belongs_to/reflection.rb
122
122
  - lib/cassandra_object/callbacks.rb
123
- - lib/cassandra_object/collection.rb
124
123
  - lib/cassandra_object/connection.rb
125
124
  - lib/cassandra_object/consistency.rb
126
125
  - lib/cassandra_object/errors.rb
@@ -128,7 +127,6 @@ files:
128
127
  - lib/cassandra_object/identity.rb
129
128
  - lib/cassandra_object/inspect.rb
130
129
  - lib/cassandra_object/log_subscriber.rb
131
- - lib/cassandra_object/mocking.rb
132
130
  - lib/cassandra_object/persistence.rb
133
131
  - lib/cassandra_object/railtie.rb
134
132
  - lib/cassandra_object/savepoints.rb
@@ -1,8 +0,0 @@
1
- module CassandraObject
2
- class Collection < Array
3
- attr_accessor :last_column_name
4
- def inspect
5
- "<CassandraObject::Collection##{object_id} contents: #{super} last_column_name: #{last_column_name.inspect}>"
6
- end
7
- end
8
- end
@@ -1,15 +0,0 @@
1
- require 'cassandra/mock'
2
- module CassandraObject
3
- module Mocking
4
- extend ActiveSupport::Concern
5
- module ClassMethods
6
- def use_mock!(really=true)
7
- if really
8
- self.connection_class = Cassandra::Mock
9
- else
10
- self.connection_class = Cassandra
11
- end
12
- end
13
- end
14
- end
15
- end