pg 1.3.0.rc2-x64-mingw-ucrt
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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +3 -0
- data/.appveyor.yml +36 -0
- data/.gems +6 -0
- data/.gemtest +0 -0
- data/.github/workflows/binary-gems.yml +85 -0
- data/.github/workflows/source-gem.yml +130 -0
- data/.gitignore +13 -0
- data/.hgsigs +34 -0
- data/.hgtags +41 -0
- data/.irbrc +23 -0
- data/.pryrc +23 -0
- data/.tm_properties +21 -0
- data/.travis.yml +49 -0
- data/BSDL +22 -0
- data/Contributors.rdoc +46 -0
- data/Gemfile +14 -0
- data/History.rdoc +648 -0
- data/LICENSE +56 -0
- data/Manifest.txt +72 -0
- data/POSTGRES +23 -0
- data/README-OS_X.rdoc +68 -0
- data/README-Windows.rdoc +56 -0
- data/README.ja.rdoc +13 -0
- data/README.rdoc +214 -0
- data/Rakefile +106 -0
- data/Rakefile.cross +300 -0
- data/certs/ged.pem +24 -0
- data/ext/errorcodes.def +1040 -0
- data/ext/errorcodes.rb +45 -0
- data/ext/errorcodes.txt +496 -0
- data/ext/extconf.rb +165 -0
- data/ext/gvl_wrappers.c +21 -0
- data/ext/gvl_wrappers.h +264 -0
- data/ext/pg.c +732 -0
- data/ext/pg.h +385 -0
- data/ext/pg_binary_decoder.c +229 -0
- data/ext/pg_binary_encoder.c +163 -0
- data/ext/pg_coder.c +615 -0
- data/ext/pg_connection.c +4415 -0
- data/ext/pg_copy_coder.c +628 -0
- data/ext/pg_errors.c +95 -0
- data/ext/pg_record_coder.c +519 -0
- data/ext/pg_result.c +1683 -0
- data/ext/pg_text_decoder.c +987 -0
- data/ext/pg_text_encoder.c +814 -0
- data/ext/pg_tuple.c +575 -0
- data/ext/pg_type_map.c +199 -0
- data/ext/pg_type_map_all_strings.c +129 -0
- data/ext/pg_type_map_by_class.c +269 -0
- data/ext/pg_type_map_by_column.c +349 -0
- data/ext/pg_type_map_by_mri_type.c +313 -0
- data/ext/pg_type_map_by_oid.c +385 -0
- data/ext/pg_type_map_in_ruby.c +330 -0
- data/ext/pg_util.c +149 -0
- data/ext/pg_util.h +65 -0
- data/ext/vc/pg.sln +26 -0
- data/ext/vc/pg_18/pg.vcproj +216 -0
- data/ext/vc/pg_19/pg_19.vcproj +209 -0
- data/lib/3.1/pg_ext.so +0 -0
- data/lib/pg/basic_type_map_based_on_result.rb +47 -0
- data/lib/pg/basic_type_map_for_queries.rb +193 -0
- data/lib/pg/basic_type_map_for_results.rb +81 -0
- data/lib/pg/basic_type_registry.rb +296 -0
- data/lib/pg/binary_decoder.rb +23 -0
- data/lib/pg/coder.rb +104 -0
- data/lib/pg/connection.rb +813 -0
- data/lib/pg/constants.rb +12 -0
- data/lib/pg/exceptions.rb +12 -0
- data/lib/pg/result.rb +43 -0
- data/lib/pg/text_decoder.rb +46 -0
- data/lib/pg/text_encoder.rb +59 -0
- data/lib/pg/tuple.rb +30 -0
- data/lib/pg/type_map_by_column.rb +16 -0
- data/lib/pg/version.rb +4 -0
- data/lib/pg.rb +87 -0
- data/lib/x64-mingw-ucrt/libpq.dll +0 -0
- data/misc/openssl-pg-segfault.rb +31 -0
- data/misc/postgres/History.txt +9 -0
- data/misc/postgres/Manifest.txt +5 -0
- data/misc/postgres/README.txt +21 -0
- data/misc/postgres/Rakefile +21 -0
- data/misc/postgres/lib/postgres.rb +16 -0
- data/misc/ruby-pg/History.txt +9 -0
- data/misc/ruby-pg/Manifest.txt +5 -0
- data/misc/ruby-pg/README.txt +21 -0
- data/misc/ruby-pg/Rakefile +21 -0
- data/misc/ruby-pg/lib/ruby/pg.rb +16 -0
- data/pg.gemspec +32 -0
- data/sample/array_insert.rb +20 -0
- data/sample/async_api.rb +106 -0
- data/sample/async_copyto.rb +39 -0
- data/sample/async_mixed.rb +56 -0
- data/sample/check_conn.rb +21 -0
- data/sample/copydata.rb +71 -0
- data/sample/copyfrom.rb +81 -0
- data/sample/copyto.rb +19 -0
- data/sample/cursor.rb +21 -0
- data/sample/disk_usage_report.rb +177 -0
- data/sample/issue-119.rb +94 -0
- data/sample/losample.rb +69 -0
- data/sample/minimal-testcase.rb +17 -0
- data/sample/notify_wait.rb +72 -0
- data/sample/pg_statistics.rb +285 -0
- data/sample/replication_monitor.rb +222 -0
- data/sample/test_binary_values.rb +33 -0
- data/sample/wal_shipper.rb +434 -0
- data/sample/warehouse_partitions.rb +311 -0
- data.tar.gz.sig +0 -0
- metadata +188 -0
- metadata.gz.sig +0 -0
data/ext/extconf.rb
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
require 'pp'
|
2
|
+
require 'mkmf'
|
3
|
+
|
4
|
+
|
5
|
+
if ENV['MAINTAINER_MODE']
|
6
|
+
$stderr.puts "Maintainer mode enabled."
|
7
|
+
$CFLAGS <<
|
8
|
+
' -Wall' <<
|
9
|
+
' -ggdb' <<
|
10
|
+
' -DDEBUG' <<
|
11
|
+
' -pedantic'
|
12
|
+
end
|
13
|
+
|
14
|
+
if pgdir = with_config( 'pg' )
|
15
|
+
ENV['PATH'] = "#{pgdir}/bin" + File::PATH_SEPARATOR + ENV['PATH']
|
16
|
+
end
|
17
|
+
|
18
|
+
if enable_config("gvl-unlock", true)
|
19
|
+
$defs.push( "-DENABLE_GVL_UNLOCK" )
|
20
|
+
$stderr.puts "Calling libpq with GVL unlocked"
|
21
|
+
else
|
22
|
+
$stderr.puts "Calling libpq with GVL locked"
|
23
|
+
end
|
24
|
+
|
25
|
+
if enable_config("windows-cross")
|
26
|
+
# Avoid dependency to external libgcc.dll on x86-mingw32
|
27
|
+
$LDFLAGS << " -static-libgcc"
|
28
|
+
# Don't use pg_config for cross build, but --with-pg-* path options
|
29
|
+
dir_config 'pg'
|
30
|
+
|
31
|
+
else
|
32
|
+
# Native build
|
33
|
+
|
34
|
+
pgconfig = with_config('pg-config') ||
|
35
|
+
with_config('pg_config') ||
|
36
|
+
find_executable('pg_config')
|
37
|
+
|
38
|
+
if pgconfig && pgconfig != 'ignore'
|
39
|
+
$stderr.puts "Using config values from %s" % [ pgconfig ]
|
40
|
+
incdir = `"#{pgconfig}" --includedir`.chomp
|
41
|
+
libdir = `"#{pgconfig}" --libdir`.chomp
|
42
|
+
dir_config 'pg', incdir, libdir
|
43
|
+
|
44
|
+
# Windows traditionally stores DLLs beside executables, not in libdir
|
45
|
+
dlldir = RUBY_PLATFORM=~/mingw|mswin/ ? `"#{pgconfig}" --bindir`.chomp : libdir
|
46
|
+
|
47
|
+
elsif checking_for "libpq per pkg-config" do
|
48
|
+
_cflags, ldflags, _libs = pkg_config("libpq")
|
49
|
+
dlldir = ldflags && ldflags[/-L([^ ]+)/] && $1
|
50
|
+
end
|
51
|
+
|
52
|
+
else
|
53
|
+
incdir, libdir = dir_config 'pg'
|
54
|
+
dlldir = libdir
|
55
|
+
end
|
56
|
+
|
57
|
+
# Try to use runtime path linker option, even if RbConfig doesn't know about it.
|
58
|
+
# The rpath option is usually set implicit by dir_config(), but so far not
|
59
|
+
# on MacOS-X.
|
60
|
+
if dlldir && RbConfig::CONFIG["RPATHFLAG"].to_s.empty?
|
61
|
+
append_ldflags "-Wl,-rpath,#{dlldir.quote}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
$stderr.puts "Using libpq from #{dlldir}"
|
66
|
+
|
67
|
+
File.write("postgresql_lib_path.rb", <<-EOT)
|
68
|
+
module PG
|
69
|
+
POSTGRESQL_LIB_PATH = #{dlldir.inspect}
|
70
|
+
end
|
71
|
+
EOT
|
72
|
+
$INSTALLFILES = {
|
73
|
+
"./postgresql_lib_path.rb" => "$(RUBYLIBDIR)/pg/"
|
74
|
+
}
|
75
|
+
|
76
|
+
if RUBY_VERSION >= '2.3.0' && /solaris/ =~ RUBY_PLATFORM
|
77
|
+
append_cppflags( '-D__EXTENSIONS__' )
|
78
|
+
end
|
79
|
+
|
80
|
+
begin
|
81
|
+
find_header( 'libpq-fe.h' ) or abort "Can't find the 'libpq-fe.h header"
|
82
|
+
find_header( 'libpq/libpq-fs.h' ) or abort "Can't find the 'libpq/libpq-fs.h header"
|
83
|
+
find_header( 'pg_config_manual.h' ) or abort "Can't find the 'pg_config_manual.h' header"
|
84
|
+
|
85
|
+
abort "Can't find the PostgreSQL client library (libpq)" unless
|
86
|
+
have_library( 'pq', 'PQconnectdb', ['libpq-fe.h'] ) ||
|
87
|
+
have_library( 'libpq', 'PQconnectdb', ['libpq-fe.h'] ) ||
|
88
|
+
have_library( 'ms/libpq', 'PQconnectdb', ['libpq-fe.h'] )
|
89
|
+
|
90
|
+
rescue SystemExit => err
|
91
|
+
install_text = case RUBY_PLATFORM
|
92
|
+
when /linux/
|
93
|
+
<<-EOT
|
94
|
+
Please install libpq or postgresql client package like so:
|
95
|
+
sudo apt install libpq-dev
|
96
|
+
sudo yum install postgresql-devel
|
97
|
+
sudo zypper in postgresql-devel
|
98
|
+
sudo pacman -S postgresql-libs
|
99
|
+
EOT
|
100
|
+
when /darwin/
|
101
|
+
<<-EOT
|
102
|
+
Please install libpq or postgresql client package like so:
|
103
|
+
brew install libpq
|
104
|
+
EOT
|
105
|
+
when /mingw/
|
106
|
+
<<-EOT
|
107
|
+
Please install libpq or postgresql client package like so:
|
108
|
+
ridk exec sh -c "pacman -S ${MINGW_PACKAGE_PREFIX}-postgresql"
|
109
|
+
EOT
|
110
|
+
else
|
111
|
+
<<-EOT
|
112
|
+
Please install libpq or postgresql client package.
|
113
|
+
EOT
|
114
|
+
end
|
115
|
+
|
116
|
+
$stderr.puts <<-EOT
|
117
|
+
*****************************************************************************
|
118
|
+
|
119
|
+
Unable to find PostgreSQL client library.
|
120
|
+
|
121
|
+
#{install_text}
|
122
|
+
or try again with:
|
123
|
+
gem install pg -- --with-pg-config=/path/to/pg_config
|
124
|
+
|
125
|
+
or set library paths manually with:
|
126
|
+
gem install pg -- --with-pg-include=/path/to/libpq-fe.h/ --with-pg-lib=/path/to/libpq.so/
|
127
|
+
|
128
|
+
EOT
|
129
|
+
raise
|
130
|
+
end
|
131
|
+
|
132
|
+
if /mingw/ =~ RUBY_PLATFORM && RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
|
133
|
+
# Work around: https://sourceware.org/bugzilla/show_bug.cgi?id=22504
|
134
|
+
checking_for "workaround gcc version with link issue" do
|
135
|
+
`#{RbConfig::MAKEFILE_CONFIG['CC']} --version`.chomp =~ /\s(\d+)\.\d+\.\d+(\s|$)/ &&
|
136
|
+
$1.to_i >= 6 &&
|
137
|
+
have_library(':libpq.lib') # Prefer linking to libpq.lib over libpq.dll if available
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
have_func 'PQconninfo' or
|
142
|
+
abort "Your PostgreSQL is too old. Either install an older version " +
|
143
|
+
"of this gem or upgrade your database to at least PostgreSQL-9.3."
|
144
|
+
# optional headers/functions
|
145
|
+
have_func 'PQsslAttribute' # since PostgreSQL-9.5
|
146
|
+
have_func 'PQresultVerboseErrorMessage' # since PostgreSQL-9.6
|
147
|
+
have_func 'PQencryptPasswordConn' # since PostgreSQL-10
|
148
|
+
have_func 'PQresultMemorySize' # since PostgreSQL-12
|
149
|
+
have_func 'PQenterPipelineMode' # since PostgreSQL-14
|
150
|
+
have_func 'timegm'
|
151
|
+
have_func 'rb_gc_adjust_memory_usage' # since ruby-2.4
|
152
|
+
have_func 'rb_gc_mark_movable' # since ruby-2.7
|
153
|
+
have_func 'rb_io_wait' # since ruby-3.0
|
154
|
+
|
155
|
+
# unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
|
156
|
+
have_header 'unistd.h'
|
157
|
+
have_header 'inttypes.h'
|
158
|
+
|
159
|
+
checking_for "C99 variable length arrays" do
|
160
|
+
$defs.push( "-DHAVE_VARIABLE_LENGTH_ARRAYS" ) if try_compile('void test_vla(int l){ int vla[l]; }')
|
161
|
+
end
|
162
|
+
|
163
|
+
create_header()
|
164
|
+
create_makefile( "pg_ext" )
|
165
|
+
|
data/ext/gvl_wrappers.c
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
/*
|
2
|
+
* gvl_wrappers.c - Wrapper functions for locking/unlocking the Ruby GVL
|
3
|
+
*
|
4
|
+
*/
|
5
|
+
|
6
|
+
#include "pg.h"
|
7
|
+
|
8
|
+
#ifndef HAVE_PQENCRYPTPASSWORDCONN
|
9
|
+
char *PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm){return NULL;}
|
10
|
+
#endif
|
11
|
+
|
12
|
+
#ifdef ENABLE_GVL_UNLOCK
|
13
|
+
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_WRAPPER_STRUCT );
|
14
|
+
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_SKELETON );
|
15
|
+
#endif
|
16
|
+
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_STUB );
|
17
|
+
#ifdef ENABLE_GVL_UNLOCK
|
18
|
+
FOR_EACH_CALLBACK_FUNCTION( DEFINE_GVL_WRAPPER_STRUCT );
|
19
|
+
FOR_EACH_CALLBACK_FUNCTION( DEFINE_GVLCB_SKELETON );
|
20
|
+
#endif
|
21
|
+
FOR_EACH_CALLBACK_FUNCTION( DEFINE_GVLCB_STUB );
|
data/ext/gvl_wrappers.h
ADDED
@@ -0,0 +1,264 @@
|
|
1
|
+
/*
|
2
|
+
* gvl_wrappers.h - Wrapper functions for locking/unlocking the Ruby GVL
|
3
|
+
*
|
4
|
+
* These are some obscure preprocessor directives that allow to generate
|
5
|
+
* drop-in replacement wrapper functions in a declarative manner.
|
6
|
+
* These wrapper functions ensure that ruby's GVL is released on each
|
7
|
+
* function call and reacquired at the end of the call or in callbacks.
|
8
|
+
* This way blocking functions calls don't block concurrent ruby threads.
|
9
|
+
*
|
10
|
+
* The wrapper of each function is prefixed by "gvl_".
|
11
|
+
*
|
12
|
+
* Use "gcc -E" to retrieve the generated code.
|
13
|
+
*/
|
14
|
+
|
15
|
+
#ifndef __gvl_wrappers_h
|
16
|
+
#define __gvl_wrappers_h
|
17
|
+
|
18
|
+
#include <ruby/thread.h>
|
19
|
+
|
20
|
+
#ifdef RUBY_EXTCONF_H
|
21
|
+
# include RUBY_EXTCONF_H
|
22
|
+
#endif
|
23
|
+
|
24
|
+
#define DEFINE_PARAM_LIST1(type, name) \
|
25
|
+
name,
|
26
|
+
|
27
|
+
#define DEFINE_PARAM_LIST2(type, name) \
|
28
|
+
p->params.name,
|
29
|
+
|
30
|
+
#define DEFINE_PARAM_LIST3(type, name) \
|
31
|
+
type name,
|
32
|
+
|
33
|
+
#define DEFINE_PARAM_DECL(type, name) \
|
34
|
+
type name;
|
35
|
+
|
36
|
+
#define DEFINE_GVL_WRAPPER_STRUCT(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
37
|
+
struct gvl_wrapper_##name##_params { \
|
38
|
+
struct { \
|
39
|
+
FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_DECL) \
|
40
|
+
lastparamtype lastparamname; \
|
41
|
+
} params; \
|
42
|
+
when_non_void( rettype retval; ) \
|
43
|
+
};
|
44
|
+
|
45
|
+
#define DEFINE_GVL_SKELETON(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
46
|
+
static void * gvl_##name##_skeleton( void *data ){ \
|
47
|
+
struct gvl_wrapper_##name##_params *p = (struct gvl_wrapper_##name##_params*)data; \
|
48
|
+
when_non_void( p->retval = ) \
|
49
|
+
name( FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST2) p->params.lastparamname ); \
|
50
|
+
return NULL; \
|
51
|
+
}
|
52
|
+
|
53
|
+
#ifdef ENABLE_GVL_UNLOCK
|
54
|
+
#define DEFINE_GVL_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
55
|
+
rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
|
56
|
+
struct gvl_wrapper_##name##_params params = { \
|
57
|
+
{FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname}, when_non_void((rettype)0) \
|
58
|
+
}; \
|
59
|
+
rb_thread_call_without_gvl(gvl_##name##_skeleton, ¶ms, RUBY_UBF_IO, 0); \
|
60
|
+
when_non_void( return params.retval; ) \
|
61
|
+
}
|
62
|
+
#else
|
63
|
+
#define DEFINE_GVL_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
64
|
+
rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
|
65
|
+
when_non_void( return ) \
|
66
|
+
name( FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname ); \
|
67
|
+
}
|
68
|
+
#endif
|
69
|
+
|
70
|
+
#define DEFINE_GVL_STUB_DECL(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
71
|
+
rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname);
|
72
|
+
|
73
|
+
#define DEFINE_GVLCB_SKELETON(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
74
|
+
static void * gvl_##name##_skeleton( void *data ){ \
|
75
|
+
struct gvl_wrapper_##name##_params *p = (struct gvl_wrapper_##name##_params*)data; \
|
76
|
+
when_non_void( p->retval = ) \
|
77
|
+
name( FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST2) p->params.lastparamname ); \
|
78
|
+
return NULL; \
|
79
|
+
}
|
80
|
+
|
81
|
+
#ifdef ENABLE_GVL_UNLOCK
|
82
|
+
#define DEFINE_GVLCB_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
83
|
+
rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
|
84
|
+
struct gvl_wrapper_##name##_params params = { \
|
85
|
+
{FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname}, when_non_void((rettype)0) \
|
86
|
+
}; \
|
87
|
+
rb_thread_call_with_gvl(gvl_##name##_skeleton, ¶ms); \
|
88
|
+
when_non_void( return params.retval; ) \
|
89
|
+
}
|
90
|
+
#else
|
91
|
+
#define DEFINE_GVLCB_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
92
|
+
rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
|
93
|
+
when_non_void( return ) \
|
94
|
+
name( FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname ); \
|
95
|
+
}
|
96
|
+
#endif
|
97
|
+
|
98
|
+
#define GVL_TYPE_VOID(string)
|
99
|
+
#define GVL_TYPE_NONVOID(string) string
|
100
|
+
|
101
|
+
|
102
|
+
/*
|
103
|
+
* Definitions of blocking functions and their parameters
|
104
|
+
*/
|
105
|
+
|
106
|
+
#define FOR_EACH_PARAM_OF_PQconnectdb(param)
|
107
|
+
|
108
|
+
#define FOR_EACH_PARAM_OF_PQconnectStart(param)
|
109
|
+
|
110
|
+
#define FOR_EACH_PARAM_OF_PQconnectPoll(param)
|
111
|
+
|
112
|
+
#define FOR_EACH_PARAM_OF_PQreset(param)
|
113
|
+
|
114
|
+
#define FOR_EACH_PARAM_OF_PQresetStart(param)
|
115
|
+
|
116
|
+
#define FOR_EACH_PARAM_OF_PQresetPoll(param)
|
117
|
+
|
118
|
+
#define FOR_EACH_PARAM_OF_PQping(param)
|
119
|
+
|
120
|
+
#define FOR_EACH_PARAM_OF_PQexec(param) \
|
121
|
+
param(PGconn *, conn)
|
122
|
+
|
123
|
+
#define FOR_EACH_PARAM_OF_PQexecParams(param) \
|
124
|
+
param(PGconn *, conn) \
|
125
|
+
param(const char *, command) \
|
126
|
+
param(int, nParams) \
|
127
|
+
param(const Oid *, paramTypes) \
|
128
|
+
param(const char * const *, paramValues) \
|
129
|
+
param(const int *, paramLengths) \
|
130
|
+
param(const int *, paramFormats)
|
131
|
+
|
132
|
+
#define FOR_EACH_PARAM_OF_PQexecPrepared(param) \
|
133
|
+
param(PGconn *, conn) \
|
134
|
+
param(const char *, stmtName) \
|
135
|
+
param(int, nParams) \
|
136
|
+
param(const char * const *, paramValues) \
|
137
|
+
param(const int *, paramLengths) \
|
138
|
+
param(const int *, paramFormats)
|
139
|
+
|
140
|
+
#define FOR_EACH_PARAM_OF_PQprepare(param) \
|
141
|
+
param(PGconn *, conn) \
|
142
|
+
param(const char *, stmtName) \
|
143
|
+
param(const char *, query) \
|
144
|
+
param(int, nParams)
|
145
|
+
|
146
|
+
#define FOR_EACH_PARAM_OF_PQdescribePrepared(param) \
|
147
|
+
param(PGconn *, conn)
|
148
|
+
|
149
|
+
#define FOR_EACH_PARAM_OF_PQdescribePortal(param) \
|
150
|
+
param(PGconn *, conn)
|
151
|
+
|
152
|
+
#define FOR_EACH_PARAM_OF_PQgetResult(param)
|
153
|
+
|
154
|
+
#define FOR_EACH_PARAM_OF_PQputCopyData(param) \
|
155
|
+
param(PGconn *, conn) \
|
156
|
+
param(const char *, buffer)
|
157
|
+
|
158
|
+
#define FOR_EACH_PARAM_OF_PQputCopyEnd(param) \
|
159
|
+
param(PGconn *, conn)
|
160
|
+
|
161
|
+
#define FOR_EACH_PARAM_OF_PQgetCopyData(param) \
|
162
|
+
param(PGconn *, conn) \
|
163
|
+
param(char **, buffer)
|
164
|
+
|
165
|
+
#define FOR_EACH_PARAM_OF_PQnotifies(param)
|
166
|
+
|
167
|
+
#define FOR_EACH_PARAM_OF_PQsendQuery(param) \
|
168
|
+
param(PGconn *, conn)
|
169
|
+
|
170
|
+
#define FOR_EACH_PARAM_OF_PQsendQueryParams(param) \
|
171
|
+
param(PGconn *, conn) \
|
172
|
+
param(const char *, command) \
|
173
|
+
param(int, nParams) \
|
174
|
+
param(const Oid *, paramTypes) \
|
175
|
+
param(const char *const *, paramValues) \
|
176
|
+
param(const int *, paramLengths) \
|
177
|
+
param(const int *, paramFormats)
|
178
|
+
|
179
|
+
#define FOR_EACH_PARAM_OF_PQsendPrepare(param) \
|
180
|
+
param(PGconn *, conn) \
|
181
|
+
param(const char *, stmtName) \
|
182
|
+
param(const char *, query) \
|
183
|
+
param(int, nParams)
|
184
|
+
|
185
|
+
#define FOR_EACH_PARAM_OF_PQsendQueryPrepared(param) \
|
186
|
+
param(PGconn *, conn) \
|
187
|
+
param(const char *, stmtName) \
|
188
|
+
param(int, nParams) \
|
189
|
+
param(const char *const *, paramValues) \
|
190
|
+
param(const int *, paramLengths) \
|
191
|
+
param(const int *, paramFormats)
|
192
|
+
|
193
|
+
#define FOR_EACH_PARAM_OF_PQsendDescribePrepared(param) \
|
194
|
+
param(PGconn *, conn)
|
195
|
+
|
196
|
+
#define FOR_EACH_PARAM_OF_PQsendDescribePortal(param) \
|
197
|
+
param(PGconn *, conn)
|
198
|
+
|
199
|
+
#define FOR_EACH_PARAM_OF_PQsetClientEncoding(param) \
|
200
|
+
param(PGconn *, conn)
|
201
|
+
|
202
|
+
#define FOR_EACH_PARAM_OF_PQisBusy(param)
|
203
|
+
|
204
|
+
#define FOR_EACH_PARAM_OF_PQencryptPasswordConn(param) \
|
205
|
+
param(PGconn *, conn) \
|
206
|
+
param(const char *, passwd) \
|
207
|
+
param(const char *, user)
|
208
|
+
|
209
|
+
#define FOR_EACH_PARAM_OF_PQcancel(param) \
|
210
|
+
param(PGcancel *, cancel) \
|
211
|
+
param(char *, errbuf)
|
212
|
+
|
213
|
+
/* function( name, void_or_nonvoid, returntype, lastparamtype, lastparamname ) */
|
214
|
+
#define FOR_EACH_BLOCKING_FUNCTION(function) \
|
215
|
+
function(PQconnectdb, GVL_TYPE_NONVOID, PGconn *, const char *, conninfo) \
|
216
|
+
function(PQconnectStart, GVL_TYPE_NONVOID, PGconn *, const char *, conninfo) \
|
217
|
+
function(PQconnectPoll, GVL_TYPE_NONVOID, PostgresPollingStatusType, PGconn *, conn) \
|
218
|
+
function(PQreset, GVL_TYPE_VOID, void, PGconn *, conn) \
|
219
|
+
function(PQresetStart, GVL_TYPE_NONVOID, int, PGconn *, conn) \
|
220
|
+
function(PQresetPoll, GVL_TYPE_NONVOID, PostgresPollingStatusType, PGconn *, conn) \
|
221
|
+
function(PQping, GVL_TYPE_NONVOID, PGPing, const char *, conninfo) \
|
222
|
+
function(PQexec, GVL_TYPE_NONVOID, PGresult *, const char *, command) \
|
223
|
+
function(PQexecParams, GVL_TYPE_NONVOID, PGresult *, int, resultFormat) \
|
224
|
+
function(PQexecPrepared, GVL_TYPE_NONVOID, PGresult *, int, resultFormat) \
|
225
|
+
function(PQprepare, GVL_TYPE_NONVOID, PGresult *, const Oid *, paramTypes) \
|
226
|
+
function(PQdescribePrepared, GVL_TYPE_NONVOID, PGresult *, const char *, stmtName) \
|
227
|
+
function(PQdescribePortal, GVL_TYPE_NONVOID, PGresult *, const char *, portalName) \
|
228
|
+
function(PQgetResult, GVL_TYPE_NONVOID, PGresult *, PGconn *, conn) \
|
229
|
+
function(PQputCopyData, GVL_TYPE_NONVOID, int, int, nbytes) \
|
230
|
+
function(PQputCopyEnd, GVL_TYPE_NONVOID, int, const char *, errormsg) \
|
231
|
+
function(PQgetCopyData, GVL_TYPE_NONVOID, int, int, async) \
|
232
|
+
function(PQnotifies, GVL_TYPE_NONVOID, PGnotify *, PGconn *, conn) \
|
233
|
+
function(PQsendQuery, GVL_TYPE_NONVOID, int, const char *, query) \
|
234
|
+
function(PQsendQueryParams, GVL_TYPE_NONVOID, int, int, resultFormat) \
|
235
|
+
function(PQsendPrepare, GVL_TYPE_NONVOID, int, const Oid *, paramTypes) \
|
236
|
+
function(PQsendQueryPrepared, GVL_TYPE_NONVOID, int, int, resultFormat) \
|
237
|
+
function(PQsendDescribePrepared, GVL_TYPE_NONVOID, int, const char *, stmt) \
|
238
|
+
function(PQsendDescribePortal, GVL_TYPE_NONVOID, int, const char *, portal) \
|
239
|
+
function(PQsetClientEncoding, GVL_TYPE_NONVOID, int, const char *, encoding) \
|
240
|
+
function(PQisBusy, GVL_TYPE_NONVOID, int, PGconn *, conn) \
|
241
|
+
function(PQencryptPasswordConn, GVL_TYPE_NONVOID, char *, const char *, algorithm) \
|
242
|
+
function(PQcancel, GVL_TYPE_NONVOID, int, int, errbufsize);
|
243
|
+
|
244
|
+
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_STUB_DECL );
|
245
|
+
|
246
|
+
|
247
|
+
/*
|
248
|
+
* Definitions of callback functions and their parameters
|
249
|
+
*/
|
250
|
+
|
251
|
+
#define FOR_EACH_PARAM_OF_notice_processor_proxy(param) \
|
252
|
+
param(void *, arg)
|
253
|
+
|
254
|
+
#define FOR_EACH_PARAM_OF_notice_receiver_proxy(param) \
|
255
|
+
param(void *, arg)
|
256
|
+
|
257
|
+
/* function( name, void_or_nonvoid, returntype, lastparamtype, lastparamname ) */
|
258
|
+
#define FOR_EACH_CALLBACK_FUNCTION(function) \
|
259
|
+
function(notice_processor_proxy, GVL_TYPE_VOID, void, const char *, message) \
|
260
|
+
function(notice_receiver_proxy, GVL_TYPE_VOID, void, const PGresult *, result) \
|
261
|
+
|
262
|
+
FOR_EACH_CALLBACK_FUNCTION( DEFINE_GVL_STUB_DECL );
|
263
|
+
|
264
|
+
#endif /* end __gvl_wrappers_h */
|