dm-persevere-adapter 0.30.0 → 0.31.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/persevere_adapter.rb +7 -7
- data/spec/persevere_adapter_spec.rb +0 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.31.0
|
data/lib/persevere_adapter.rb
CHANGED
@@ -628,18 +628,20 @@ module DataMapper
|
|
628
628
|
case condition
|
629
629
|
# Persevere 1.0 regular expressions are disable for security so we pass them back for DataMapper query filtering
|
630
630
|
# without regular expressions, the like operator is inordinately challenging hence we pass it back
|
631
|
-
# when :like then "RegExp(\"#{condition.value.gsub!('%', '*')}\").test(#{condition.subject.name})"
|
632
631
|
# when :regexp then "RegExp(\"#{condition.value.source}\").test(#{condition.subject.name})"
|
633
632
|
when DataMapper::Query::Conditions::RegexpComparison then []
|
634
633
|
when DataMapper::Query::Conditions::LikeComparison then "#{condition.subject.name.to_s}='#{condition.loaded_value.gsub('%', '*')}'"
|
635
|
-
when DataMapper::Query::Conditions::AndOperation then
|
634
|
+
when DataMapper::Query::Conditions::AndOperation then
|
635
|
+
inside = condition.operands.map { |op| process_condition(op) }.flatten
|
636
|
+
inside.empty? ? [] : "(#{inside.join("&")})"
|
636
637
|
when DataMapper::Query::Conditions::OrOperation then "(#{condition.operands.map { |op| process_condition(op) }.join("|")})"
|
637
638
|
when DataMapper::Query::Conditions::NotOperation then
|
638
639
|
inside = process_condition(condition.operand)
|
639
640
|
inside.empty? ? [] : "!(%s)" % inside
|
640
641
|
when DataMapper::Query::Conditions::InclusionComparison then process_in(condition.subject.name, condition.value)
|
641
|
-
when DataMapper::Query::Conditions::EqualToComparison then condition.to_s.gsub(' ', '').gsub('nil', 'undefined')
|
642
|
-
when
|
642
|
+
when DataMapper::Query::Conditions::EqualToComparison then condition.to_s.gsub(' ', '').gsub('nil', 'undefined')
|
643
|
+
when DataMapper::Query::Conditions::NullOperation then []
|
644
|
+
when Array then
|
643
645
|
old_statement, bind_values = condition
|
644
646
|
statement = old_statement.dup
|
645
647
|
bind_values.each{ |bind_value| statement.sub!('?', bind_value.to_s) }
|
@@ -654,9 +656,7 @@ module DataMapper
|
|
654
656
|
field_ops = Array.new
|
655
657
|
headers = Hash.new
|
656
658
|
|
657
|
-
query.conditions
|
658
|
-
query_terms << process_condition(condition)
|
659
|
-
end
|
659
|
+
query_terms << process_condition(query.conditions)
|
660
660
|
|
661
661
|
if query_terms.flatten.length != 0
|
662
662
|
json_query += "[?#{query_terms.join("][?")}]"
|
@@ -8,8 +8,6 @@ require agg_dir / 'spec' / 'public' / 'shared' / 'aggregate_shared_spec'
|
|
8
8
|
|
9
9
|
require Pathname(__FILE__).dirname.expand_path.parent + 'lib/persevere_adapter'
|
10
10
|
|
11
|
-
require 'ruby-debug'
|
12
|
-
|
13
11
|
describe DataMapper::Adapters::PersevereAdapter do
|
14
12
|
before :all do
|
15
13
|
# This needs to point to a valid persevere server
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-persevere-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.31.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan R. Judson
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-02-
|
13
|
+
date: 2010-02-02 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|