ciql 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ciql/client/thrift.rb +30 -0
- data/lib/ciql/client.rb +2 -0
- data/lib/ciql/configuration.rb +1 -1
- data/lib/ciql/sanitize.rb +1 -0
- data/lib/ciql/version.rb +1 -1
- data/lib/ciql.rb +1 -4
- data/spec/ciql/client/thrift_spec.rb +11 -0
- data/spec/ciql/client_spec.rb +1 -0
- data/spec/ciql/configuration_spec.rb +30 -30
- metadata +23 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfaee067156de5c21c4464d6e363f146e2af07d8
|
4
|
+
data.tar.gz: 682634838722e35ba3d18e65ffc2df5cbc3d496d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d8c09472cf40154fd5db8c60a13aa4d15b5fdd97df158b9c1015c9cc3c9b5928463f14612725b0022067f9812072a9f03b43e7c96aac560a0558dd67d7d969c
|
7
|
+
data.tar.gz: ec2bcbd27c692293f6f480362663ea63f61e512ca8832781c70b936d24caeef037d3248e4bd5ebad1943d4537d405195193eede7d5354fdedfa7f0cb31f70577
|
data/README.md
CHANGED
@@ -2,4 +2,4 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/Nulu/ciql.png?branch=master)](https://travis-ci.org/Nulu/ciql) [![Dependency Status](https://gemnasium.com/Nulu/ciql.png)](https://gemnasium.com/Nulu/ciql)
|
4
4
|
|
5
|
-
This project is currently small support utilities and extensions for the [cql-rb](https://github.com/iconara/cql-rb)
|
5
|
+
This project is currently small support utilities and extensions for the [cassandra-cql](https://github.com/kreynolds/cassandra-cql) and [cql-rb](https://github.com/iconara/cql-rb) drivers.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'cassandra-cql/1.2'
|
2
|
+
require 'cassandra-cql'
|
3
|
+
|
4
|
+
module Ciql::Client
|
5
|
+
class Thrift < CassandraCQL::Database
|
6
|
+
def initialize(options={})
|
7
|
+
port = options.delete(:port) { 9160 }
|
8
|
+
hosts = options.delete(:host) { 'localhost' }.split(',')
|
9
|
+
hosts_with_port = hosts.map { |host| [host, port].join(':') }
|
10
|
+
super(hosts_with_port, options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute(statement, *arguments)
|
14
|
+
bind_variables = arguments.shift statement.count('?')
|
15
|
+
bound_statement = CassandraCQL::Statement.sanitize(statement, bind_variables)
|
16
|
+
compression_type = CassandraCQL::Thrift::Compression::NONE
|
17
|
+
consistency_level = CassandraCQL::Thrift::ConsistencyLevel.const_get(
|
18
|
+
(arguments.shift or :quorum).to_s.upcase
|
19
|
+
)
|
20
|
+
|
21
|
+
CassandraCQL::Result.new(
|
22
|
+
@connection.execute_cql3_query(
|
23
|
+
bound_statement, compression_type, consistency_level
|
24
|
+
)
|
25
|
+
)
|
26
|
+
rescue CassandraCQL::Thrift::InvalidRequestException
|
27
|
+
raise CassandraCQL::Error::InvalidRequestException.new($!.why)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/ciql/client.rb
CHANGED
data/lib/ciql/configuration.rb
CHANGED
data/lib/ciql/sanitize.rb
CHANGED
data/lib/ciql/version.rb
CHANGED
data/lib/ciql.rb
CHANGED
data/spec/ciql/client_spec.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module Ciql
|
4
|
-
describe '.client' do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
4
|
+
# describe '.client' do
|
5
|
+
# let(:reactor) { FakeReactor.new }
|
6
|
+
|
7
|
+
# before(:each) do
|
8
|
+
# Cql::Io::IoReactor.stub(:new).and_return(reactor)
|
9
|
+
# end
|
10
|
+
|
11
|
+
# after(:each) do
|
12
|
+
# Ciql.class_variable_set(:@@client, nil)
|
13
|
+
# Ciql.class_variable_set(:@@configuration, nil)
|
14
|
+
# end
|
15
|
+
|
16
|
+
# it 'returns a Client instance' do
|
17
|
+
# Ciql.client.should be_instance_of Ciql::Client::SynchronousClient
|
18
|
+
# end
|
19
|
+
|
20
|
+
# it 'always returns the same Client instance' do
|
21
|
+
# Ciql.client.should be Ciql.client
|
22
|
+
# end
|
23
|
+
|
24
|
+
# it 'creates the client with the configured options' do
|
25
|
+
# Ciql.configure { |c| c.port = 1234 }
|
26
|
+
# Ciql::Client::AsynchronousClient.should_receive(:new).with(port: 1234).and_call_original
|
27
|
+
# Ciql.client
|
28
|
+
# end
|
29
|
+
|
30
|
+
# it 'connects the client' do
|
31
|
+
# Ciql.client.should be_connected
|
32
|
+
# end
|
33
|
+
# end
|
34
34
|
|
35
35
|
describe '.configuration' do
|
36
36
|
after(:each) do
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ciql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Bradford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: cql
|
14
|
+
name: cassandra-cql
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: cql-rb
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: simple_uuid
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -31,7 +45,7 @@ dependencies:
|
|
31
45
|
- - ~>
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: 0.3.0
|
34
|
-
type: :
|
48
|
+
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
@@ -45,12 +59,14 @@ executables: []
|
|
45
59
|
extensions: []
|
46
60
|
extra_rdoc_files: []
|
47
61
|
files:
|
62
|
+
- lib/ciql/client/thrift.rb
|
48
63
|
- lib/ciql/client.rb
|
49
64
|
- lib/ciql/configuration.rb
|
50
65
|
- lib/ciql/sanitize.rb
|
51
66
|
- lib/ciql/version.rb
|
52
67
|
- lib/ciql.rb
|
53
68
|
- README.md
|
69
|
+
- spec/ciql/client/thrift_spec.rb
|
54
70
|
- spec/ciql/client_spec.rb
|
55
71
|
- spec/ciql/configuration_spec.rb
|
56
72
|
- spec/ciql/sanitize_spec.rb
|
@@ -80,6 +96,7 @@ signing_key:
|
|
80
96
|
specification_version: 4
|
81
97
|
summary: CQL Cassandra client for Ruby
|
82
98
|
test_files:
|
99
|
+
- spec/ciql/client/thrift_spec.rb
|
83
100
|
- spec/ciql/client_spec.rb
|
84
101
|
- spec/ciql/configuration_spec.rb
|
85
102
|
- spec/ciql/sanitize_spec.rb
|