sishen-hbase-ruby 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{hbase-ruby}
3
- s.version = "0.2.7"
3
+ s.version = "0.2.8"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Ye Dingding"]
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
+ '<' => '&lt;',
7
+ '>' => '&gt;',
8
+ "'" => '&apos;',
9
+ '"' => '&quot;'
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
- xml_data << "<column><name>#{d[:name]}</name>"
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>"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sishen-hbase-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ye Dingding