cipherstash-pg 1.0.0.beta.1-x86_64-darwin-21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/BSDL +22 -0
  3. data/Contributors.rdoc +46 -0
  4. data/Gemfile +14 -0
  5. data/History.rdoc +789 -0
  6. data/LICENSE +56 -0
  7. data/Manifest.txt +72 -0
  8. data/POSTGRES +23 -0
  9. data/README-OS_X.rdoc +68 -0
  10. data/README-Windows.rdoc +56 -0
  11. data/README.ja.rdoc +13 -0
  12. data/README.rdoc +233 -0
  13. data/Rakefile +115 -0
  14. data/certs/ged.pem +24 -0
  15. data/certs/larskanis-2022.pem +26 -0
  16. data/cipherstash-pg.gemspec +31 -0
  17. data/lib/2.7/pg_ext.bundle +0 -0
  18. data/lib/3.0/pg_ext.bundle +0 -0
  19. data/lib/3.1/pg_ext.bundle +0 -0
  20. data/lib/3.2/pg_ext.bundle +0 -0
  21. data/lib/cipherstash-pg.rb +15 -0
  22. data/lib/libpq.5.dylib +0 -0
  23. data/lib/pg/basic_type_map_based_on_result.rb +47 -0
  24. data/lib/pg/basic_type_map_for_queries.rb +193 -0
  25. data/lib/pg/basic_type_map_for_results.rb +81 -0
  26. data/lib/pg/basic_type_registry.rb +301 -0
  27. data/lib/pg/binary_decoder.rb +23 -0
  28. data/lib/pg/coder.rb +104 -0
  29. data/lib/pg/connection.rb +878 -0
  30. data/lib/pg/constants.rb +12 -0
  31. data/lib/pg/exceptions.rb +18 -0
  32. data/lib/pg/result.rb +43 -0
  33. data/lib/pg/text_decoder.rb +46 -0
  34. data/lib/pg/text_encoder.rb +59 -0
  35. data/lib/pg/tuple.rb +30 -0
  36. data/lib/pg/type_map_by_column.rb +16 -0
  37. data/lib/pg/version.rb +4 -0
  38. data/lib/pg.rb +55 -0
  39. data/misc/openssl-pg-segfault.rb +31 -0
  40. data/misc/postgres/History.txt +9 -0
  41. data/misc/postgres/Manifest.txt +5 -0
  42. data/misc/postgres/README.txt +21 -0
  43. data/misc/postgres/Rakefile +21 -0
  44. data/misc/postgres/lib/postgres.rb +16 -0
  45. data/misc/ruby-pg/History.txt +9 -0
  46. data/misc/ruby-pg/Manifest.txt +5 -0
  47. data/misc/ruby-pg/README.txt +21 -0
  48. data/misc/ruby-pg/Rakefile +21 -0
  49. data/misc/ruby-pg/lib/ruby/pg.rb +16 -0
  50. data/rakelib/task_extension.rb +46 -0
  51. data/sample/array_insert.rb +20 -0
  52. data/sample/async_api.rb +102 -0
  53. data/sample/async_copyto.rb +39 -0
  54. data/sample/async_mixed.rb +56 -0
  55. data/sample/check_conn.rb +21 -0
  56. data/sample/copydata.rb +71 -0
  57. data/sample/copyfrom.rb +81 -0
  58. data/sample/copyto.rb +19 -0
  59. data/sample/cursor.rb +21 -0
  60. data/sample/disk_usage_report.rb +177 -0
  61. data/sample/issue-119.rb +94 -0
  62. data/sample/losample.rb +69 -0
  63. data/sample/minimal-testcase.rb +17 -0
  64. data/sample/notify_wait.rb +72 -0
  65. data/sample/pg_statistics.rb +285 -0
  66. data/sample/replication_monitor.rb +222 -0
  67. data/sample/test_binary_values.rb +33 -0
  68. data/sample/wal_shipper.rb +434 -0
  69. data/sample/warehouse_partitions.rb +311 -0
  70. data/vendor/database-extensions/install.sql +317 -0
  71. data/vendor/database-extensions/uninstall.sql +20 -0
  72. metadata +118 -0
data/LICENSE ADDED
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a) distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b) accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c) give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d) make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
data/Manifest.txt ADDED
@@ -0,0 +1,72 @@
1
+ .gemtest
2
+ BSDL
3
+ Contributors.rdoc
4
+ History.rdoc
5
+ LICENSE
6
+ Manifest.txt
7
+ POSTGRES
8
+ README-OS_X.rdoc
9
+ README-Windows.rdoc
10
+ README.ja.rdoc
11
+ README.rdoc
12
+ Rakefile
13
+ Rakefile.cross
14
+ ext/errorcodes.def
15
+ ext/errorcodes.rb
16
+ ext/errorcodes.txt
17
+ ext/extconf.rb
18
+ ext/gvl_wrappers.c
19
+ ext/gvl_wrappers.h
20
+ ext/pg.c
21
+ ext/pg.h
22
+ ext/pg_binary_decoder.c
23
+ ext/pg_binary_encoder.c
24
+ ext/pg_coder.c
25
+ ext/pg_connection.c
26
+ ext/pg_copy_coder.c
27
+ ext/pg_errors.c
28
+ ext/pg_record_coder.c
29
+ ext/pg_result.c
30
+ ext/pg_text_decoder.c
31
+ ext/pg_text_encoder.c
32
+ ext/pg_tuple.c
33
+ ext/pg_type_map.c
34
+ ext/pg_type_map_all_strings.c
35
+ ext/pg_type_map_by_class.c
36
+ ext/pg_type_map_by_column.c
37
+ ext/pg_type_map_by_mri_type.c
38
+ ext/pg_type_map_by_oid.c
39
+ ext/pg_type_map_in_ruby.c
40
+ ext/pg_util.c
41
+ ext/pg_util.h
42
+ ext/vc/pg.sln
43
+ ext/vc/pg_18/pg.vcproj
44
+ ext/vc/pg_19/pg_19.vcproj
45
+ lib/pg.rb
46
+ lib/pg/basic_type_mapping.rb
47
+ lib/pg/binary_decoder.rb
48
+ lib/pg/coder.rb
49
+ lib/pg/connection.rb
50
+ lib/pg/constants.rb
51
+ lib/pg/exceptions.rb
52
+ lib/pg/result.rb
53
+ lib/pg/text_decoder.rb
54
+ lib/pg/text_encoder.rb
55
+ lib/pg/tuple.rb
56
+ lib/pg/type_map_by_column.rb
57
+ spec/data/expected_trace.out
58
+ spec/data/random_binary_data
59
+ spec/helpers.rb
60
+ spec/pg/basic_type_mapping_spec.rb
61
+ spec/pg/connection_spec.rb
62
+ spec/pg/connection_sync_spec.rb
63
+ spec/pg/result_spec.rb
64
+ spec/pg/tuple_spec.rb
65
+ spec/pg/type_map_by_class_spec.rb
66
+ spec/pg/type_map_by_column_spec.rb
67
+ spec/pg/type_map_by_mri_type_spec.rb
68
+ spec/pg/type_map_by_oid_spec.rb
69
+ spec/pg/type_map_in_ruby_spec.rb
70
+ spec/pg/type_map_spec.rb
71
+ spec/pg/type_spec.rb
72
+ spec/pg_spec.rb
data/POSTGRES ADDED
@@ -0,0 +1,23 @@
1
+ PostgreSQL Database Management System
2
+ (formerly known as Postgres, then as Postgres95)
3
+
4
+ Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
5
+
6
+ Portions Copyright (c) 1994, The Regents of the University of California
7
+
8
+ Permission to use, copy, modify, and distribute this software and its
9
+ documentation for any purpose, without fee, and without a written agreement
10
+ is hereby granted, provided that the above copyright notice and this
11
+ paragraph and the following two paragraphs appear in all copies.
12
+
13
+ IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
14
+ DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
15
+ LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
16
+ DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
17
+ POSSIBILITY OF SUCH DAMAGE.
18
+
19
+ THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
20
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
+ AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22
+ ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
23
+ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
data/README-OS_X.rdoc ADDED
@@ -0,0 +1,68 @@
1
+ = Compiling on MacOS X
2
+
3
+ The EnterpriseDB packages are the recommended PostgreSQL installations to use
4
+ with MacOS X. They eliminate most or all of the issues with getting 'pg'
5
+ installed, linked correctly, and running.
6
+
7
+ == Segfaults and SSL Support
8
+
9
+ If you need a custom installation of PostgreSQL, you should ensure that you
10
+ either compile it against the same version of OpenSSL as the OpenSSL extension
11
+ of the Ruby you'll be using, or compile it without SSL support. If you fail to
12
+ do this, you will likely see segfaults when you use 'pg' and the 'openssl'
13
+ extension at the same time. You can see what library it's linked against using
14
+ 'otool -L'; for example, on my 10.7 machine I use for 'pg' development:
15
+
16
+ $ otool -L /System/Library/Frameworks/Ruby.framework/Versions\
17
+ /1.8/usr/lib/ruby/1.8/universal-darwin11.0/openssl.bundle
18
+
19
+ /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/\
20
+ lib/ruby/1.8/universal-darwin11.0/openssl.bundle:
21
+ /System/Library/Frameworks/Ruby.framework/Versions/1.8/\
22
+ usr/lib/libruby.1.dylib (compatibility version 1.8.0, \
23
+ current version 1.8.7)
24
+ /usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, \
25
+ current version 0.9.8)
26
+ /usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, \
27
+ current version 0.9.8)
28
+ /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, \
29
+ current version 159.0.0)
30
+
31
+
32
+ == Dealing with Installation Problems
33
+
34
+ If you are building/installing pg on MacOS X, and the installation doesn't
35
+ work at first, here are a few things you can try.
36
+
37
+ === pg_config
38
+
39
+ The first thing you should do is ensure that the 'pg_config' tool that comes
40
+ with Postgres is in your path. If it isn't, or the one that's first in your
41
+ path isn't the one that was installed with the Postgres you want to build
42
+ against, you can specify the path to it with the --with-pg-config option.
43
+
44
+ For example, if you're using the Ruby binary that comes with OSX, and
45
+ PostgreSQL 9.0.x installed from MacPorts, do:
46
+
47
+ gem install -- --with-pg-config=/opt/local/lib/postgresql90/bin/pg_config
48
+
49
+ === ARCHFLAGS and Universal Binaries
50
+
51
+ OS X supports both architecture-specific binaries (e.g. i386), as well as
52
+ universal binaries (i.e. i386 & ppc). If Ruby is built as a universal binary
53
+ and PostgreSQL is not, you need to specify the path to the appropriate
54
+ pg_config binary or set the environment variable ARCHFLAGS appropriately.
55
+
56
+ Alternatively, if the build system can't figure out which architectures it
57
+ should include, you may need to set the 'ARCHFLAGS' environment variable
58
+ explicitly:
59
+
60
+ sudo env ARCHFLAGS='-arch x86_64' gem install pg
61
+
62
+ or, if you're building from source:
63
+
64
+ rake compile ARCHFLAGS="-arch x86_64"
65
+
66
+ Note that the recommended EnterpriseDB packages are correctly compiled as
67
+ universal binaries, and don't need any of these workarounds.
68
+
@@ -0,0 +1,56 @@
1
+ = Compiling 'pg' on MS Windows
2
+
3
+ In order to build this extension on MS Windows you will need a couple things.
4
+
5
+ First, a compiler. For the one click installer this means you should use
6
+ the DevKit or the compiler that comes with cygwin if you're building on that
7
+ platform.
8
+
9
+ If you've built Ruby yourself, you should use the same compiler to build
10
+ this library that you used to build Ruby.
11
+
12
+ Second, PostgreSQL. Be sure you installed it with the development header
13
+ files if you installed it using the standard PostgreSQL installer for
14
+ Windows. If you didn't, you can run the installer again, select "modify",
15
+ and then select the 'development headers' option to install them.
16
+
17
+ I recommend making sure that 'pg_config.exe' is in your PATH. The PostgreSQL
18
+ installer for Windows does not necessarily update your PATH when it installs
19
+ itself, so you may need to do this manually. This isn't strictly necessary,
20
+ however.
21
+
22
+ In order to build ruby-pg, just run 'rake'. If the pg_config.exe executable
23
+ is not in your PATH, you'll need to explicitly point ruby-pg to where your
24
+ PostgreSQL headers and libraries are with something like this:
25
+
26
+ rake --with-pg-dir=c:/progra~1/postgr~1/8.3
27
+
28
+ Adjust your path accordingly. BE SURE TO USE THE SHORT PATH NAMES! If you
29
+ try to use a path with spaces in it, the nmake.exe program will choke.
30
+
31
+
32
+ == Building binary 'pg' gems for MS Windows
33
+
34
+ Binary gems for windows can be built on Linux, OS-X and even on Windows
35
+ with the help of docker. This is how regular windows gems are built for
36
+ rubygems.org .
37
+
38
+ To do this, install boot2docker {on Windows}[https://github.com/boot2docker/windows-installer/releases]
39
+ or {on OS X}[https://github.com/boot2docker/osx-installer/releases] and make
40
+ sure it is started. A native Docker installation is best on Linux.
41
+
42
+ Then run:
43
+
44
+ rake gem:windows
45
+
46
+ This will download a docker image suited for building windows gems, and it
47
+ will download and build OpenSSL and PostgreSQL. Finally the gem is built
48
+ containing binaries for all supported ruby versions.
49
+
50
+
51
+ == Reporting Problems
52
+
53
+ If you have any problems you can submit them via {the project's
54
+ issue-tracker}[https://github.com/ged/ruby-pg/issues]. And submit questions, problems, or
55
+ solutions, so that it can be improved.
56
+
data/README.ja.rdoc ADDED
@@ -0,0 +1,13 @@
1
+ = pg
2
+
3
+ home :: https://github.com/ged/ruby-pg
4
+ docs :: http://deveiate.org/code/pg
5
+
6
+
7
+ == Description
8
+
9
+ This file needs a translation of the English README. Pull requests, patches, or
10
+ volunteers gladly accepted.
11
+
12
+ Until such time, please accept my sincere apologies for not knowing Japanese.
13
+
data/README.rdoc ADDED
@@ -0,0 +1,233 @@
1
+ = pg
2
+
3
+ home :: https://github.com/ged/ruby-pg
4
+ docs :: http://deveiate.org/code/pg
5
+ clog :: link:/History.rdoc
6
+
7
+ {<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Join the chat at https://gitter.im/ged/ruby-pg">}[https://gitter.im/ged/ruby-pg?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge]
8
+
9
+
10
+ == Description
11
+
12
+ Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].
13
+
14
+ It works with {PostgreSQL 9.3 and later}[http://www.postgresql.org/support/versioning/].
15
+
16
+ A small example usage:
17
+
18
+ #!/usr/bin/env ruby
19
+
20
+ require 'pg'
21
+
22
+ # Output a table of current connections to the DB
23
+ conn = PG.connect( dbname: 'sales' )
24
+ conn.exec( "SELECT * FROM pg_stat_activity" ) do |result|
25
+ puts " PID | User | Query"
26
+ result.each do |row|
27
+ puts " %7d | %-16s | %s " %
28
+ row.values_at('pid', 'usename', 'query')
29
+ end
30
+ end
31
+
32
+ == Build Status
33
+
34
+ {<img src="https://github.com/ged/ruby-pg/actions/workflows/source-gem.yml/badge.svg?branch=master" alt="Build Status Github Actions" />}[https://github.com/ged/ruby-pg/actions/workflows/source-gem.yml]
35
+ {<img src="https://ci.appveyor.com/api/projects/status/gjx5axouf3b1wicp?svg=true" alt="Build Status Appveyor" />}[https://ci.appveyor.com/project/ged/ruby-pg-9j8l3]
36
+ {<img src="https://app.travis-ci.com/larskanis/ruby-pg.svg?branch=master" alt="Build Status" />}[https://app.travis-ci.com/larskanis/ruby-pg]
37
+
38
+ == Requirements
39
+
40
+ * Ruby 2.4 or newer
41
+ * PostgreSQL 9.3.x or later (with headers, -dev packages, etc).
42
+
43
+ It usually works with earlier versions of Ruby/PostgreSQL as well, but those are
44
+ not regularly tested.
45
+
46
+
47
+ == Versioning
48
+
49
+ We tag and release gems according to the {Semantic Versioning}[http://semver.org/] principle.
50
+
51
+ As a result of this policy, you can (and should) specify a dependency on this gem using the {Pessimistic Version Constraint}[http://guides.rubygems.org/patterns/#pessimistic-version-constraint] with two digits of precision.
52
+
53
+ For example:
54
+
55
+ spec.add_dependency 'pg', '~> 1.0'
56
+
57
+
58
+ == How To Install
59
+
60
+ Install via RubyGems:
61
+
62
+ gem install pg
63
+
64
+ You may need to specify the path to the 'pg_config' program installed with
65
+ Postgres:
66
+
67
+ gem install pg -- --with-pg-config=<path to pg_config>
68
+
69
+ If you're installing via Bundler, you can provide compile hints like so:
70
+
71
+ bundle config build.pg --with-pg-config=<path to pg_config>
72
+
73
+ See README-OS_X.rdoc for more information about installing under MacOS X, and
74
+ README-Windows.rdoc for Windows build/installation instructions.
75
+
76
+ There's also {a Google+ group}[http://goo.gl/TFy1U] and a
77
+ {mailing list}[http://groups.google.com/group/ruby-pg] if you get stuck, or just
78
+ want to chat about something.
79
+
80
+ If you want to install as a signed gem, the public certs of the gem signers
81
+ can be found in {the `certs` directory}[https://github.com/ged/ruby-pg/tree/master/certs]
82
+ of the repository.
83
+
84
+
85
+ == Type Casts
86
+
87
+ Pg can optionally type cast result values and query parameters in Ruby or
88
+ native C code. This can speed up data transfers to and from the database,
89
+ because String allocations are reduced and conversions in (slower) Ruby code
90
+ can be omitted.
91
+
92
+ Very basic type casting can be enabled by:
93
+
94
+ conn.type_map_for_results = PG::BasicTypeMapForResults.new conn
95
+ # ... this works for result value mapping:
96
+ conn.exec("select 1, now(), '{2,3}'::int[]").values
97
+ # => [[1, 2014-09-21 20:51:56 +0200, [2, 3]]]
98
+
99
+ conn.type_map_for_queries = PG::BasicTypeMapForQueries.new conn
100
+ # ... and this for param value mapping:
101
+ conn.exec_params("SELECT $1::text, $2::text, $3::text", [1, 1.23, [2,3]]).values
102
+ # => [["1", "1.2300000000000000E+00", "{2,3}"]]
103
+
104
+ But Pg's type casting is highly customizable. That's why it's divided into
105
+ 2 layers:
106
+
107
+ === Encoders / Decoders (ext/pg_*coder.c, lib/pg/*coder.rb)
108
+
109
+ This is the lower layer, containing encoding classes that convert Ruby
110
+ objects for transmission to the DBMS and decoding classes to convert
111
+ received data back to Ruby objects. The classes are namespaced according
112
+ to their format and direction in PG::TextEncoder, PG::TextDecoder,
113
+ PG::BinaryEncoder and PG::BinaryDecoder.
114
+
115
+ It is possible to assign a type OID, format code (text or binary) and
116
+ optionally a name to an encoder or decoder object. It's also possible
117
+ to build composite types by assigning an element encoder/decoder.
118
+ PG::Coder objects can be used to set up a PG::TypeMap or alternatively
119
+ to convert single values to/from their string representation.
120
+
121
+ The following PostgreSQL column types are supported by ruby-pg (TE = Text Encoder, TD = Text Decoder, BE = Binary Encoder, BD = Binary Decoder):
122
+ * Integer: {TE}[rdoc-ref:PG::TextEncoder::Integer], {TD}[rdoc-ref:PG::TextDecoder::Integer], {BD}[rdoc-ref:PG::BinaryDecoder::Integer] 💡 No links? Switch to {here}[https://deveiate.org/code/pg/README_rdoc.html#label-Type+Casts] 💡
123
+ * BE: {Int2}[rdoc-ref:PG::BinaryEncoder::Int2], {Int4}[rdoc-ref:PG::BinaryEncoder::Int4], {Int8}[rdoc-ref:PG::BinaryEncoder::Int8]
124
+ * Float: {TE}[rdoc-ref:PG::TextEncoder::Float], {TD}[rdoc-ref:PG::TextDecoder::Float], {BD}[rdoc-ref:PG::BinaryDecoder::Float]
125
+ * Numeric: {TE}[rdoc-ref:PG::TextEncoder::Numeric], {TD}[rdoc-ref:PG::TextDecoder::Numeric]
126
+ * Boolean: {TE}[rdoc-ref:PG::TextEncoder::Boolean], {TD}[rdoc-ref:PG::TextDecoder::Boolean], {BE}[rdoc-ref:PG::BinaryEncoder::Boolean], {BD}[rdoc-ref:PG::BinaryDecoder::Boolean]
127
+ * String: {TE}[rdoc-ref:PG::TextEncoder::String], {TD}[rdoc-ref:PG::TextDecoder::String], {BE}[rdoc-ref:PG::BinaryEncoder::String], {BD}[rdoc-ref:PG::BinaryDecoder::String]
128
+ * Bytea: {TE}[rdoc-ref:PG::TextEncoder::Bytea], {TD}[rdoc-ref:PG::TextDecoder::Bytea], {BE}[rdoc-ref:PG::BinaryEncoder::Bytea], {BD}[rdoc-ref:PG::BinaryDecoder::Bytea]
129
+ * Base64: {TE}[rdoc-ref:PG::TextEncoder::ToBase64], {TD}[rdoc-ref:PG::TextDecoder::FromBase64], {BE}[rdoc-ref:PG::BinaryEncoder::FromBase64], {BD}[rdoc-ref:PG::BinaryDecoder::ToBase64]
130
+ * Timestamp:
131
+ * TE: {local}[rdoc-ref:PG::TextEncoder::TimestampWithoutTimeZone], {UTC}[rdoc-ref:PG::TextEncoder::TimestampUtc], {with-TZ}[rdoc-ref:PG::TextEncoder::TimestampWithTimeZone]
132
+ * TD: {local}[rdoc-ref:PG::TextDecoder::TimestampLocal], {UTC}[rdoc-ref:PG::TextDecoder::TimestampUtc], {UTC-to-local}[rdoc-ref:PG::TextDecoder::TimestampUtcToLocal]
133
+ * BD: {local}[rdoc-ref:PG::BinaryDecoder::TimestampLocal], {UTC}[rdoc-ref:PG::BinaryDecoder::TimestampUtc], {UTC-to-local}[rdoc-ref:PG::BinaryDecoder::TimestampUtcToLocal]
134
+ * Date: {TE}[rdoc-ref:PG::TextEncoder::Date], {TD}[rdoc-ref:PG::TextDecoder::Date]
135
+ * JSON and JSONB: {TE}[rdoc-ref:PG::TextEncoder::JSON], {TD}[rdoc-ref:PG::TextDecoder::JSON]
136
+ * Inet: {TE}[rdoc-ref:PG::TextEncoder::Inet], {TD}[rdoc-ref:PG::TextDecoder::Inet]
137
+ * Array: {TE}[rdoc-ref:PG::TextEncoder::Array], {TD}[rdoc-ref:PG::TextDecoder::Array]
138
+ * Composite Type (also called "Row" or "Record"): {TE}[rdoc-ref:PG::TextEncoder::Record], {TD}[rdoc-ref:PG::TextDecoder::Record]
139
+
140
+ The following text formats can also be encoded although they are not used as column type:
141
+ * COPY input and output data: {TE}[rdoc-ref:PG::TextEncoder::CopyRow], {TD}[rdoc-ref:PG::TextDecoder::CopyRow]
142
+ * Literal for insertion into SQL string: {TE}[rdoc-ref:PG::TextEncoder::QuotedLiteral]
143
+ * SQL-Identifier: {TE}[rdoc-ref:PG::TextEncoder::Identifier], {TD}[rdoc-ref:PG::TextDecoder::Identifier]
144
+
145
+ === PG::TypeMap and derivations (ext/pg_type_map*.c, lib/pg/type_map*.rb)
146
+
147
+ A TypeMap defines which value will be converted by which encoder/decoder.
148
+ There are different type map strategies, implemented by several derivations
149
+ of this class. They can be chosen and configured according to the particular
150
+ needs for type casting. The default type map is PG::TypeMapAllStrings.
151
+
152
+ A type map can be assigned per connection or per query respectively per
153
+ result set. Type maps can also be used for COPY in and out data streaming.
154
+ See PG::Connection#copy_data .
155
+
156
+ The following base type maps are available:
157
+ * PG::TypeMapAllStrings - encodes and decodes all values to and from strings (default)
158
+ * PG::TypeMapByClass - selects encoder based on the class of the value to be sent
159
+ * PG::TypeMapByColumn - selects encoder and decoder by column order
160
+ * PG::TypeMapByOid - selects decoder by PostgreSQL type OID
161
+ * PG::TypeMapInRuby - define a custom type map in ruby
162
+
163
+ The following type maps are prefilled with type mappings from the PG::BasicTypeRegistry :
164
+ * PG::BasicTypeMapForResults - a PG::TypeMapByOid prefilled with decoders for common PostgreSQL column types
165
+ * PG::BasicTypeMapBasedOnResult - a PG::TypeMapByOid prefilled with encoders for common PostgreSQL column types
166
+ * PG::BasicTypeMapForQueries - a PG::TypeMapByClass prefilled with encoders for common Ruby value classes
167
+
168
+
169
+ == Contributing
170
+
171
+ To report bugs, suggest features, or check out the source with Git,
172
+ {check out the project page}[https://github.com/ged/ruby-pg].
173
+
174
+ After checking out the source, install all dependencies:
175
+
176
+ $ bundle install
177
+
178
+ Cleanup extension files, packaging files, test databases:
179
+
180
+ $ rake clean
181
+
182
+ Compile extension:
183
+
184
+ $ rake compile
185
+
186
+ Run tests/specs with PostgreSQL tools like `initdb` in the path:
187
+
188
+ $ PATH=$PATH:/usr/lib/postgresql/14/bin rake test
189
+
190
+ Or run a specific test with the line number:
191
+
192
+ $ PATH=$PATH:/usr/lib/postgresql/14/bin rspec -Ilib -fd spec/pg/connection_spec.rb:455
193
+
194
+ Generate the API documentation:
195
+
196
+ $ rake docs
197
+
198
+ Make sure, that all bugs and new features are verified by tests.
199
+
200
+ The current maintainers are Michael Granger <ged@FaerieMUD.org> and
201
+ Lars Kanis <lars@greiz-reinsdorf.de>.
202
+
203
+
204
+ == Copying
205
+
206
+ Copyright (c) 1997-2022 by the authors.
207
+
208
+ * Jeff Davis <ruby-pg@j-davis.com>
209
+ * Guy Decoux (ts) <decoux@moulon.inra.fr>
210
+ * Michael Granger <ged@FaerieMUD.org>
211
+ * Lars Kanis <lars@greiz-reinsdorf.de>
212
+ * Dave Lee
213
+ * Eiji Matsumoto <usagi@ruby.club.or.jp>
214
+ * Yukihiro Matsumoto <matz@ruby-lang.org>
215
+ * Noboru Saitou <noborus@netlab.jp>
216
+
217
+ You may redistribute this software under the same terms as Ruby itself; see
218
+ https://www.ruby-lang.org/en/about/license.txt or the BSDL file in the source
219
+ for details.
220
+
221
+ Portions of the code are from the PostgreSQL project, and are distributed
222
+ under the terms of the PostgreSQL license, included in the file POSTGRES.
223
+
224
+ Portions copyright LAIKA, Inc.
225
+
226
+
227
+ == Acknowledgments
228
+
229
+ See Contributors.rdoc for the many additional fine people that have contributed
230
+ to this library over the years.
231
+
232
+ We are thankful to the people at the ruby-list and ruby-dev mailing lists.
233
+ And to the people who developed PostgreSQL.
data/Rakefile ADDED
@@ -0,0 +1,115 @@
1
+ # -*- rake -*-
2
+
3
+ require 'rbconfig'
4
+ require 'pathname'
5
+ require 'tmpdir'
6
+ require 'rake/extensiontask'
7
+ require 'rake/clean'
8
+ require 'rspec/core/rake_task'
9
+ require 'bundler'
10
+ require 'bundler/gem_helper'
11
+
12
+ # Build directory constants
13
+ BASEDIR = Pathname( __FILE__ ).dirname
14
+ SPECDIR = BASEDIR + 'spec'
15
+ LIBDIR = BASEDIR + 'lib'
16
+ EXTDIR = BASEDIR + 'ext'
17
+ PKGDIR = BASEDIR + 'pkg'
18
+ TMPDIR = BASEDIR + 'tmp'
19
+ TESTDIR = BASEDIR + "tmp_test_*"
20
+
21
+ DLEXT = RbConfig::CONFIG['DLEXT']
22
+ EXT = LIBDIR + "pg_ext.#{DLEXT}"
23
+
24
+ GEMSPEC = 'cipherstash-pg.gemspec'
25
+
26
+ CLEAN.include( TESTDIR.to_s )
27
+ CLEAN.include( PKGDIR.to_s, TMPDIR.to_s )
28
+ CLEAN.include "lib/*/libpq.dll"
29
+ CLEAN.include "lib/pg_ext.*"
30
+ CLEAN.include "lib/pg/postgresql_lib_path.rb"
31
+
32
+ # load 'Rakefile.cross'
33
+
34
+ Bundler::GemHelper.install_tasks
35
+ $gem_spec = Bundler.load_gemspec(GEMSPEC)
36
+
37
+ desc "Turn on warnings and debugging in the build."
38
+ task :maint do
39
+ ENV['MAINTAINER_MODE'] = 'yes'
40
+ end
41
+
42
+ # Rake-compiler task
43
+ Rake::ExtensionTask.new do |ext|
44
+ ext.name = 'pg_ext'
45
+ ext.gem_spec = $gem_spec
46
+ ext.ext_dir = 'ext'
47
+ ext.lib_dir = 'lib'
48
+ ext.source_pattern = "*.{c,h}"
49
+ ext.cross_compile = false
50
+ # ext.cross_platform = CrossLibraries.map(&:for_platform)
51
+
52
+ # ext.cross_config_options += CrossLibraries.map do |lib|
53
+ # {
54
+ # lib.for_platform => [
55
+ # "--enable-windows-cross",
56
+ # "--with-pg-include=#{lib.static_postgresql_incdir}",
57
+ # "--with-pg-lib=#{lib.static_postgresql_libdir}",
58
+ # # libpq-fe.h resides in src/interfaces/libpq/ before make install
59
+ # "--with-opt-include=#{lib.static_postgresql_libdir}",
60
+ # ]
61
+ # }
62
+ # end
63
+
64
+ # Add libpq.dll to windows binary gemspec
65
+ # ext.cross_compiling do |spec|
66
+ # spec.files << "lib/#{spec.platform}/libpq.dll"
67
+ # end
68
+ end
69
+
70
+ RSpec::Core::RakeTask.new(:spec).rspec_opts = "--profile -cfdoc"
71
+ task :test => :spec
72
+
73
+ # Use the fivefish formatter for docs generated from development checkout
74
+ require 'rdoc/task'
75
+
76
+ RDoc::Task.new( 'docs' ) do |rdoc|
77
+ rdoc.options = $gem_spec.rdoc_options
78
+ rdoc.rdoc_files = $gem_spec.extra_rdoc_files
79
+ rdoc.generator = :fivefish
80
+ rdoc.rdoc_dir = 'doc'
81
+ end
82
+
83
+ desc "Build the source gem #{$gem_spec.full_name}.gem into the pkg directory"
84
+ task :gem => :build
85
+
86
+ task :clobber do
87
+ puts "Stop any Postmaster instances that remain after testing."
88
+ require_relative 'spec/helpers'
89
+ PG::TestingHelpers.stop_existing_postmasters()
90
+ end
91
+
92
+ desc "Update list of server error codes"
93
+ task :update_error_codes do
94
+ URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL_15_0"
95
+
96
+ ERRORCODES_TXT = "ext/errorcodes.txt"
97
+ sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
98
+
99
+ ruby 'ext/errorcodes.rb', 'ext/errorcodes.txt', 'ext/errorcodes.def'
100
+ end
101
+
102
+ file 'ext/pg_errors.c' => ['ext/errorcodes.def'] do
103
+ # trigger compilation of changed errorcodes.def
104
+ touch 'ext/pg_errors.c'
105
+ end
106
+
107
+ desc "Translate readme"
108
+ task :translate do
109
+ cd "translation" do
110
+ # po4a's lexer might change, so record its version for reference
111
+ sh "LANG=C po4a --version > .po4a-version"
112
+
113
+ sh "po4a po4a.cfg"
114
+ end
115
+ end
data/certs/ged.pem ADDED
@@ -0,0 +1,24 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIID+DCCAmCgAwIBAgIBBDANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdnZWQv
3
+ REM9RmFlcmllTVVEL0RDPW9yZzAeFw0yMjAxMDcyMzU4MTRaFw0yMzAxMDcyMzU4
4
+ MTRaMCIxIDAeBgNVBAMMF2dlZC9EQz1GYWVyaWVNVUQvREM9b3JnMIIBojANBgkq
5
+ hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAvyVhkRzvlEs0fe7145BYLfN6njX9ih5H
6
+ L60U0p0euIurpv84op9CNKF9tx+1WKwyQvQP7qFGuZxkSUuWcP/sFhDXL1lWUuIl
7
+ M4uHbGCRmOshDrF4dgnBeOvkHr1fIhPlJm5FO+Vew8tSQmlDsosxLUx+VB7DrVFO
8
+ 5PU2AEbf04GGSrmqADGWXeaslaoRdb1fu/0M5qfPTRn5V39sWD9umuDAF9qqil/x
9
+ Sl6phTvgBrG8GExHbNZpLARd3xrBYLEFsX7RvBn2UPfgsrtvpdXjsHGfpT3IPN+B
10
+ vQ66lts4alKC69TE5cuKasWBm+16A4aEe3XdZBRNmtOu/g81gvwA7fkJHKllJuaI
11
+ dXzdHqq+zbGZVSQ7pRYHYomD0IiDe1DbIouFnPWmagaBnGHwXkDT2bKKP+s2v21m
12
+ ozilJg4aar2okb/RA6VS87o+d7g6LpDDMMQjH4G9OPnJENLdhu8KnPw/ivSVvQw7
13
+ N2I4L/ZOIe2DIVuYH7aLHfjZDQv/mNgpAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYD
14
+ VR0PBAQDAgSwMB0GA1UdDgQWBBRyjf55EbrHagiRLqt5YAd3yb8k4DANBgkqhkiG
15
+ 9w0BAQsFAAOCAYEASrm1AbEoxACZ9WXJH3R5axV3U0CA4xaETlL2YT+2nOfVBMQ9
16
+ 0ZlkPx6j4ghKJgAIi1TMfDM2JyPJsppQh8tiNccDjWc62UZRY/dq26cMqf/lcI+a
17
+ 6YBuEYvzZfearwVs8tHnXtwYV3WSCoCOQaB+nq2lA1O+nkKNl41WOsVbNama5jx3
18
+ 8cQtVSEEmZy6jIDJ8c5TmBJ7BQUDEUEWA/A3V42Xyctoj7DvUXWE0lP+X6ypAVSr
19
+ lFh3TS64D7NTvxkmg7natUoCvobl6kGl4yMaqE4YRTlfuzhpf91TSOntClqrAOsS
20
+ K1s56WndQj3IoBocdY9mQhDZLtLHofSkymoP8btBlj5SsN24TiF0VMSZlctSCYZg
21
+ GKyHim/MMlIfGOWsgfioq5jzwmql7W4CDubbb8Lkg70v+hN2E/MnNVAcNE3gyaGc
22
+ P5YP5BAbNW+gvd3QHRiWTTuhgHrdDnGdXg93N2M5KHn1ug8BtPLQwlcFwEpKnlLn
23
+ btEP+7EplFuoiMfd
24
+ -----END CERTIFICATE-----