sessionm-cassandra_object 4.0.11 → 4.0.12
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11fade06487e64fb440faa12d842abf5dd28ec69
|
4
|
+
data.tar.gz: d39185eda954f6d24cb700fba070147da68034e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87ff41502c07a90dd515e8a05d90f0c663c916e074fcdb4a0fe65af3bf5302fa9f646d4d24b30e4bfac00ea2add30ba537e4e5b8ac29f82bbe1f035e69c2cb2b
|
7
|
+
data.tar.gz: d47225dcaf82c9cf890f67f541f3b376adb88dbf8358d74c72d01a0e6522196da10092c4e33a92bb5c50e8d2fdd9e4beb366046be509226abd063af3e0fb6b63
|
@@ -75,7 +75,7 @@ module CassandraObject
|
|
75
75
|
|
76
76
|
query = "BEGIN BATCH\n"
|
77
77
|
query << values.map do |name, value|
|
78
|
-
" INSERT INTO \"#{column_family}\" (#{KEY_FIELD}, #{NAME_FIELD}, #{VALUE_FIELD}) VALUES (#{key}, #{escape(name,
|
78
|
+
" INSERT INTO \"#{column_family}\" (#{KEY_FIELD}, #{NAME_FIELD}, #{VALUE_FIELD}) VALUES (#{key}, #{escape(name, name_type(column_family))}, #{escape(value, value_type(column_family))})#{insert_into_options}"
|
79
79
|
end.join("\n")
|
80
80
|
query << "\nAPPLY BATCH;"
|
81
81
|
|
@@ -177,10 +177,10 @@ module CassandraObject
|
|
177
177
|
key = "textAsBlob('#{key}')"
|
178
178
|
|
179
179
|
query = "SELECT * FROM \"#{column_family}\" WHERE #{KEY_FIELD} = #{key}"
|
180
|
-
query << " AND #{NAME_FIELD} = #{escape(column,
|
181
|
-
query << " AND #{NAME_FIELD} >= #{escape(start,
|
182
|
-
query << " AND #{NAME_FIELD} <= #{escape(finish,
|
183
|
-
query << " ORDER BY #{NAME_FIELD} #{
|
180
|
+
query << " AND #{NAME_FIELD} = #{escape(column, name_type(column_family))}" if column
|
181
|
+
query << " AND #{NAME_FIELD} >= #{escape(start, name_type(column_family))}" unless start.empty?
|
182
|
+
query << " AND #{NAME_FIELD} <= #{escape(finish, name_type(column_family))}" unless finish.empty?
|
183
|
+
query << " ORDER BY #{NAME_FIELD} #{reverse_comparator(column_family) ? 'ASC' : 'DESC'}" if reversed
|
184
184
|
query << " LIMIT #{count}"
|
185
185
|
|
186
186
|
self.execute(query, execute_options(opts)).inject({}) do |results, row|
|
@@ -243,6 +243,18 @@ CQL
|
|
243
243
|
self.column_families[column_family.name.to_s] = column_family
|
244
244
|
end
|
245
245
|
|
246
|
+
def name_type(column_family)
|
247
|
+
self.cluster.keyspace(keyspace).table(column_family).column(NAME_FIELD).type.kind
|
248
|
+
end
|
249
|
+
|
250
|
+
def value_type(column_family)
|
251
|
+
self.cluster.keyspace(keyspace).table(column_family).column(VALUE_FIELD).type.kind
|
252
|
+
end
|
253
|
+
|
254
|
+
def reverse_comparator(column_family)
|
255
|
+
self.cluster.keyspace(keyspace).table(column_family).send(:clustering_order).first == :desc
|
256
|
+
end
|
257
|
+
|
246
258
|
def escape(str, type)
|
247
259
|
case type
|
248
260
|
when :timeuuid
|