ddbcli 0.3.5 → 0.3.6
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/README.md +10 -12
- data/lib/ddbcli/cli/help.rb +4 -3
- data/lib/ddbcli/ddb-driver.rb +15 -0
- data/lib/ddbcli/ddb-parser.tab.rb +410 -391
- data/lib/ddbcli/ddb-parser.y +11 -4
- data/lib/ddbcli/version.rb +1 -1
- data/spec/spec_helper.rb +9 -5
- metadata +3 -3
data/lib/ddbcli/ddb-parser.y
CHANGED
@@ -205,13 +205,13 @@ rule
|
|
205
205
|
struct(:DESCRIBE, :table => val[1])
|
206
206
|
}
|
207
207
|
|
208
|
-
select_stmt : SELECT attrs_to_get FROM IDENTIFIER use_index_clause select_where_clause order_clause limit_clause
|
208
|
+
select_stmt : SELECT attrs_to_get FROM IDENTIFIER use_index_clause select_where_clause having_clause order_clause limit_clause
|
209
209
|
{
|
210
|
-
struct(:SELECT, :attrs => val[1], :table => val[3], :index => val[4], :conds => val[5], :
|
210
|
+
struct(:SELECT, :attrs => val[1], :table => val[3], :index => val[4], :conds => val[5], :having => val[6], :order_asc => val[7], :limit => val[8], :count => false)
|
211
211
|
}
|
212
|
-
| SELECT COUNT '(' '*' ')' FROM IDENTIFIER use_index_clause select_where_clause order_clause limit_clause
|
212
|
+
| SELECT COUNT '(' '*' ')' FROM IDENTIFIER use_index_clause select_where_clause having_clause order_clause limit_clause
|
213
213
|
{
|
214
|
-
struct(:SELECT, :attrs => [], :table => val[6], :index => val[7], :conds => val[8], :
|
214
|
+
struct(:SELECT, :attrs => [], :table => val[6], :index => val[7], :conds => val[8], :having => val[9], :order_asc => val[10], :limit => val[11], :count => true)
|
215
215
|
}
|
216
216
|
|
217
217
|
scan_stmt : SELECT ALL attrs_to_get FROM IDENTIFIER scan_where_clause limit_clause
|
@@ -372,6 +372,12 @@ rule
|
|
372
372
|
val[1]
|
373
373
|
}
|
374
374
|
|
375
|
+
having_clause :
|
376
|
+
| HAVING scan_expr_list
|
377
|
+
{
|
378
|
+
val[1]
|
379
|
+
}
|
380
|
+
|
375
381
|
update_stmt : UPDATE IDENTIFIER set_or_add attr_to_update_list update_where_clause
|
376
382
|
{
|
377
383
|
struct(:UPDATE, :table => val[1], :action => val[2], :attrs => val[3], :conds => val[4])
|
@@ -557,6 +563,7 @@ KEYWORDS = %w(
|
|
557
563
|
GET
|
558
564
|
GLOBAL
|
559
565
|
HASH
|
566
|
+
HAVING
|
560
567
|
INCLUDE
|
561
568
|
INDEX
|
562
569
|
INSERT
|
data/lib/ddbcli/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -7,20 +7,24 @@ require 'tempfile'
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def ddbcli(input = nil, args = [])
|
10
|
+
tempfile = nil
|
11
|
+
|
10
12
|
if input
|
11
|
-
Tempfile.open('ddbcli')
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
tempfile = Tempfile.open('ddbcli')
|
14
|
+
tempfile << input
|
15
|
+
tempfile.flush
|
16
|
+
tempfile.rewind
|
17
|
+
input = tempfile.path
|
15
18
|
end
|
16
19
|
|
17
20
|
cmd = File.expand_path(File.dirname(__FILE__) + '/../bin/ddbcli')
|
18
21
|
out = nil
|
19
22
|
|
20
|
-
args = ['--url', 'localhost:8000'] + args
|
23
|
+
args = ['--url', ENV['DYNAMODB_URL'] || 'localhost:8000'] + args
|
21
24
|
|
22
25
|
if input
|
23
26
|
out = `cat #{input} | #{cmd} #{args.join(' ')} 2>&1`
|
27
|
+
tempfile.close if tempfile
|
24
28
|
else
|
25
29
|
out = `#{cmd} #{args.join(' ')} 2>&1`
|
26
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddbcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
125
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.0.14
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: ddbcli is an interactive command-line client of Amazon DynamoDB.
|