postgres-copy 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/postgres-copy/acts_as_copy_target.rb +22 -21
- data/postgres-copy.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06fb58609cde69655a230014265b1617d26e6b4a
|
4
|
+
data.tar.gz: 925c7d2f5b4d0ac68c8ff579dbaacfd0ece9823d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1363641eb2b61078691ad937a0f7dbbc682f8105ea8f7684646e66401ad344658965b1bca5741caecee264b26109e1a7796fce0cb50cdac40880810ca9afb2a8
|
7
|
+
data.tar.gz: 356c74bb431c9b6713054b41a6d51b1d4033477729e96c90f1a4b2d876019d586727140bc92d22752cd02553d48c35821d4d0cf3d6ea1dd215a8312bc668f0e1
|
data/Gemfile.lock
CHANGED
@@ -19,9 +19,10 @@ module PostgresCopy
|
|
19
19
|
raise "You have to choose between exporting to a file or receiving the lines inside a block" if block_given?
|
20
20
|
connection.execute "COPY (#{self.all.to_sql}) TO #{sanitize(path)} WITH #{options_string}"
|
21
21
|
else
|
22
|
-
connection.
|
23
|
-
|
24
|
-
|
22
|
+
connection.raw_connection.copy_data "COPY (#{self.all.to_sql}) TO STDOUT WITH #{options_string}" do
|
23
|
+
while line = connection.raw_connection.get_copy_data do
|
24
|
+
yield(line) if block_given?
|
25
|
+
end
|
25
26
|
end
|
26
27
|
end
|
27
28
|
return self
|
@@ -67,28 +68,28 @@ module PostgresCopy
|
|
67
68
|
|
68
69
|
columns_list = columns_list.map{|c| options[:map][c.to_s] } if options[:map]
|
69
70
|
columns_string = columns_list.size > 0 ? "(\"#{columns_list.join('","')}\")" : ""
|
70
|
-
connection.
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
connection.raw_connection.copy_data %{COPY #{table} #{columns_string} FROM STDIN #{options_string}} do
|
72
|
+
if options[:format] == :binary
|
73
|
+
bytes = 0
|
74
|
+
begin
|
75
|
+
while line = io.readpartial(10240)
|
76
|
+
connection.raw_connection.put_copy_data line
|
77
|
+
bytes += line.bytesize
|
78
|
+
end
|
79
|
+
rescue EOFError
|
77
80
|
end
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
else
|
82
|
+
while line = io.gets do
|
83
|
+
next if line.strip.size == 0
|
84
|
+
if block_given?
|
85
|
+
row = line.strip.split(options[:delimiter])
|
86
|
+
yield(row)
|
87
|
+
line = row.join(options[:delimiter]) + "\n"
|
88
|
+
end
|
89
|
+
connection.raw_connection.put_copy_data line
|
87
90
|
end
|
88
|
-
connection.raw_connection.put_copy_data line
|
89
91
|
end
|
90
92
|
end
|
91
|
-
connection.raw_connection.put_copy_end
|
92
93
|
end
|
93
94
|
end
|
94
95
|
|
data/postgres-copy.gemspec
CHANGED
@@ -5,7 +5,7 @@ $:.unshift lib unless $:.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "postgres-copy"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.9.0"
|
9
9
|
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.required_ruby_version = ">= 1.9.3"
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.require_paths = ["lib"]
|
23
23
|
s.summary = "Put COPY command functionality in ActiveRecord's model class"
|
24
24
|
|
25
|
-
s.add_dependency "pg"
|
25
|
+
s.add_dependency "pg", ">= 0.17"
|
26
26
|
s.add_dependency "activerecord", '>= 4.0'
|
27
27
|
s.add_dependency "rails", '>= 4.0'
|
28
28
|
s.add_dependency "responders"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postgres-copy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diogo Biazus
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.17'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '0.17'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|