pg 1.6.0.rc1-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +4 -0
- data/BSDL +22 -0
- data/Contributors.rdoc +46 -0
- data/Gemfile +23 -0
- data/History.md +958 -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.md +300 -0
- data/README.md +286 -0
- data/Rakefile +161 -0
- data/certs/ged.pem +24 -0
- data/certs/kanis@comcard.de.pem +20 -0
- data/certs/larskanis-2022.pem +26 -0
- data/certs/larskanis-2023.pem +24 -0
- data/certs/larskanis-2024.pem +24 -0
- data/ext/errorcodes.def +1043 -0
- data/ext/errorcodes.rb +45 -0
- data/ext/errorcodes.txt +494 -0
- data/ext/extconf.rb +282 -0
- data/ext/gvl_wrappers.c +32 -0
- data/ext/gvl_wrappers.h +297 -0
- data/ext/pg.c +703 -0
- data/ext/pg.h +390 -0
- data/ext/pg_binary_decoder.c +460 -0
- data/ext/pg_binary_encoder.c +583 -0
- data/ext/pg_cancel_connection.c +360 -0
- data/ext/pg_coder.c +622 -0
- data/ext/pg_connection.c +4869 -0
- data/ext/pg_copy_coder.c +921 -0
- data/ext/pg_errors.c +95 -0
- data/ext/pg_record_coder.c +522 -0
- data/ext/pg_result.c +1764 -0
- data/ext/pg_text_decoder.c +1008 -0
- data/ext/pg_text_encoder.c +833 -0
- data/ext/pg_tuple.c +572 -0
- data/ext/pg_type_map.c +200 -0
- data/ext/pg_type_map_all_strings.c +130 -0
- data/ext/pg_type_map_by_class.c +271 -0
- data/ext/pg_type_map_by_column.c +355 -0
- data/ext/pg_type_map_by_mri_type.c +313 -0
- data/ext/pg_type_map_by_oid.c +388 -0
- data/ext/pg_type_map_in_ruby.c +333 -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/2.7/pg_ext.so +0 -0
- data/lib/3.0/pg_ext.so +0 -0
- data/lib/3.1/pg_ext.so +0 -0
- data/lib/3.2/pg_ext.so +0 -0
- data/lib/3.3/pg_ext.so +0 -0
- data/lib/pg/basic_type_map_based_on_result.rb +67 -0
- data/lib/pg/basic_type_map_for_queries.rb +202 -0
- data/lib/pg/basic_type_map_for_results.rb +104 -0
- data/lib/pg/basic_type_registry.rb +311 -0
- data/lib/pg/binary_decoder/date.rb +9 -0
- data/lib/pg/binary_decoder/timestamp.rb +26 -0
- data/lib/pg/binary_encoder/timestamp.rb +20 -0
- data/lib/pg/cancel_connection.rb +30 -0
- data/lib/pg/coder.rb +106 -0
- data/lib/pg/connection.rb +1027 -0
- data/lib/pg/exceptions.rb +31 -0
- data/lib/pg/result.rb +43 -0
- data/lib/pg/text_decoder/date.rb +21 -0
- data/lib/pg/text_decoder/inet.rb +9 -0
- data/lib/pg/text_decoder/json.rb +17 -0
- data/lib/pg/text_decoder/numeric.rb +9 -0
- data/lib/pg/text_decoder/timestamp.rb +30 -0
- data/lib/pg/text_encoder/date.rb +13 -0
- data/lib/pg/text_encoder/inet.rb +31 -0
- data/lib/pg/text_encoder/json.rb +17 -0
- data/lib/pg/text_encoder/numeric.rb +9 -0
- data/lib/pg/text_encoder/timestamp.rb +24 -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 +144 -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 +36 -0
- data/ports/x86_64-linux/lib/libpq-ruby-pg.so.1 +0 -0
- data/rakelib/task_extension.rb +46 -0
- data/sample/array_insert.rb +20 -0
- data/sample/async_api.rb +102 -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 +252 -0
- metadata.gz.sig +0 -0
data/ext/pg.h
ADDED
@@ -0,0 +1,390 @@
|
|
1
|
+
#ifndef __pg_h
|
2
|
+
#define __pg_h
|
3
|
+
|
4
|
+
#ifdef RUBY_EXTCONF_H
|
5
|
+
# include RUBY_EXTCONF_H
|
6
|
+
#endif
|
7
|
+
|
8
|
+
/* System headers */
|
9
|
+
#include <stdio.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <sys/types.h>
|
12
|
+
#if !defined(_WIN32)
|
13
|
+
# include <sys/time.h>
|
14
|
+
# include <sys/socket.h>
|
15
|
+
#endif
|
16
|
+
#if defined(HAVE_UNISTD_H) && !defined(_WIN32)
|
17
|
+
# include <unistd.h>
|
18
|
+
#endif /* HAVE_UNISTD_H */
|
19
|
+
|
20
|
+
/* Ruby headers */
|
21
|
+
#include "ruby.h"
|
22
|
+
#include "ruby/st.h"
|
23
|
+
#include "ruby/encoding.h"
|
24
|
+
|
25
|
+
#define PG_ENCODING_SET_NOCHECK(obj,i) \
|
26
|
+
do { \
|
27
|
+
if ((i) < ENCODING_INLINE_MAX) \
|
28
|
+
ENCODING_SET_INLINED((obj), (i)); \
|
29
|
+
else \
|
30
|
+
rb_enc_set_index((obj), (i)); \
|
31
|
+
} while(0)
|
32
|
+
|
33
|
+
#include "ruby/io.h"
|
34
|
+
|
35
|
+
#ifndef timeradd
|
36
|
+
#define timeradd(a, b, result) \
|
37
|
+
do { \
|
38
|
+
(result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
|
39
|
+
(result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
|
40
|
+
if ((result)->tv_usec >= 1000000L) { \
|
41
|
+
++(result)->tv_sec; \
|
42
|
+
(result)->tv_usec -= 1000000L; \
|
43
|
+
} \
|
44
|
+
} while (0)
|
45
|
+
#endif
|
46
|
+
|
47
|
+
#ifndef timersub
|
48
|
+
#define timersub(a, b, result) \
|
49
|
+
do { \
|
50
|
+
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
|
51
|
+
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
|
52
|
+
if ((result)->tv_usec < 0) { \
|
53
|
+
--(result)->tv_sec; \
|
54
|
+
(result)->tv_usec += 1000000L; \
|
55
|
+
} \
|
56
|
+
} while (0)
|
57
|
+
#endif
|
58
|
+
|
59
|
+
/* PostgreSQL headers */
|
60
|
+
#include "pg_config.h"
|
61
|
+
#include "libpq-fe.h"
|
62
|
+
#include "libpq/libpq-fs.h" /* large-object interface */
|
63
|
+
#include "pg_config_manual.h"
|
64
|
+
|
65
|
+
#if defined(_WIN32)
|
66
|
+
# include <fcntl.h>
|
67
|
+
typedef long suseconds_t;
|
68
|
+
#endif
|
69
|
+
|
70
|
+
#if defined(HAVE_VARIABLE_LENGTH_ARRAYS)
|
71
|
+
#define PG_VARIABLE_LENGTH_ARRAY(type, name, len, maxlen) type name[(len)];
|
72
|
+
#else
|
73
|
+
#define PG_VARIABLE_LENGTH_ARRAY(type, name, len, maxlen) \
|
74
|
+
type name[(maxlen)] = {(len)>(maxlen) ? (rb_raise(rb_eArgError, "Number of " #name " (%d) exceeds allowed maximum of " #maxlen, (len) ), (type)1) : (type)0};
|
75
|
+
|
76
|
+
#define PG_MAX_COLUMNS 4000
|
77
|
+
#endif
|
78
|
+
|
79
|
+
#define pg_gc_location(x) x = rb_gc_location(x)
|
80
|
+
|
81
|
+
/* For compatibility with ruby < 3.0 */
|
82
|
+
#ifndef RUBY_TYPED_FROZEN_SHAREABLE
|
83
|
+
#define PG_RUBY_TYPED_FROZEN_SHAREABLE 0
|
84
|
+
#else
|
85
|
+
#define PG_RUBY_TYPED_FROZEN_SHAREABLE RUBY_TYPED_FROZEN_SHAREABLE
|
86
|
+
#endif
|
87
|
+
#define PG_ENC_IDX_BITS 28
|
88
|
+
|
89
|
+
/* The data behind each PG::Connection object */
|
90
|
+
typedef struct {
|
91
|
+
PGconn *pgconn;
|
92
|
+
|
93
|
+
/* Cached IO object for the socket descriptor */
|
94
|
+
VALUE socket_io;
|
95
|
+
/* function pointers of the original libpq notice receivers */
|
96
|
+
PQnoticeReceiver default_notice_receiver;
|
97
|
+
PQnoticeProcessor default_notice_processor;
|
98
|
+
/* Proc object that receives notices as PG::Result objects */
|
99
|
+
VALUE notice_receiver;
|
100
|
+
/* Proc object that receives notices as String objects */
|
101
|
+
VALUE notice_processor;
|
102
|
+
/* Kind of PG::TypeMap object for casting query params */
|
103
|
+
VALUE type_map_for_queries;
|
104
|
+
/* Kind of PG::TypeMap object for casting result values */
|
105
|
+
VALUE type_map_for_results;
|
106
|
+
/* IO object internally used for the trace stream */
|
107
|
+
VALUE trace_stream;
|
108
|
+
/* Kind of PG::Coder object for casting ruby values to COPY rows */
|
109
|
+
VALUE encoder_for_put_copy_data;
|
110
|
+
/* Kind of PG::Coder object for casting COPY rows to ruby values */
|
111
|
+
VALUE decoder_for_get_copy_data;
|
112
|
+
/* Ruby encoding index of the client/internal encoding */
|
113
|
+
int enc_idx : PG_ENC_IDX_BITS;
|
114
|
+
/* flags controlling Symbol/String field names */
|
115
|
+
unsigned int flags : 2;
|
116
|
+
/* enable automatic flushing of send data at the end of send_query calls */
|
117
|
+
unsigned int flush_data : 1;
|
118
|
+
|
119
|
+
/* File descriptor to be used for rb_w32_unwrap_io_handle() */
|
120
|
+
int ruby_sd;
|
121
|
+
} t_pg_connection;
|
122
|
+
|
123
|
+
typedef struct pg_coder t_pg_coder;
|
124
|
+
typedef struct pg_typemap t_typemap;
|
125
|
+
|
126
|
+
/* The data behind each PG::Result object */
|
127
|
+
typedef struct {
|
128
|
+
PGresult *pgresult;
|
129
|
+
|
130
|
+
/* The connection object used to build this result */
|
131
|
+
VALUE connection;
|
132
|
+
|
133
|
+
/* The TypeMap used to type cast result values */
|
134
|
+
VALUE typemap;
|
135
|
+
|
136
|
+
/* Pointer to the typemap object data. This is assumed to be
|
137
|
+
* always valid.
|
138
|
+
*/
|
139
|
+
t_typemap *p_typemap;
|
140
|
+
|
141
|
+
/* Ruby encoding index of the client/internal encoding */
|
142
|
+
int enc_idx : PG_ENC_IDX_BITS;
|
143
|
+
|
144
|
+
/* 0 = PGresult is cleared by PG::Result#clear or by the GC
|
145
|
+
* 1 = PGresult is cleared internally by libpq
|
146
|
+
*/
|
147
|
+
unsigned int autoclear : 1;
|
148
|
+
|
149
|
+
/* flags controlling Symbol/String field names */
|
150
|
+
unsigned int flags : 2;
|
151
|
+
|
152
|
+
/* Number of fields in fnames[] .
|
153
|
+
* Set to -1 if fnames[] is not yet initialized.
|
154
|
+
*/
|
155
|
+
int nfields;
|
156
|
+
|
157
|
+
/* Size of PGresult as published to ruby memory management. */
|
158
|
+
ssize_t result_size;
|
159
|
+
|
160
|
+
/* Prefilled tuple Hash with fnames[] as keys. */
|
161
|
+
VALUE tuple_hash;
|
162
|
+
|
163
|
+
/* Hash with fnames[] to field number mapping. */
|
164
|
+
VALUE field_map;
|
165
|
+
|
166
|
+
/* List of field names as frozen String or Symbol objects.
|
167
|
+
* Only valid if nfields != -1
|
168
|
+
*/
|
169
|
+
VALUE fnames[0];
|
170
|
+
} t_pg_result;
|
171
|
+
|
172
|
+
|
173
|
+
typedef int (* t_pg_coder_enc_func)(t_pg_coder *, VALUE, char *, VALUE *, int);
|
174
|
+
typedef VALUE (* t_pg_coder_dec_func)(t_pg_coder *, const char *, int, int, int, int);
|
175
|
+
typedef VALUE (* t_pg_fit_to_result)(VALUE, VALUE);
|
176
|
+
typedef VALUE (* t_pg_fit_to_query)(VALUE, VALUE);
|
177
|
+
typedef int (* t_pg_fit_to_copy_get)(VALUE);
|
178
|
+
typedef VALUE (* t_pg_typecast_result)(t_typemap *, VALUE, int, int);
|
179
|
+
typedef t_pg_coder *(* t_pg_typecast_query_param)(t_typemap *, VALUE, int);
|
180
|
+
typedef VALUE (* t_pg_typecast_copy_get)( t_typemap *, VALUE, int, int, int );
|
181
|
+
|
182
|
+
#define PG_RESULT_FIELD_NAMES_MASK 0x03
|
183
|
+
#define PG_RESULT_FIELD_NAMES_SYMBOL 0x01
|
184
|
+
#define PG_RESULT_FIELD_NAMES_STATIC_SYMBOL 0x02
|
185
|
+
|
186
|
+
#define PG_CODER_TIMESTAMP_DB_UTC 0x0
|
187
|
+
#define PG_CODER_TIMESTAMP_DB_LOCAL 0x1
|
188
|
+
#define PG_CODER_TIMESTAMP_APP_UTC 0x0
|
189
|
+
#define PG_CODER_TIMESTAMP_APP_LOCAL 0x2
|
190
|
+
#define PG_CODER_FORMAT_ERROR_MASK 0xc
|
191
|
+
#define PG_CODER_FORMAT_ERROR_TO_RAISE 0x4
|
192
|
+
#define PG_CODER_FORMAT_ERROR_TO_STRING 0x8
|
193
|
+
#define PG_CODER_FORMAT_ERROR_TO_PARTIAL 0xc
|
194
|
+
|
195
|
+
struct pg_coder {
|
196
|
+
t_pg_coder_enc_func enc_func;
|
197
|
+
t_pg_coder_dec_func dec_func;
|
198
|
+
VALUE coder_obj;
|
199
|
+
Oid oid;
|
200
|
+
int format;
|
201
|
+
/* OR-ed values out of PG_CODER_* */
|
202
|
+
int flags;
|
203
|
+
};
|
204
|
+
|
205
|
+
typedef struct {
|
206
|
+
t_pg_coder comp;
|
207
|
+
t_pg_coder *elem;
|
208
|
+
int needs_quotation;
|
209
|
+
char delimiter;
|
210
|
+
} t_pg_composite_coder;
|
211
|
+
|
212
|
+
struct pg_typemap {
|
213
|
+
struct pg_typemap_funcs {
|
214
|
+
t_pg_fit_to_result fit_to_result;
|
215
|
+
t_pg_fit_to_query fit_to_query;
|
216
|
+
t_pg_fit_to_copy_get fit_to_copy_get;
|
217
|
+
t_pg_typecast_result typecast_result_value;
|
218
|
+
t_pg_typecast_query_param typecast_query_param;
|
219
|
+
t_pg_typecast_copy_get typecast_copy_get;
|
220
|
+
} funcs;
|
221
|
+
VALUE default_typemap;
|
222
|
+
};
|
223
|
+
|
224
|
+
typedef struct {
|
225
|
+
t_typemap typemap;
|
226
|
+
int nfields;
|
227
|
+
struct pg_tmbc_converter {
|
228
|
+
t_pg_coder *cconv;
|
229
|
+
} convs[0];
|
230
|
+
} t_tmbc;
|
231
|
+
|
232
|
+
extern const rb_data_type_t pg_typemap_type;
|
233
|
+
extern const rb_data_type_t pg_coder_type;
|
234
|
+
|
235
|
+
#include "gvl_wrappers.h"
|
236
|
+
|
237
|
+
/***************************************************************************
|
238
|
+
* Globals
|
239
|
+
**************************************************************************/
|
240
|
+
|
241
|
+
extern int pg_skip_deprecation_warning;
|
242
|
+
extern VALUE rb_mPG;
|
243
|
+
extern VALUE rb_ePGerror;
|
244
|
+
extern VALUE rb_eServerError;
|
245
|
+
extern VALUE rb_eUnableToSend;
|
246
|
+
extern VALUE rb_eConnectionBad;
|
247
|
+
extern VALUE rb_eInvalidResultStatus;
|
248
|
+
extern VALUE rb_eNoResultError;
|
249
|
+
extern VALUE rb_eInvalidChangeOfResultFields;
|
250
|
+
extern VALUE rb_mPGconstants;
|
251
|
+
extern VALUE rb_cPGconn;
|
252
|
+
extern VALUE rb_cPGresult;
|
253
|
+
extern VALUE rb_hErrors;
|
254
|
+
extern VALUE rb_cTypeMap;
|
255
|
+
extern VALUE rb_cTypeMapAllStrings;
|
256
|
+
extern VALUE rb_mDefaultTypeMappable;
|
257
|
+
extern VALUE rb_cPG_Coder;
|
258
|
+
extern VALUE rb_cPG_SimpleEncoder;
|
259
|
+
extern VALUE rb_cPG_SimpleDecoder;
|
260
|
+
extern VALUE rb_cPG_CompositeEncoder;
|
261
|
+
extern VALUE rb_cPG_CompositeDecoder;
|
262
|
+
extern VALUE rb_cPG_CopyCoder;
|
263
|
+
extern VALUE rb_cPG_CopyEncoder;
|
264
|
+
extern VALUE rb_cPG_CopyDecoder;
|
265
|
+
extern VALUE rb_mPG_TextEncoder;
|
266
|
+
extern VALUE rb_mPG_TextDecoder;
|
267
|
+
extern VALUE rb_mPG_BinaryEncoder;
|
268
|
+
extern VALUE rb_mPG_BinaryDecoder;
|
269
|
+
extern VALUE rb_mPG_BinaryFormatting;
|
270
|
+
extern const struct pg_typemap_funcs pg_tmbc_funcs;
|
271
|
+
extern const struct pg_typemap_funcs pg_typemap_funcs;
|
272
|
+
|
273
|
+
extern VALUE pg_typemap_all_strings;
|
274
|
+
|
275
|
+
/***************************************************************************
|
276
|
+
* MACROS
|
277
|
+
**************************************************************************/
|
278
|
+
|
279
|
+
#define UNUSED(x) ((void)(x))
|
280
|
+
#define SINGLETON_ALIAS(klass,new,old) rb_define_alias(rb_singleton_class((klass)),(new),(old))
|
281
|
+
|
282
|
+
|
283
|
+
/***************************************************************************
|
284
|
+
* PROTOTYPES
|
285
|
+
**************************************************************************/
|
286
|
+
void Init_pg_ext _(( void ));
|
287
|
+
|
288
|
+
void init_pg_connection _(( void ));
|
289
|
+
void init_pg_result _(( void ));
|
290
|
+
void init_pg_errors _(( void ));
|
291
|
+
void init_pg_type_map _(( void ));
|
292
|
+
void init_pg_type_map_all_strings _(( void ));
|
293
|
+
void init_pg_type_map_by_class _(( void ));
|
294
|
+
void init_pg_type_map_by_column _(( void ));
|
295
|
+
void init_pg_type_map_by_mri_type _(( void ));
|
296
|
+
void init_pg_type_map_by_oid _(( void ));
|
297
|
+
void init_pg_type_map_in_ruby _(( void ));
|
298
|
+
void init_pg_coder _(( void ));
|
299
|
+
void init_pg_copycoder _(( void ));
|
300
|
+
void init_pg_recordcoder _(( void ));
|
301
|
+
void init_pg_text_encoder _(( void ));
|
302
|
+
void init_pg_text_decoder _(( void ));
|
303
|
+
void init_pg_binary_encoder _(( void ));
|
304
|
+
void init_pg_binary_decoder _(( void ));
|
305
|
+
void init_pg_tuple _(( void ));
|
306
|
+
void init_pg_cancon _(( void ));
|
307
|
+
VALUE lookup_error_class _(( const char * ));
|
308
|
+
VALUE pg_bin_dec_bytea _(( t_pg_coder*, const char *, int, int, int, int ));
|
309
|
+
VALUE pg_text_dec_string _(( t_pg_coder*, const char *, int, int, int, int ));
|
310
|
+
int pg_coder_enc_to_s _(( t_pg_coder*, VALUE, char *, VALUE *, int));
|
311
|
+
int pg_text_enc_identifier _(( t_pg_coder*, VALUE, char *, VALUE *, int));
|
312
|
+
t_pg_coder_enc_func pg_coder_enc_func _(( t_pg_coder* ));
|
313
|
+
t_pg_coder_dec_func pg_coder_dec_func _(( t_pg_coder*, int ));
|
314
|
+
VALUE pg_define_coder _(( const char *, void *, VALUE, VALUE ));
|
315
|
+
VALUE pg_obj_to_i _(( VALUE ));
|
316
|
+
VALUE pg_tmbc_allocate _(( void ));
|
317
|
+
void pg_coder_init_encoder _(( VALUE ));
|
318
|
+
void pg_coder_init_decoder _(( VALUE ));
|
319
|
+
void pg_coder_compact _(( void * ));
|
320
|
+
char *pg_rb_str_ensure_capa _(( VALUE, long, char *, char ** ));
|
321
|
+
|
322
|
+
#define PG_RB_STR_ENSURE_CAPA( str, expand_len, curr_ptr, end_ptr ) \
|
323
|
+
do { \
|
324
|
+
if( (curr_ptr) + (expand_len) >= (end_ptr) ) \
|
325
|
+
(curr_ptr) = pg_rb_str_ensure_capa( (str), (expand_len), (curr_ptr), &(end_ptr) ); \
|
326
|
+
} while(0);
|
327
|
+
|
328
|
+
#define PG_RB_STR_NEW( str, curr_ptr, end_ptr ) ( \
|
329
|
+
(str) = rb_str_new( NULL, 0 ), \
|
330
|
+
(curr_ptr) = (end_ptr) = RSTRING_PTR(str) \
|
331
|
+
)
|
332
|
+
|
333
|
+
VALUE pg_typemap_fit_to_result _(( VALUE, VALUE ));
|
334
|
+
VALUE pg_typemap_fit_to_query _(( VALUE, VALUE ));
|
335
|
+
int pg_typemap_fit_to_copy_get _(( VALUE ));
|
336
|
+
VALUE pg_typemap_result_value _(( t_typemap *, VALUE, int, int ));
|
337
|
+
t_pg_coder *pg_typemap_typecast_query_param _(( t_typemap *, VALUE, int ));
|
338
|
+
VALUE pg_typemap_typecast_copy_get _(( t_typemap *, VALUE, int, int, int ));
|
339
|
+
void pg_typemap_mark _(( void * ));
|
340
|
+
size_t pg_typemap_memsize _(( const void * ));
|
341
|
+
void pg_typemap_compact _(( void * ));
|
342
|
+
|
343
|
+
PGconn *pg_get_pgconn _(( VALUE ));
|
344
|
+
t_pg_connection *pg_get_connection _(( VALUE ));
|
345
|
+
VALUE pgconn_block _(( int, VALUE *, VALUE ));
|
346
|
+
#ifdef __GNUC__
|
347
|
+
__attribute__((format(printf, 3, 4)))
|
348
|
+
#endif
|
349
|
+
NORETURN(void pg_raise_conn_error _(( VALUE klass, VALUE self, const char *format, ...)));
|
350
|
+
VALUE pg_wrap_socket_io _(( int sd, VALUE self, VALUE *p_socket_io, int *p_ruby_sd ));
|
351
|
+
void pg_unwrap_socket_io _(( VALUE self, VALUE *p_socket_io, int ruby_sd ));
|
352
|
+
|
353
|
+
|
354
|
+
VALUE pg_new_result _(( PGresult *, VALUE ));
|
355
|
+
VALUE pg_new_result_autoclear _(( PGresult *, VALUE ));
|
356
|
+
PGresult* pgresult_get _(( VALUE ));
|
357
|
+
VALUE pg_result_check _(( VALUE ));
|
358
|
+
VALUE pg_result_clear _(( VALUE ));
|
359
|
+
VALUE pg_tuple_new _(( VALUE, int ));
|
360
|
+
|
361
|
+
/*
|
362
|
+
* Fetch the data pointer for the result object
|
363
|
+
*/
|
364
|
+
static inline t_pg_result *
|
365
|
+
pgresult_get_this( VALUE self )
|
366
|
+
{
|
367
|
+
return RTYPEDDATA_DATA(self);
|
368
|
+
}
|
369
|
+
|
370
|
+
|
371
|
+
rb_encoding * pg_get_pg_encname_as_rb_encoding _(( const char * ));
|
372
|
+
const char * pg_get_rb_encoding_as_pg_encoding _(( rb_encoding * ));
|
373
|
+
rb_encoding *pg_conn_enc_get _(( PGconn * ));
|
374
|
+
|
375
|
+
void notice_receiver_proxy(void *arg, const PGresult *result);
|
376
|
+
void notice_processor_proxy(void *arg, const char *message);
|
377
|
+
|
378
|
+
/* reports if `-W' specified and PG_SKIP_DEPRECATION_WARNING environment variable isn't set
|
379
|
+
*
|
380
|
+
* message_id identifies the warning, so that it's reported only once.
|
381
|
+
*/
|
382
|
+
#define pg_deprecated(message_id, format_args) \
|
383
|
+
do { \
|
384
|
+
if( !(pg_skip_deprecation_warning & (1 << message_id)) ){ \
|
385
|
+
pg_skip_deprecation_warning |= 1 << message_id; \
|
386
|
+
rb_warning format_args; \
|
387
|
+
} \
|
388
|
+
} while(0);
|
389
|
+
|
390
|
+
#endif /* end __pg_h */
|