pg 1.1.0.pre20180730171000 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/ChangeLog +6595 -0
  5. data/History.rdoc +3 -8
  6. data/Manifest.txt +70 -2
  7. data/Rakefile +0 -1
  8. data/ext/pg.c +4 -1
  9. data/ext/pg.h +7 -0
  10. data/ext/pg_binary_decoder.c +1 -1
  11. data/ext/pg_binary_encoder.c +1 -1
  12. data/ext/pg_connection.c +8 -8
  13. data/ext/pg_result.c +1 -1
  14. data/ext/pg_text_decoder.c +1 -1
  15. data/ext/pg_text_encoder.c +6 -7
  16. data/ext/pg_tuple.c +4 -3
  17. data/ext/pg_type_map.c +1 -1
  18. data/ext/pg_type_map_all_strings.c +1 -1
  19. data/ext/pg_type_map_by_class.c +1 -1
  20. data/ext/pg_type_map_by_column.c +1 -1
  21. data/ext/pg_type_map_by_mri_type.c +1 -1
  22. data/ext/pg_type_map_by_oid.c +1 -1
  23. data/ext/pg_type_map_in_ruby.c +1 -1
  24. data/ext/util.c +1 -1
  25. data/lib/pg.rb +2 -2
  26. data/spec/pg/basic_type_mapping_spec.rb +4 -4
  27. data/spec/pg/connection_spec.rb +58 -13
  28. data/spec/pg/tuple_spec.rb +16 -2
  29. data/spec/pg/type_spec.rb +6 -0
  30. metadata +35 -69
  31. metadata.gz.sig +0 -0
  32. data/.gems +0 -6
  33. data/.hgignore +0 -21
  34. data/.hgsigs +0 -29
  35. data/.hgtags +0 -36
  36. data/.hoerc +0 -2
  37. data/.irbrc +0 -23
  38. data/.pryrc +0 -23
  39. data/.tm_properties +0 -21
  40. data/.travis.yml +0 -41
  41. data/Gemfile +0 -2
  42. data/appveyor.yml +0 -50
  43. data/certs/ged.pem +0 -26
  44. data/misc/openssl-pg-segfault.rb +0 -31
  45. data/misc/postgres/History.txt +0 -9
  46. data/misc/postgres/Manifest.txt +0 -5
  47. data/misc/postgres/README.txt +0 -21
  48. data/misc/postgres/Rakefile +0 -21
  49. data/misc/postgres/lib/postgres.rb +0 -16
  50. data/misc/ruby-pg/History.txt +0 -9
  51. data/misc/ruby-pg/Manifest.txt +0 -5
  52. data/misc/ruby-pg/README.txt +0 -21
  53. data/misc/ruby-pg/Rakefile +0 -21
  54. data/misc/ruby-pg/lib/ruby/pg.rb +0 -16
  55. data/pg.gemspec +0 -61
  56. data/sample/array_insert.rb +0 -20
  57. data/sample/async_api.rb +0 -106
  58. data/sample/async_copyto.rb +0 -39
  59. data/sample/async_mixed.rb +0 -56
  60. data/sample/check_conn.rb +0 -21
  61. data/sample/copydata.rb +0 -71
  62. data/sample/copyfrom.rb +0 -81
  63. data/sample/copyto.rb +0 -19
  64. data/sample/cursor.rb +0 -21
  65. data/sample/disk_usage_report.rb +0 -177
  66. data/sample/issue-119.rb +0 -94
  67. data/sample/losample.rb +0 -69
  68. data/sample/minimal-testcase.rb +0 -17
  69. data/sample/notify_wait.rb +0 -72
  70. data/sample/pg_statistics.rb +0 -285
  71. data/sample/replication_monitor.rb +0 -222
  72. data/sample/test_binary_values.rb +0 -33
  73. data/sample/wal_shipper.rb +0 -434
  74. data/sample/warehouse_partitions.rb +0 -311
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source "https://rubygems.org/"
2
- gemspec
@@ -1,50 +0,0 @@
1
- init:
2
- - set PATH=C:/Ruby%ruby_version%/bin;c:/Program Files/Git/cmd;c:/Windows/system32;C:/Windows/System32/WindowsPowerShell/v1.0;C:/Program Files/Mercurial
3
- - set RUBYOPT=--verbose
4
- install:
5
- - ps: |
6
- if ($env:RUBYDOWNLOAD -ne $null) {
7
- $(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-$env:RUBYDOWNLOAD.exe", "$pwd/ruby-setup.exe")
8
- cmd /c ruby-setup.exe /verysilent /dir=C:/Ruby$env:ruby_version
9
- }
10
- - ruby --version
11
- - gem --version
12
- - gem install bundler --conservative
13
- - bundle install
14
- - ps: |
15
- if ($env:PGVERSION -ne $null)
16
- {
17
- $(new-object net.webclient).DownloadFile('http://get.enterprisedb.com/postgresql/postgresql-' + $env:PGVERSION + '.exe', 'C:/postgresql-setup.exe')
18
- cmd /c "C:/postgresql-setup.exe" --mode unattended --extract-only 1
19
- }
20
- $env:RUBY_DLL_PATH = 'C:/Program Files/PostgreSQL/' + $env:PGVER + '/bin;C:/Program Files (x86)/PostgreSQL/' + $env:PGVER + '/bin'
21
- $env:PATH = 'C:/Program Files/PostgreSQL/' + $env:PGVER + '/bin;' + $env:PATH
22
- $env:PATH = 'C:/Program Files (x86)/PostgreSQL/' + $env:PGVER + '/bin;' + $env:PATH
23
- build_script:
24
- - bundle exec rake -rdevkit compile
25
- test_script:
26
- - bundle exec rake test
27
- environment:
28
- matrix:
29
- - ruby_version: "head"
30
- RUBYDOWNLOAD: x64
31
- PGVERSION: 10.0-1-windows-x64
32
- PGVER: 10
33
- - ruby_version: "head"
34
- RUBYDOWNLOAD: x86
35
- PGVERSION: 10.0-1-windows
36
- PGVER: 10
37
- - ruby_version: "24-x64"
38
- PGVERSION: 10.0-1-windows-x64
39
- PGVER: 10
40
- - ruby_version: "24"
41
- PGVERSION: 10.0-1-windows
42
- PGVER: 10
43
- - ruby_version: "22"
44
- PGVERSION: 9.3.19-1-windows
45
- PGVER: 9.3
46
- - ruby_version: "22-x64"
47
- PGVER: 9.6
48
- matrix:
49
- allow_failures:
50
- - ruby_version: "head"
@@ -1,26 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIEbDCCAtSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQwwCgYDVQQDDANnZWQx
3
- GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
4
- HhcNMTcwOTI3MDAzMDQ0WhcNMTgwOTI3MDAzMDQ0WjA+MQwwCgYDVQQDDANnZWQx
5
- GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
6
- ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC/JWGRHO+USzR97vXjkFgt
7
- 83qeNf2KHkcvrRTSnR64i6um/ziin0I0oX23H7VYrDJC9A/uoUa5nGRJS5Zw/+wW
8
- ENcvWVZS4iUzi4dsYJGY6yEOsXh2CcF46+QevV8iE+UmbkU75V7Dy1JCaUOyizEt
9
- TH5UHsOtUU7k9TYARt/TgYZKuaoAMZZd5qyVqhF1vV+7/Qzmp89NGflXf2xYP26a
10
- 4MAX2qqKX/FKXqmFO+AGsbwYTEds1mksBF3fGsFgsQWxftG8GfZQ9+Cyu2+l1eOw
11
- cZ+lPcg834G9DrqW2zhqUoLr1MTly4pqxYGb7XoDhoR7dd1kFE2a067+DzWC/ADt
12
- +QkcqWUm5oh1fN0eqr7NsZlVJDulFgdiiYPQiIN7UNsii4Wc9aZqBoGcYfBeQNPZ
13
- soo/6za/bWajOKUmDhpqvaiRv9EDpVLzuj53uDoukMMwxCMfgb04+ckQ0t2G7wqc
14
- /D+K9JW9DDs3Yjgv9k4h7YMhW5gftosd+NkNC/+Y2CkCAwEAAaN1MHMwCQYDVR0T
15
- BAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFHKN/nkRusdqCJEuq3lgB3fJvyTg
16
- MBwGA1UdEQQVMBOBEWdlZEBGYWVyaWVNVUQub3JnMBwGA1UdEgQVMBOBEWdlZEBG
17
- YWVyaWVNVUQub3JnMA0GCSqGSIb3DQEBBQUAA4IBgQB/qyi5pCjK8ceoKalfVAjS
18
- vG64FEnLnD1bm39T5UaFIRmo+abZtfpg2QhwKvPbPjOicau2+m+MDQ2Cc3tgyaC3
19
- dZxcP6w8APFg4AId09uWAZKf0xajvBMS2aOz8Bbmag6fwqRRkTMqsNYnmqcF7aRT
20
- DuEzbEMfaOUYjU9RuB48vr4q8yRft0ww+3jq5iwNkrX1buL2pwBbyvgms6D/BV41
21
- MaTVMjsHqJUwU2xVfhGtxGAWAer5S1HGYHkbio6mGVtiie0uWjmnzi7ppIlMr48a
22
- 7BNTsoZ+/JRk3iQWmmNsyFT7xfqBKye7cH11BX8V8P4MeGB5YWlMI+Myj5DZY3fQ
23
- st2AGD4rb1l0ia7PfubcBThSIdz61eCb8gRi/RiZZwb3/7+eyEncLJzt2Ob9fGSF
24
- X0qdrKi+2aZZ0NGuFj9AItBsVmAvkBGIpX4TEKQp5haEbPpmaqO5nIIhV26PXmyT
25
- OMKv6pWsoS81vw5KAGBmfX8nht/Py90DQrbRvakATGI=
26
- -----END CERTIFICATE-----
@@ -1,31 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- PGHOST = 'localhost'
4
- PGDB = 'test'
5
- #SOCKHOST = 'github.com'
6
- SOCKHOST = 'it-trac.laika.com'
7
-
8
- # Load pg first, so the libssl.so that libpq is linked against is loaded.
9
- require 'pg'
10
- $stderr.puts "connecting to postgres://#{PGHOST}/#{PGDB}"
11
- conn = PG.connect( PGHOST, :dbname => PGDB )
12
-
13
- # Now load OpenSSL, which might be linked against a different libssl.
14
- require 'socket'
15
- require 'openssl'
16
- $stderr.puts "Connecting to #{SOCKHOST}"
17
- sock = TCPSocket.open( SOCKHOST, 443 )
18
- ctx = OpenSSL::SSL::SSLContext.new
19
- sock = OpenSSL::SSL::SSLSocket.new( sock, ctx )
20
- sock.sync_close = true
21
-
22
- # The moment of truth...
23
- $stderr.puts "Attempting to connect..."
24
- begin
25
- sock.connect
26
- rescue Errno
27
- $stderr.puts "Got an error connecting, but no segfault."
28
- else
29
- $stderr.puts "Nope, no segfault!"
30
- end
31
-
@@ -1,9 +0,0 @@
1
- == v0.8.0 [2012-02-09] Michael Granger <ged@FaerieMUD.org>
2
-
3
- This placeholder version.
4
-
5
-
6
- == v0.7.9.2008.01.28 [2008-01-28] Jeff Davis <<ruby-pg@j-davis.com>>
7
-
8
- The last actual version.
9
-
@@ -1,5 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.txt
4
- Rakefile
5
- lib/postgres.rb
@@ -1,21 +0,0 @@
1
- = postgres
2
-
3
- * https://bitbucket.org/ged/ruby-pg
4
-
5
- == Description
6
-
7
- This is an old, deprecated version of the Ruby PostgreSQL driver that hasn't
8
- been maintained or supported since early 2008.
9
-
10
- You should install/require 'pg' instead.
11
-
12
- If you need the 'postgres' gem for legacy code that can't be converted, you can
13
- still install it using an explicit version, like so:
14
-
15
- gem install postgres -v '0.7.9.2008.01.28'
16
- gem uninstall postgres -v '>0.7.9.2008.01.28'
17
-
18
- If you have any questions, the nice folks in the Google group can help:
19
-
20
- http://goo.gl/OjOPP / ruby-pg@googlegroups.com
21
-
@@ -1,21 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'date'
4
- require 'rubygems'
5
- require 'hoe'
6
- require 'pp'
7
-
8
- Hoe.spec 'postgres' do
9
- self.developer 'Michael Granger', 'ged@FaerieMUD.org'
10
- self.dependency 'pg', '~> 0'
11
- self.spec_extras[:date] = Date.parse( '2008/01/30' )
12
-
13
- line = '-' * 75
14
- msg = paragraphs_of( 'README.txt', 3..-1 )
15
- msg.unshift( line )
16
- msg.push( line )
17
-
18
- self.spec_extras[:post_install_message] = msg.join( "\n\n" ) + "\n"
19
- end
20
-
21
- # vim: syntax=ruby
@@ -1,16 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'pathname'
4
-
5
- module Postgres
6
-
7
- VERSION = '0.8.1'
8
-
9
- gemdir = Pathname( __FILE__ ).dirname.parent
10
- readme = gemdir + 'README.txt'
11
-
12
- header, message = readme.read.split( /^== Description/m )
13
- abort( message.strip )
14
-
15
- end
16
-
@@ -1,9 +0,0 @@
1
- == v0.8.0 [2012-02-09] Michael Granger <ged@FaerieMUD.org>
2
-
3
- This placeholder version.
4
-
5
-
6
- == v0.7.9.2008.01.28 [2008-01-28] Jeff Davis <<ruby-pg@j-davis.com>>
7
-
8
- The last actual version.
9
-
@@ -1,5 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.txt
4
- Rakefile
5
- lib/ruby/pg.rb
@@ -1,21 +0,0 @@
1
- = ruby-pg
2
-
3
- * https://bitbucket.org/ged/ruby-pg
4
-
5
- == Description
6
-
7
- This is an old, deprecated version of the 'pg' gem that hasn't been
8
- maintained or supported since early 2008.
9
-
10
- You should install/require 'pg' instead.
11
-
12
- If you need ruby-pg for legacy code that can't be converted, you can still
13
- install it using an explicit version, like so:
14
-
15
- gem install ruby-pg -v '0.7.9.2008.01.28'
16
- gem uninstall ruby-pg -v '>0.7.9.2008.01.28'
17
-
18
- If you have any questions, the nice folks in the Google group can help:
19
-
20
- http://goo.gl/OjOPP / ruby-pg@googlegroups.com
21
-
@@ -1,21 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'date'
4
- require 'rubygems'
5
- require 'hoe'
6
- require 'pp'
7
-
8
- Hoe.spec 'ruby-pg' do
9
- self.developer 'Michael Granger', 'ged@FaerieMUD.org'
10
- self.dependency 'pg', '~> 0'
11
- self.spec_extras[:date] = Date.parse( '2008/01/30' )
12
-
13
- line = '-' * 75
14
- msg = paragraphs_of( 'README.txt', 3..-1 )
15
- msg.unshift( line )
16
- msg.push( line )
17
-
18
- self.spec_extras[:post_install_message] = msg.join( "\n\n" ) + "\n"
19
- end
20
-
21
- # vim: syntax=ruby
@@ -1,16 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'pathname'
4
-
5
- module Pg
6
-
7
- VERSION = '0.8.0'
8
-
9
- gemdir = Pathname( __FILE__ ).dirname.parent.parent
10
- readme = gemdir + 'README.txt'
11
-
12
- header, message = readme.read.split( /^== Description/m )
13
- abort( message.strip )
14
-
15
- end
16
-
data/pg.gemspec DELETED
@@ -1,61 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- # stub: pg 1.2.0.pre20180730190350 ruby lib
3
- # stub: ext/extconf.rb
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "pg".freeze
7
- s.version = "1.2.0.pre20180730190350"
8
-
9
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1".freeze) if s.respond_to? :required_rubygems_version=
10
- s.require_paths = ["lib".freeze]
11
- s.authors = ["Michael Granger".freeze, "Lars Kanis".freeze]
12
- s.cert_chain = ["certs/ged.pem".freeze]
13
- s.date = "2018-07-30"
14
- s.description = "Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].\n\nIt works with {PostgreSQL 9.2 and later}[http://www.postgresql.org/support/versioning/].\n\nA small example usage:\n\n #!/usr/bin/env ruby\n\n require 'pg'\n\n # Output a table of current connections to the DB\n conn = PG.connect( dbname: 'sales' )\n conn.exec( \"SELECT * FROM pg_stat_activity\" ) do |result|\n puts \" PID | User | Query\"\n result.each do |row|\n puts \" %7d | %-16s | %s \" %\n row.values_at('procpid', 'usename', 'current_query')\n end\n end".freeze
15
- s.email = ["ged@FaerieMUD.org".freeze, "lars@greiz-reinsdorf.de".freeze]
16
- s.extensions = ["ext/extconf.rb".freeze]
17
- s.extra_rdoc_files = ["README.rdoc".freeze, "Contributors.rdoc".freeze, "History.rdoc".freeze, "README-OS_X.rdoc".freeze, "README-Windows.rdoc".freeze, "README.ja.rdoc".freeze, "README.rdoc".freeze, "POSTGRES".freeze, "LICENSE".freeze, "ext/gvl_wrappers.c".freeze, "ext/pg.c".freeze, "ext/pg_binary_decoder.c".freeze, "ext/pg_binary_encoder.c".freeze, "ext/pg_coder.c".freeze, "ext/pg_connection.c".freeze, "ext/pg_copy_coder.c".freeze, "ext/pg_errors.c".freeze, "ext/pg_result.c".freeze, "ext/pg_text_decoder.c".freeze, "ext/pg_text_encoder.c".freeze, "ext/pg_tuple.c".freeze, "ext/pg_type_map.c".freeze, "ext/pg_type_map_all_strings.c".freeze, "ext/pg_type_map_by_class.c".freeze, "ext/pg_type_map_by_column.c".freeze, "ext/pg_type_map_by_mri_type.c".freeze, "ext/pg_type_map_by_oid.c".freeze, "ext/pg_type_map_in_ruby.c".freeze, "ext/util.c".freeze]
18
- s.files = [".gems".freeze, ".hgignore".freeze, ".hgsigs".freeze, ".hgtags".freeze, ".hoerc".freeze, ".irbrc".freeze, ".pryrc".freeze, ".tm_properties".freeze, ".travis.yml".freeze, "BSDL".freeze, "Contributors.rdoc".freeze, "Gemfile".freeze, "History.rdoc".freeze, "LICENSE".freeze, "Manifest.txt".freeze, "POSTGRES".freeze, "README-OS_X.rdoc".freeze, "README-Windows.rdoc".freeze, "README.ja.rdoc".freeze, "README.rdoc".freeze, "Rakefile".freeze, "Rakefile.cross".freeze, "appveyor.yml".freeze, "certs/ged.pem".freeze, "ext/errorcodes.def".freeze, "ext/errorcodes.rb".freeze, "ext/errorcodes.txt".freeze, "ext/extconf.rb".freeze, "ext/gvl_wrappers.c".freeze, "ext/gvl_wrappers.h".freeze, "ext/pg.c".freeze, "ext/pg.h".freeze, "ext/pg_binary_decoder.c".freeze, "ext/pg_binary_encoder.c".freeze, "ext/pg_coder.c".freeze, "ext/pg_connection.c".freeze, "ext/pg_copy_coder.c".freeze, "ext/pg_errors.c".freeze, "ext/pg_result.c".freeze, "ext/pg_text_decoder.c".freeze, "ext/pg_text_encoder.c".freeze, "ext/pg_tuple.c".freeze, "ext/pg_type_map.c".freeze, "ext/pg_type_map_all_strings.c".freeze, "ext/pg_type_map_by_class.c".freeze, "ext/pg_type_map_by_column.c".freeze, "ext/pg_type_map_by_mri_type.c".freeze, "ext/pg_type_map_by_oid.c".freeze, "ext/pg_type_map_in_ruby.c".freeze, "ext/util.c".freeze, "ext/util.h".freeze, "ext/vc/pg.sln".freeze, "ext/vc/pg_18/pg.vcproj".freeze, "ext/vc/pg_19/pg_19.vcproj".freeze, "lib/pg.rb".freeze, "lib/pg/basic_type_mapping.rb".freeze, "lib/pg/binary_decoder.rb".freeze, "lib/pg/coder.rb".freeze, "lib/pg/connection.rb".freeze, "lib/pg/constants.rb".freeze, "lib/pg/exceptions.rb".freeze, "lib/pg/result.rb".freeze, "lib/pg/text_decoder.rb".freeze, "lib/pg/text_encoder.rb".freeze, "lib/pg/tuple.rb".freeze, "lib/pg/type_map_by_column.rb".freeze, "misc/openssl-pg-segfault.rb".freeze, "misc/postgres/History.txt".freeze, "misc/postgres/Manifest.txt".freeze, "misc/postgres/README.txt".freeze, "misc/postgres/Rakefile".freeze, "misc/postgres/lib/postgres.rb".freeze, "misc/ruby-pg/History.txt".freeze, "misc/ruby-pg/Manifest.txt".freeze, "misc/ruby-pg/README.txt".freeze, "misc/ruby-pg/Rakefile".freeze, "misc/ruby-pg/lib/ruby/pg.rb".freeze, "pg.gemspec".freeze, "sample/array_insert.rb".freeze, "sample/async_api.rb".freeze, "sample/async_copyto.rb".freeze, "sample/async_mixed.rb".freeze, "sample/check_conn.rb".freeze, "sample/copydata.rb".freeze, "sample/copyfrom.rb".freeze, "sample/copyto.rb".freeze, "sample/cursor.rb".freeze, "sample/disk_usage_report.rb".freeze, "sample/issue-119.rb".freeze, "sample/losample.rb".freeze, "sample/minimal-testcase.rb".freeze, "sample/notify_wait.rb".freeze, "sample/pg_statistics.rb".freeze, "sample/replication_monitor.rb".freeze, "sample/test_binary_values.rb".freeze, "sample/wal_shipper.rb".freeze, "sample/warehouse_partitions.rb".freeze, "spec/data/expected_trace.out".freeze, "spec/data/random_binary_data".freeze, "spec/helpers.rb".freeze, "spec/pg/basic_type_mapping_spec.rb".freeze, "spec/pg/connection_spec.rb".freeze, "spec/pg/connection_sync_spec.rb".freeze, "spec/pg/result_spec.rb".freeze, "spec/pg/tuple_spec.rb".freeze, "spec/pg/type_map_by_class_spec.rb".freeze, "spec/pg/type_map_by_column_spec.rb".freeze, "spec/pg/type_map_by_mri_type_spec.rb".freeze, "spec/pg/type_map_by_oid_spec.rb".freeze, "spec/pg/type_map_in_ruby_spec.rb".freeze, "spec/pg/type_map_spec.rb".freeze, "spec/pg/type_spec.rb".freeze, "spec/pg_spec.rb".freeze]
19
- s.homepage = "https://bitbucket.org/ged/ruby-pg".freeze
20
- s.licenses = ["BSD-3-Clause".freeze]
21
- s.rdoc_options = ["--main".freeze, "README.rdoc".freeze]
22
- s.required_ruby_version = Gem::Requirement.new(">= 2.0.0".freeze)
23
- s.rubygems_version = "2.7.6".freeze
24
- s.summary = "Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/]".freeze
25
-
26
- if s.respond_to? :specification_version then
27
- s.specification_version = 4
28
-
29
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
30
- s.add_development_dependency(%q<hoe-mercurial>.freeze, ["~> 1.4"])
31
- s.add_development_dependency(%q<hoe-deveiate>.freeze, ["~> 0.9"])
32
- s.add_development_dependency(%q<hoe-highline>.freeze, ["~> 0.2"])
33
- s.add_development_dependency(%q<rake-compiler>.freeze, ["~> 1.0"])
34
- s.add_development_dependency(%q<rake-compiler-dock>.freeze, [">= 0.6.2", "~> 0.6"])
35
- s.add_development_dependency(%q<hoe-bundler>.freeze, ["~> 1.0"])
36
- s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5"])
37
- s.add_development_dependency(%q<rdoc>.freeze, ["~> 5.1"])
38
- s.add_development_dependency(%q<hoe>.freeze, ["~> 3.17"])
39
- else
40
- s.add_dependency(%q<hoe-mercurial>.freeze, ["~> 1.4"])
41
- s.add_dependency(%q<hoe-deveiate>.freeze, ["~> 0.9"])
42
- s.add_dependency(%q<hoe-highline>.freeze, ["~> 0.2"])
43
- s.add_dependency(%q<rake-compiler>.freeze, ["~> 1.0"])
44
- s.add_dependency(%q<rake-compiler-dock>.freeze, [">= 0.6.2", "~> 0.6"])
45
- s.add_dependency(%q<hoe-bundler>.freeze, ["~> 1.0"])
46
- s.add_dependency(%q<rspec>.freeze, ["~> 3.5"])
47
- s.add_dependency(%q<rdoc>.freeze, ["~> 5.1"])
48
- s.add_dependency(%q<hoe>.freeze, ["~> 3.17"])
49
- end
50
- else
51
- s.add_dependency(%q<hoe-mercurial>.freeze, ["~> 1.4"])
52
- s.add_dependency(%q<hoe-deveiate>.freeze, ["~> 0.9"])
53
- s.add_dependency(%q<hoe-highline>.freeze, ["~> 0.2"])
54
- s.add_dependency(%q<rake-compiler>.freeze, ["~> 1.0"])
55
- s.add_dependency(%q<rake-compiler-dock>.freeze, [">= 0.6.2", "~> 0.6"])
56
- s.add_dependency(%q<hoe-bundler>.freeze, ["~> 1.0"])
57
- s.add_dependency(%q<rspec>.freeze, ["~> 3.5"])
58
- s.add_dependency(%q<rdoc>.freeze, ["~> 5.1"])
59
- s.add_dependency(%q<hoe>.freeze, ["~> 3.17"])
60
- end
61
- end
@@ -1,20 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'pg'
4
-
5
- c = PG.connect( dbname: 'test' )
6
-
7
- # this one works:
8
- c.exec( "DROP TABLE IF EXISTS foo" )
9
- c.exec( "CREATE TABLE foo (strings character varying[]);" )
10
-
11
- # But using a prepared statement works:
12
- c.set_error_verbosity( PG::PQERRORS_VERBOSE )
13
- c.prepare( 'stmt', "INSERT INTO foo VALUES ($1);" )
14
-
15
- # This won't work
16
- #c.exec_prepared( 'stmt', ["ARRAY['this','that']"] )
17
-
18
- # but this will:
19
- c.exec_prepared( 'stmt', ["{'this','that'}"] )
20
-
@@ -1,106 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'pg'
4
-
5
- # This is a example of how to use the asynchronous API to query the
6
- # server without blocking other threads. It's intentionally low-level;
7
- # if you hooked up the PG::Connection#socket to some kind of reactor, you
8
- # could make this much nicer.
9
-
10
- TIMEOUT = 5.0 # seconds to wait for an async operation to complete
11
-
12
- # Print 'x' continuously to demonstrate that other threads aren't
13
- # blocked while waiting for the connection, for the query to be sent,
14
- # for results, etc. You might want to sleep inside the loop or
15
- # comment this out entirely for cleaner output.
16
- progress_thread = Thread.new { loop { print 'x' } }
17
-
18
- # Output progress messages
19
- def output_progress( msg )
20
- puts "\n>>> #{msg}\n"
21
- end
22
-
23
- # Start the connection
24
- output_progress "Starting connection..."
25
- conn = PG::Connection.connect_start( :dbname => 'test' ) or
26
- abort "Unable to create a new connection!"
27
- abort "Connection failed: %s" % [ conn.error_message ] if
28
- conn.status == PG::CONNECTION_BAD
29
-
30
- # Now grab a reference to the underlying socket so we know when the
31
- # connection is established
32
- socket = conn.socket_io
33
-
34
- # Track the progress of the connection, waiting for the socket to become readable/writable
35
- # before polling it
36
- poll_status = PG::PGRES_POLLING_WRITING
37
- until poll_status == PG::PGRES_POLLING_OK ||
38
- poll_status == PG::PGRES_POLLING_FAILED
39
-
40
- # If the socket needs to read, wait 'til it becomes readable to poll again
41
- case poll_status
42
- when PG::PGRES_POLLING_READING
43
- output_progress " waiting for socket to become readable"
44
- select( [socket], nil, nil, TIMEOUT ) or
45
- raise "Asynchronous connection timed out!"
46
-
47
- # ...and the same for when the socket needs to write
48
- when PG::PGRES_POLLING_WRITING
49
- output_progress " waiting for socket to become writable"
50
- select( nil, [socket], nil, TIMEOUT ) or
51
- raise "Asynchronous connection timed out!"
52
- end
53
-
54
- # Output a status message about the progress
55
- case conn.status
56
- when PG::CONNECTION_STARTED
57
- output_progress " waiting for connection to be made."
58
- when PG::CONNECTION_MADE
59
- output_progress " connection OK; waiting to send."
60
- when PG::CONNECTION_AWAITING_RESPONSE
61
- output_progress " waiting for a response from the server."
62
- when PG::CONNECTION_AUTH_OK
63
- output_progress " received authentication; waiting for backend start-up to finish."
64
- when PG::CONNECTION_SSL_STARTUP
65
- output_progress " negotiating SSL encryption."
66
- when PG::CONNECTION_SETENV
67
- output_progress " negotiating environment-driven parameter settings."
68
- when PG::CONNECTION_NEEDED
69
- output_progress " internal state: connect() needed."
70
- end
71
-
72
- # Check to see if it's finished or failed yet
73
- poll_status = conn.connect_poll
74
- end
75
-
76
- abort "Connect failed: %s" % [ conn.error_message ] unless conn.status == PG::CONNECTION_OK
77
-
78
- output_progress "Sending query"
79
- conn.send_query( "SELECT * FROM pg_stat_activity" )
80
-
81
- # Fetch results until there aren't any more
82
- loop do
83
- output_progress " waiting for a response"
84
-
85
- # Buffer any incoming data on the socket until a full result is ready.
86
- conn.consume_input
87
- while conn.is_busy
88
- select( [socket], nil, nil, TIMEOUT ) or
89
- raise "Timeout waiting for query response."
90
- conn.consume_input
91
- end
92
-
93
- # Fetch the next result. If there isn't one, the query is finished
94
- result = conn.get_result or break
95
-
96
- puts "\n\nQuery result:\n%p\n" % [ result.values ]
97
- end
98
-
99
- output_progress "Done."
100
- conn.finish
101
-
102
- if defined?( progress_thread )
103
- progress_thread.kill
104
- progress_thread.join
105
- end
106
-