jungle_path 0.0.33 → 0.0.34
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.
- checksums.yaml +4 -4
- data/lib/jungle_path/query/engine.rb +41 -14
- data/lib/jungle_path/query/sql_string.rb +1 -1
- data/lib/jungle_path/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc6c3ad9b71be6cd071db13a1726cfa0b336e1c7
|
4
|
+
data.tar.gz: ad5741fe9a3777d634fff6716b7d421c27ddd7b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24970eb2794d323b8819a4a6ce4edfa08a91becb840fb455caf44d5f03ddc4f5ebcd849fb94b6f86e6ab58fdbee760e130ee43fe071c3bab46d79642c526935a
|
7
|
+
data.tar.gz: ca8b18f4e3ba3cec0b55ca3b5c5281de69e1b2f799653fbdbd1f93f241685172f04ee798e95ad3c880aca820b9d2aa85643c439ec4b1bfeafe47a6a4c7e77b13
|
@@ -111,12 +111,14 @@ module JunglePath
|
|
111
111
|
else
|
112
112
|
raise "Expected token to be an entity name. Token: #{token}"
|
113
113
|
end
|
114
|
-
elsif expect_offset and token.start_with? "["
|
114
|
+
elsif expect_offset and token == "[" #token.start_with? "["
|
115
115
|
expect_offset = false
|
116
|
-
entity.offset = JunglePath::Query::Limit.parse(token) #same format as Limit.
|
117
|
-
|
116
|
+
#entity.offset = JunglePath::Query::Limit.parse(token) #same format as Limit.
|
117
|
+
entity.offset = process_limit(tokens) # same as limit
|
118
|
+
elsif expect_limit and token == "[" #token.start_with? "["
|
118
119
|
expect_limit = false
|
119
|
-
entity.limit = JunglePath::Query::Limit.parse(token)
|
120
|
+
#entity.limit = JunglePath::Query::Limit.parse(token)
|
121
|
+
entity.limit = process_limit(tokens)
|
120
122
|
expect_offset = true
|
121
123
|
elsif expect_sort and token == "("
|
122
124
|
if in_fields
|
@@ -134,7 +136,7 @@ module JunglePath
|
|
134
136
|
end
|
135
137
|
expect_sort = true
|
136
138
|
elsif expect_fields and token == "[" # got parameters which should be passed to the entity in sql as a table function.
|
137
|
-
entity.parameters = process_parameters(
|
139
|
+
entity.parameters = process_parameters(tokens)
|
138
140
|
elsif expect_fields and token == "("
|
139
141
|
expect_fields = false
|
140
142
|
entity.fields = process_fields(entity, tokens, aliases, values, root_entity)
|
@@ -152,7 +154,23 @@ module JunglePath
|
|
152
154
|
entity
|
153
155
|
end
|
154
156
|
|
155
|
-
def
|
157
|
+
def process_limit(tokens)
|
158
|
+
limit = nil
|
159
|
+
limit_contents = []
|
160
|
+
token = next_token(tokens)
|
161
|
+
while token
|
162
|
+
if token == "]"
|
163
|
+
limit = JunglePath::Query::Limit.parse(limit_contents.join(' '))
|
164
|
+
break
|
165
|
+
else
|
166
|
+
limit_contents << token
|
167
|
+
end
|
168
|
+
token = next_token(tokens)
|
169
|
+
end
|
170
|
+
limit
|
171
|
+
end
|
172
|
+
|
173
|
+
def process_parameters(tokens)
|
156
174
|
parameters = []
|
157
175
|
token = next_token(tokens)
|
158
176
|
while token
|
@@ -507,6 +525,7 @@ module JunglePath
|
|
507
525
|
query.each_char do |c|
|
508
526
|
i += 1
|
509
527
|
next_char = query[i]
|
528
|
+
#puts "i: #{i}, c: #{c}, tokens: #{tokens}"
|
510
529
|
if in_escape and c == "\\"
|
511
530
|
in_escape = false
|
512
531
|
token << "\\"
|
@@ -556,13 +575,13 @@ module JunglePath
|
|
556
575
|
token = ""
|
557
576
|
end
|
558
577
|
in_single_line_comment = true
|
559
|
-
elsif in_bracket and c == "]"
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
elsif in_bracket
|
565
|
-
|
578
|
+
#elsif in_bracket and c == "]"
|
579
|
+
# in_bracket = false
|
580
|
+
# token << c
|
581
|
+
# tokens << token
|
582
|
+
# token = ""
|
583
|
+
#elsif in_bracket
|
584
|
+
# token << c
|
566
585
|
elsif c == "\""
|
567
586
|
if token.length > 0
|
568
587
|
tokens << token
|
@@ -611,7 +630,15 @@ module JunglePath
|
|
611
630
|
tokens << token
|
612
631
|
token = ""
|
613
632
|
end
|
614
|
-
token << c
|
633
|
+
#token << c
|
634
|
+
tokens << "["
|
635
|
+
elsif in_bracket and c == "]"
|
636
|
+
in_bracket = false
|
637
|
+
if token.length > 0
|
638
|
+
tokens << token
|
639
|
+
token = ""
|
640
|
+
end
|
641
|
+
tokens << "]"
|
615
642
|
else
|
616
643
|
token << c
|
617
644
|
end
|
@@ -135,7 +135,7 @@ module JunglePath
|
|
135
135
|
if replacement_table.view
|
136
136
|
puts "has view"
|
137
137
|
#also run any pre query hook for view:
|
138
|
-
replacement_table.view.pre_query_hook(engine.identity, replacement_table, engine.db,
|
138
|
+
replacement_table.view.pre_query_hook(engine.identity, replacement_table, engine.db, frm.parameters)
|
139
139
|
table_replacement_text = replacement_table.view.build_call(engine.identity, replacement_table)
|
140
140
|
else
|
141
141
|
puts "no view"
|
data/lib/jungle_path/version.rb
CHANGED