sdbcli 0.3.0 → 0.3.1
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.
- data/README +5 -7
- data/bin/sdbcli +11 -6
- metadata +3 -3
data/README
CHANGED
@@ -28,7 +28,7 @@ https://bitbucket.org/winebarrel/sdbcli
|
|
28
28
|
|
29
29
|
== Example
|
30
30
|
|
31
|
-
ap-northeast-1> help
|
31
|
+
ap-northeast-1> .help
|
32
32
|
SHOW domains
|
33
33
|
displays a domain list
|
34
34
|
|
@@ -52,15 +52,15 @@ https://bitbucket.org/winebarrel/sdbcli
|
|
52
52
|
|
53
53
|
SELECT output_list FROM domain_name [where expression] [sort_instructions] [limit limit]
|
54
54
|
queries using the SELECT statement
|
55
|
-
|
55
|
+
|
56
56
|
DESC domain_name
|
57
57
|
displays information about the domain;
|
58
|
-
|
58
|
+
|
59
59
|
ap-northeast-1> select * from test;
|
60
60
|
---
|
61
61
|
- [itemname1, {attr1: val1, attr2: val2}]
|
62
62
|
- [itemname2, {attr1: val1, attr2: val2}]
|
63
|
-
|
63
|
+
|
64
64
|
ap-northeast-1> select count(*) from `test-2`;
|
65
65
|
---
|
66
66
|
- [Domain, {Count: "100"}]
|
@@ -78,10 +78,8 @@ see http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide/Quoti
|
|
78
78
|
- itemname2
|
79
79
|
- attr1: val1
|
80
80
|
attr2: val2
|
81
|
-
|
82
|
-
|
81
|
+
|
83
82
|
shell> echo 'select * from test' | sdbcli
|
84
83
|
---
|
85
84
|
- [itemname1, {attr1: val1, attr2: val2}]
|
86
85
|
- [itemname2, {attr1: val1, attr2: val2}]
|
87
|
-
|
data/bin/sdbcli
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
$LOAD_PATH << File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib')
|
3
3
|
|
4
|
-
Version = '0.3.
|
4
|
+
Version = '0.3.1'
|
5
5
|
HISTORY_FILE = File.join((ENV['HOME'] || ENV['USERPROFILE'] || '.'), '.sdbcli_history')
|
6
6
|
|
7
7
|
require 'rubygems'
|
@@ -45,7 +45,7 @@ def output_error(msg)
|
|
45
45
|
$stderr.puts "ERROR: #{msg}\n\n"
|
46
46
|
end
|
47
47
|
|
48
|
-
def execute(src)
|
48
|
+
def execute(src, show_rows = false)
|
49
49
|
ss = StringScanner.new(src.dup)
|
50
50
|
|
51
51
|
while query = ss.scan_until(/(?:;|\\G)/i)
|
@@ -68,9 +68,14 @@ def execute(src)
|
|
68
68
|
out = $runner.execute(query, inline)
|
69
69
|
|
70
70
|
if out
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
str = YAML.dump(out).sub(/(?:\r\n|\r|\n)*\Z/, "\n")
|
72
|
+
|
73
|
+
if show_rows and out.kind_of?(Array)
|
74
|
+
str << "# #{out.length} rows in set\n"
|
75
|
+
end
|
76
|
+
|
77
|
+
str << "\n"
|
78
|
+
puts str
|
74
79
|
end
|
75
80
|
end
|
76
81
|
|
@@ -177,7 +182,7 @@ while buf = Readline.readline(prompt, true)
|
|
177
182
|
|
178
183
|
begin
|
179
184
|
src << (' ' + buf)
|
180
|
-
execute(src)
|
185
|
+
execute(src, true)
|
181
186
|
rescue Racc::ParseError
|
182
187
|
output_error 'Parse error'
|
183
188
|
rescue => e
|
metadata
CHANGED