pg 0.7.9.2008.10.13 → 0.8.0

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/ext/pg.h CHANGED
@@ -3,7 +3,6 @@
3
3
  #include <sys/types.h>
4
4
 
5
5
  #include "ruby.h"
6
- #include "rubyio.h"
7
6
  #include "libpq-fe.h"
8
7
  #include "libpq/libpq-fs.h" /* large-object interface */
9
8
 
@@ -31,7 +30,13 @@
31
30
 
32
31
  #ifdef RUBY_18_COMPAT
33
32
  #define rb_io_stdio_file GetWriteFile
33
+ #include "rubyio.h"
34
+ #else
35
+ #include "ruby/io.h"
34
36
  #endif
35
37
 
38
+ #if defined(_WIN32)
39
+ __declspec(dllexport)
40
+ #endif
36
41
  void Init_pg(void);
37
42
 
@@ -0,0 +1,26 @@
1
+ 
2
+ Microsoft Visual Studio Solution File, Format Version 10.00
3
+ # Visual Studio 2008
4
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pg", "pg_18\pg.vcproj", "{9A8BF0C8-1D75-4DC0-8D84-BAEFD693795E}"
5
+ EndProject
6
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pg_19", "pg_19\pg_19.vcproj", "{2EE30C74-074F-4611-B39B-38D5F3C9B071}"
7
+ EndProject
8
+ Global
9
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
10
+ Debug|Win32 = Debug|Win32
11
+ Release|Win32 = Release|Win32
12
+ EndGlobalSection
13
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
14
+ {9A8BF0C8-1D75-4DC0-8D84-BAEFD693795E}.Debug|Win32.ActiveCfg = Debug|Win32
15
+ {9A8BF0C8-1D75-4DC0-8D84-BAEFD693795E}.Debug|Win32.Build.0 = Debug|Win32
16
+ {9A8BF0C8-1D75-4DC0-8D84-BAEFD693795E}.Release|Win32.ActiveCfg = Release|Win32
17
+ {9A8BF0C8-1D75-4DC0-8D84-BAEFD693795E}.Release|Win32.Build.0 = Release|Win32
18
+ {2EE30C74-074F-4611-B39B-38D5F3C9B071}.Debug|Win32.ActiveCfg = Debug|Win32
19
+ {2EE30C74-074F-4611-B39B-38D5F3C9B071}.Debug|Win32.Build.0 = Debug|Win32
20
+ {2EE30C74-074F-4611-B39B-38D5F3C9B071}.Release|Win32.ActiveCfg = Release|Win32
21
+ {2EE30C74-074F-4611-B39B-38D5F3C9B071}.Release|Win32.Build.0 = Release|Win32
22
+ EndGlobalSection
23
+ GlobalSection(SolutionProperties) = preSolution
24
+ HideSolutionNode = FALSE
25
+ EndGlobalSection
26
+ EndGlobal
@@ -8,22 +8,21 @@ describe PGconn do
8
8
 
9
9
  before( :all ) do
10
10
  puts "====== TESTING PGconn ======"
11
- @test_directory = "#{Dir.getwd}/tmp_test_#{rand}"
12
- @test_pgdata = @test_directory + '/data'
11
+ @test_directory = File.join(Dir.getwd, "tmp_test_#{rand}")
12
+ @test_pgdata = File.join(@test_directory, 'data')
13
13
  if File.exists?(@test_directory) then
14
14
  raise "test directory exists!"
15
15
  end
16
- @conninfo = "host='#{@test_directory}' dbname=test"
16
+ @port = 54321
17
+ @conninfo = "host=localhost port=#{@port} dbname=test"
17
18
  Dir.mkdir(@test_directory)
18
19
  Dir.mkdir(@test_pgdata)
19
20
  cmds = []
20
- cmds << "initdb -D '#{@test_pgdata}'"
21
- cmds << "pg_ctl -D '#{@test_pgdata}' " +
22
- %!-o "--unix-socket-directory='#{@test_directory}' ! +
23
- %!--listen-addresses=''" ! +
24
- "start"
25
- cmds << "sleep 2"
26
- cmds << "createdb -h '#{@test_directory}' test"
21
+ cmds << "initdb -D \"#{@test_pgdata}\""
22
+ cmds << "pg_ctl -o \"-p #{@port}\" -D \"#{@test_pgdata}\" start"
23
+ cmds << "sleep 5"
24
+ cmds << "createdb -p #{@port} test"
25
+
27
26
  cmds.each do |cmd|
28
27
  if not system(cmd) then
29
28
  raise "Error executing cmd: #{cmd}: #{$?}"
@@ -39,15 +38,15 @@ describe PGconn do
39
38
  end
40
39
 
41
40
  it "should connect using 7 arguments converted to strings" do
42
- tmpconn = PGconn.connect(@test_directory, 5432, nil, nil, :test, nil, nil)
41
+ tmpconn = PGconn.connect('localhost', @port, nil, nil, :test, nil, nil)
43
42
  tmpconn.status.should== PGconn::CONNECTION_OK
44
43
  tmpconn.finish
45
44
  end
46
45
 
47
46
  it "should connect using hash" do
48
47
  tmpconn = PGconn.connect(
49
- :host => @test_directory,
50
- :port => 5432,
48
+ :host => 'localhost',
49
+ :port => @port,
51
50
  :dbname => :test)
52
51
  tmpconn.status.should== PGconn::CONNECTION_OK
53
52
  tmpconn.finish
@@ -82,23 +81,27 @@ describe PGconn do
82
81
  res[0]['n'].should == '1'
83
82
  end
84
83
 
85
- it "should trace and untrace client-server communication" do
86
- # be careful to explicitly close files so that the
87
- # directory can be removed and we don't have to wait for
88
- # the GC to run.
89
- expected_trace_data = open('spec/data/expected_trace.out').read
90
- trace_file = open("#{@test_directory}/test_trace.out", 'w')
91
- @conn.trace(trace_file)
92
- trace_file.close
93
- res = @conn.exec("SELECT 1 AS one")
94
- @conn.untrace
95
- res = @conn.exec("SELECT 2 AS two")
96
- trace_file = open("#{@test_directory}/test_trace.out")
97
- trace_data = trace_file.read
98
- trace_file.close
99
- trace_data.should == expected_trace_data
100
- end
84
+ unless RUBY_PLATFORM =~ /mswin|mingw/
85
+ it "should trace and untrace client-server communication" do
86
+ # be careful to explicitly close files so that the
87
+ # directory can be removed and we don't have to wait for
88
+ # the GC to run.
101
89
 
90
+ expected_trace_file = File.join(Dir.getwd, "spec/data", "expected_trace.out")
91
+ expected_trace_data = open(expected_trace_file, 'rb').read
92
+ trace_file = open(File.join(@test_directory, "test_trace.out"), 'wb')
93
+ @conn.trace(trace_file)
94
+ trace_file.close
95
+ res = @conn.exec("SELECT 1 AS one")
96
+ @conn.untrace
97
+ res = @conn.exec("SELECT 2 AS two")
98
+ trace_file = open(File.join(@test_directory, "test_trace.out"), 'rb')
99
+ trace_data = trace_file.read
100
+ trace_file.close
101
+ trace_data.should == expected_trace_data
102
+ end
103
+ end
104
+
102
105
  it "should cancel a query" do
103
106
  error = false
104
107
  @conn.send_query("SELECT pg_sleep(1000)")
@@ -114,8 +117,8 @@ describe PGconn do
114
117
  puts ""
115
118
  @conn.finish
116
119
  cmds = []
117
- cmds << "pg_ctl -D '#{@test_pgdata}' stop"
118
- cmds << "rm -rf '#{@test_directory}'"
120
+ cmds << "pg_ctl -D \"#{@test_pgdata}\" stop"
121
+ cmds << "rm -rf \"#{@test_directory}\""
119
122
  cmds.each do |cmd|
120
123
  if not system(cmd) then
121
124
  raise "Error executing cmd: #{cmd}: #{$?}"
@@ -8,22 +8,21 @@ describe PGconn do
8
8
 
9
9
  before( :all ) do
10
10
  puts "====== TESTING PGresult ======"
11
- @test_directory = "#{Dir.getwd}/tmp_test_#{rand}"
12
- @test_pgdata = @test_directory + '/data'
11
+ @test_directory = File.join(Dir.getwd, "tmp_test_#{rand}")
12
+ @test_pgdata = File.join(@test_directory, 'data')
13
13
  if File.exists?(@test_directory) then
14
14
  raise "test directory exists!"
15
15
  end
16
- @conninfo = "host='#{@test_directory}' dbname=test"
16
+ @port = 54321
17
+ @conninfo = "host=localhost port=#{@port} dbname=test"
17
18
  Dir.mkdir(@test_directory)
18
19
  Dir.mkdir(@test_pgdata)
19
20
  cmds = []
20
- cmds << "initdb -D '#{@test_pgdata}'"
21
- cmds << "pg_ctl -D '#{@test_pgdata}' " +
22
- %!-o "--unix-socket-directory='#{@test_directory}' ! +
23
- %!--listen-addresses=''" ! +
24
- "start"
25
- cmds << "sleep 2"
26
- cmds << "createdb -h '#{@test_directory}' test"
21
+ cmds << "initdb -D \"#{@test_pgdata}\""
22
+ cmds << "pg_ctl -o \"-p #{@port}\" -D \"#{@test_pgdata}\" start"
23
+ cmds << "sleep 5"
24
+ cmds << "createdb -p #{@port} test"
25
+
27
26
  cmds.each do |cmd|
28
27
  if not system(cmd) then
29
28
  raise "Error executing cmd: #{cmd}: #{$?}"
@@ -56,14 +55,16 @@ describe PGconn do
56
55
  end
57
56
 
58
57
  it "should return the same bytes in binary format that are sent in binary format" do
59
- bytes = File.open('spec/data/random_binary_data').read
58
+ binary_file = File.join(Dir.pwd, 'spec/data', 'random_binary_data')
59
+ bytes = File.open(binary_file, 'rb').read
60
60
  res = @conn.exec('VALUES ($1::bytea)',
61
61
  [ { :value => bytes, :format => 1 } ], 1)
62
62
  res[0]['column1'].should== bytes
63
63
  end
64
64
 
65
65
  it "should return the same bytes in binary format that are sent as inline text" do
66
- in_bytes = File.open('spec/data/random_binary_data').read
66
+ binary_file = File.join(Dir.pwd, 'spec/data', 'random_binary_data')
67
+ in_bytes = File.open(binary_file, 'rb').read
67
68
  out_bytes = nil
68
69
  @conn.transaction do |conn|
69
70
  conn.exec("SET standard_conforming_strings=on")
@@ -74,14 +75,17 @@ describe PGconn do
74
75
  end
75
76
 
76
77
  it "should return the same bytes in text format that are sent in binary format" do
77
- bytes = File.open('spec/data/random_binary_data').read
78
+ binary_file = File.join(Dir.pwd, 'spec/data', 'random_binary_data')
79
+ bytes = File.open(binary_file, 'rb').read
78
80
  res = @conn.exec('VALUES ($1::bytea)',
79
81
  [ { :value => bytes, :format => 1 } ])
80
82
  PGconn.unescape_bytea(res[0]['column1']).should== bytes
81
83
  end
82
84
 
83
85
  it "should return the same bytes in text format that are sent as inline text" do
84
- in_bytes = File.open('spec/data/random_binary_data').read
86
+ binary_file = File.join(Dir.pwd, 'spec/data', 'random_binary_data')
87
+ in_bytes = File.open(binary_file, 'rb').read
88
+
85
89
  out_bytes = nil
86
90
  @conn.transaction do |conn|
87
91
  conn.exec("SET standard_conforming_strings=on")
@@ -95,8 +99,8 @@ describe PGconn do
95
99
  puts ""
96
100
  @conn.finish
97
101
  cmds = []
98
- cmds << "pg_ctl -D '#{@test_pgdata}' stop"
99
- cmds << "rm -rf '#{@test_directory}'"
102
+ cmds << "pg_ctl -D \"#{@test_pgdata}\" stop"
103
+ cmds << "rm -rf \"#{@test_directory}\""
100
104
  cmds.each do |cmd|
101
105
  if not system(cmd) then
102
106
  raise "Error executing cmd: #{cmd}: #{$?}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.9.2008.10.13
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yukihiro Matsumoto
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2008-10-13 00:00:00 -07:00
16
+ date: 2009-03-29 00:00:00 -07:00
17
17
  default_executable:
18
18
  dependencies: []
19
19
 
@@ -26,14 +26,27 @@ extensions:
26
26
  extra_rdoc_files:
27
27
  - ext/pg.c
28
28
  files:
29
+ - Rakefile
30
+ - README
31
+ - LICENSE
32
+ - COPYING.txt
33
+ - ChangeLog
34
+ - Contributors
35
+ - GPL
36
+ - BSD
29
37
  - doc/postgres.html
30
38
  - doc/postgres.jp.html
31
39
  - ext/extconf.rb
32
40
  - ext/pg.h
41
+ - ext/vc
33
42
  - ext/compat.c
34
43
  - ext/pg.c
44
+ - ext/mingw
35
45
  - ext/mkrf_config.rb
36
46
  - ext/compat.h
47
+ - ext/mingw/Rakefile
48
+ - ext/mingw/build.rake
49
+ - ext/vc/pg.sln
37
50
  - sample/losample.rb
38
51
  - sample/psqlHelp.rb
39
52
  - sample/psql.rb
@@ -56,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
69
  requirements:
57
70
  - - ">="
58
71
  - !ruby/object:Gem::Version
59
- version: "0"
72
+ version: 1.8.4
60
73
  version:
61
74
  required_rubygems_version: !ruby/object:Gem::Requirement
62
75
  requirements: