rsql 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rsql +25 -7
- data/example.rsqlrc +12 -4
- data/lib/rsql.rb +1 -1
- metadata +3 -3
data/bin/rsql
CHANGED
@@ -61,15 +61,33 @@ end
|
|
61
61
|
eval_context.load(rc_fn, false) if File.exists?(rc_fn)
|
62
62
|
|
63
63
|
def get_password(prompt)
|
64
|
-
iswin = nil != (RUBY_PLATFORM =~ /(win|w)32$/)
|
65
64
|
STDOUT.print(prompt)
|
66
65
|
STDOUT.flush
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
66
|
+
password = ''
|
67
|
+
|
68
|
+
if RUBY_PLATFORM.match(/(win|w)32$/)
|
69
|
+
require 'Win32API'
|
70
|
+
begin
|
71
|
+
wingetc = Win32API.new("msvcrt", "_getch", [ ], "L")
|
72
|
+
rescue Exception
|
73
|
+
wingetc = Win32API.new("crtdll", "_getch", [ ], "L")
|
74
|
+
end
|
75
|
+
while true do
|
76
|
+
ch = wingetc.Call
|
77
|
+
break if ch == ?\n || ch == ?\r
|
78
|
+
password << ch
|
79
|
+
end
|
80
|
+
else
|
81
|
+
begin
|
82
|
+
`stty -echo`
|
83
|
+
password = STDIN.gets
|
84
|
+
password.chomp!
|
85
|
+
ensure
|
86
|
+
`stty echo`
|
87
|
+
STDOUT.puts
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
73
91
|
return password
|
74
92
|
end
|
75
93
|
|
data/example.rsqlrc
CHANGED
@@ -76,14 +76,22 @@ DROP TEMPORARY TABLE IF EXISTS #{@rsql_table}
|
|
76
76
|
#
|
77
77
|
register :fill_table, :desc => 'Populate the example table.' do
|
78
78
|
sql = ''
|
79
|
-
|
80
|
-
sql <<
|
79
|
+
9.times do |i|
|
80
|
+
sql << %{
|
81
81
|
INSERT IGNORE INTO #{@rsql_table}
|
82
82
|
SET name='fancy#{i}',
|
83
83
|
value=#{i**i},
|
84
84
|
stuff=#{hexify(rand((i+1)**100))};
|
85
|
-
|
85
|
+
}
|
86
86
|
end
|
87
|
+
# one more that isn't randomly generated so we can reference it
|
88
|
+
# later
|
89
|
+
sql << %{
|
90
|
+
INSERT IGNORE INTO #{@rsql_table}
|
91
|
+
SET name='fancy9',
|
92
|
+
value=#{9**9},
|
93
|
+
stuff=0x1234567891234567891234567890;
|
94
|
+
}
|
87
95
|
sqeeze!(sql)
|
88
96
|
end
|
89
97
|
|
@@ -266,7 +274,7 @@ end
|
|
266
274
|
#
|
267
275
|
# RSQL makes querying for hex strings from within a recipe easy too.
|
268
276
|
#
|
269
|
-
# rsql> .find_stuff
|
277
|
+
# rsql> .find_stuff 0x1234567891234567891234567890;
|
270
278
|
#
|
271
279
|
register :find_stuff, :stuff, %q{
|
272
280
|
SELECT * FROM #{@rsql_table} WHERE stuff=#{hexify stuff}
|
data/lib/rsql.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 7
|
10
|
+
version: 0.1.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brad Robel-Forrest
|