sishen-hbase-ruby 0.2.7 → 0.2.8
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/Rakefile +2 -2
- data/hbase-ruby.gemspec +1 -1
- data/lib/hbase/client.rb +4 -0
- data/lib/hbase/operation/row_operation.rb +10 -1
- metadata +1 -1
data/Rakefile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'hoe'
|
3
3
|
|
4
|
-
Hoe.new('hbase-ruby', '0.2.6') do |p|
|
5
|
-
p.rubyforge_name = 'hbase-ruby'
|
4
|
+
Hoe.new('sishen-hbase-ruby', '0.2.6') do |p|
|
5
|
+
p.rubyforge_name = 'sishen-hbase-ruby'
|
6
6
|
p.author = 'Ye Dingding'
|
7
7
|
p.email = 'yedingding@gmail.com'
|
8
8
|
p.url = 'http://sishen.lifegoo.com'
|
data/hbase-ruby.gemspec
CHANGED
data/lib/hbase/client.rb
CHANGED
@@ -19,6 +19,10 @@ module HBase
|
|
19
19
|
raise "invalid http url: #{url}"
|
20
20
|
end
|
21
21
|
|
22
|
+
unless @url.path =~ /^\/api/
|
23
|
+
@url += (@url[-1] == '/' ? "api" : "/api")
|
24
|
+
end
|
25
|
+
|
22
26
|
# Not actually opening the connection yet, just setting up the persistent connection.
|
23
27
|
@connection = Net::HTTP.new(@url.host, @url.port)
|
24
28
|
@connection.read_timeout = opts[:timeout] if opts[:timeout]
|
@@ -1,6 +1,14 @@
|
|
1
1
|
module HBase
|
2
2
|
module Operation
|
3
3
|
module RowOperation
|
4
|
+
Converter = {
|
5
|
+
'&' => '&',
|
6
|
+
'<' => '<',
|
7
|
+
'>' => '>',
|
8
|
+
"'" => ''',
|
9
|
+
'"' => '"'
|
10
|
+
}
|
11
|
+
|
4
12
|
def row_timestamps(table_name, name)
|
5
13
|
raise NotImplementedError, "Currently not supported in native hbase client"
|
6
14
|
end
|
@@ -35,7 +43,8 @@ module HBase
|
|
35
43
|
end
|
36
44
|
xml_data ="<?xml version='1.0' encoding='UTF-8'?><columns>"
|
37
45
|
data.each do |d|
|
38
|
-
|
46
|
+
escape_name = d[:name].gsub(/[&<>'"]/) { |match| Converter[match] }
|
47
|
+
xml_data << "<column><name>#{escape_name}</name>"
|
39
48
|
xml_data << "<value>#{[d[:value]].pack("m") rescue ''}</value></column>"
|
40
49
|
end
|
41
50
|
xml_data << "</columns>"
|