pg_data_encoder 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,8 +18,8 @@ module PgDataEncoder
18
18
  @io.write([row.size].pack("n"))
19
19
  row.each_with_index {|col, index|
20
20
  encode_field(@buffer, col, index)
21
- if @buffer.size > (1024 * 100)
22
- @buffer.rewind
21
+ if @buffer.size > 0
22
+ #@buffer.rewind
23
23
  @io.write(@buffer.read)
24
24
  @buffer.reopen
25
25
  end
@@ -29,7 +29,7 @@ module PgDataEncoder
29
29
  def close
30
30
  @closed = true
31
31
  if @buffer.size > 0
32
- @buffer.rewind
32
+ #@buffer.rewind
33
33
  @io.write(@buffer.read)
34
34
  @buffer.reopen
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module PgDataEncoder
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
Binary file
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "multiline hstore" do
4
+ it 'should encode multiline hstore data correctly' do
5
+ encoder = PgDataEncoder::EncodeForCopy.new
6
+ encoder.add [1, {a: 1, b: 2}]
7
+ encoder.add [2, {a: 1, b: 3}]
8
+ encoder.close
9
+ io = encoder.get_io
10
+ existing_data = filedata("multiline_hstore.dat")
11
+ str = io.read
12
+ io.class.name.should == "StringIO"
13
+ str.force_encoding("ASCII-8BIT")
14
+ #File.open("spec/fixtures/output.dat", "w:ASCII-8BIT") {|out| out.write(str) }
15
+ str.should == existing_data
16
+ end
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_data_encoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-06 00:00:00.000000000 Z
12
+ date: 2014-05-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -80,11 +80,13 @@ files:
80
80
  - spec/fixtures/intarray.dat
81
81
  - spec/fixtures/just_an_array.dat
82
82
  - spec/fixtures/just_an_array2.dat
83
+ - spec/fixtures/multiline_hstore.dat
83
84
  - spec/fixtures/output.dat
84
85
  - spec/fixtures/timestamp.dat
85
86
  - spec/fixtures/trueclass.dat
86
87
  - spec/fixtures/uuid.dat
87
88
  - spec/fixtures/uuid_array.dat
89
+ - spec/multiline_spec.rb
88
90
  - spec/spec_helper.rb
89
91
  - spec/verify_data_formats_spec.rb
90
92
  homepage: https://github.com/pbrumm/pg_data_encoder
@@ -131,11 +133,13 @@ test_files:
131
133
  - spec/fixtures/intarray.dat
132
134
  - spec/fixtures/just_an_array.dat
133
135
  - spec/fixtures/just_an_array2.dat
136
+ - spec/fixtures/multiline_hstore.dat
134
137
  - spec/fixtures/output.dat
135
138
  - spec/fixtures/timestamp.dat
136
139
  - spec/fixtures/trueclass.dat
137
140
  - spec/fixtures/uuid.dat
138
141
  - spec/fixtures/uuid_array.dat
142
+ - spec/multiline_spec.rb
139
143
  - spec/spec_helper.rb
140
144
  - spec/verify_data_formats_spec.rb
141
145
  has_rdoc: