pg 0.21.0-x86-mingw32 → 1.0.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/ChangeLog +62 -82
- data/History.rdoc +28 -0
- data/Manifest.txt +0 -1
- data/README.rdoc +3 -4
- data/Rakefile +3 -4
- data/Rakefile.cross +16 -20
- data/ext/errorcodes.def +8 -0
- data/ext/errorcodes.txt +3 -1
- data/ext/extconf.rb +12 -32
- data/ext/gvl_wrappers.c +4 -0
- data/ext/gvl_wrappers.h +23 -39
- data/ext/pg.c +15 -48
- data/ext/pg.h +7 -77
- data/ext/pg_binary_decoder.c +1 -1
- data/ext/pg_binary_encoder.c +1 -1
- data/ext/pg_connection.c +91 -130
- data/ext/pg_result.c +5 -9
- data/ext/pg_text_decoder.c +1 -1
- data/ext/pg_text_encoder.c +1 -1
- data/ext/pg_type_map.c +1 -1
- data/ext/pg_type_map_all_strings.c +1 -1
- data/ext/pg_type_map_by_class.c +1 -1
- data/ext/pg_type_map_by_column.c +1 -1
- data/ext/pg_type_map_by_mri_type.c +1 -1
- data/ext/pg_type_map_by_oid.c +1 -1
- data/ext/pg_type_map_in_ruby.c +1 -1
- data/ext/util.c +1 -1
- data/lib/2.0/pg_ext.so +0 -0
- data/lib/2.1/pg_ext.so +0 -0
- data/lib/2.2/pg_ext.so +0 -0
- data/lib/2.3/pg_ext.so +0 -0
- data/lib/2.4/pg_ext.so +0 -0
- data/lib/2.5/pg_ext.so +0 -0
- data/lib/libpq.dll +0 -0
- data/lib/pg.rb +2 -6
- data/lib/pg/connection.rb +7 -2
- data/spec/helpers.rb +8 -12
- data/spec/pg/connection_spec.rb +228 -185
- data/spec/pg/result_spec.rb +3 -3
- data/spec/pg/type_spec.rb +1 -1
- data/spec/pg_spec.rb +1 -1
- metadata +36 -24
- metadata.gz.sig +0 -0
- data/lib/pg/deprecated_constants.rb +0 -21
data/ext/errorcodes.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# errcodes.txt
|
3
3
|
# PostgreSQL error codes
|
4
4
|
#
|
5
|
-
# Copyright (c) 2003-
|
5
|
+
# Copyright (c) 2003-2017, PostgreSQL Global Development Group
|
6
6
|
#
|
7
7
|
# This list serves as the basis for generating source files containing error
|
8
8
|
# codes. It is kept in a common format to make sure all these source files have
|
@@ -188,6 +188,7 @@ Section: Class 22 - Data Exception
|
|
188
188
|
22004 E ERRCODE_NULL_VALUE_NOT_ALLOWED null_value_not_allowed
|
189
189
|
22002 E ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER null_value_no_indicator_parameter
|
190
190
|
22003 E ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE numeric_value_out_of_range
|
191
|
+
2200H E ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED sequence_generator_limit_exceeded
|
191
192
|
22026 E ERRCODE_STRING_DATA_LENGTH_MISMATCH string_data_length_mismatch
|
192
193
|
22001 E ERRCODE_STRING_DATA_RIGHT_TRUNCATION string_data_right_truncation
|
193
194
|
22011 E ERRCODE_SUBSTRING_ERROR substring_error
|
@@ -326,6 +327,7 @@ Section: Class 42 - Syntax Error or Access Rule Violation
|
|
326
327
|
42P21 E ERRCODE_COLLATION_MISMATCH collation_mismatch
|
327
328
|
42P22 E ERRCODE_INDETERMINATE_COLLATION indeterminate_collation
|
328
329
|
42809 E ERRCODE_WRONG_OBJECT_TYPE wrong_object_type
|
330
|
+
428C9 E ERRCODE_GENERATED_ALWAYS generated_always
|
329
331
|
|
330
332
|
# Note: for ERRCODE purposes, we divide namable objects into these categories:
|
331
333
|
# databases, schemas, prepared statements, cursors, tables, columns,
|
data/ext/extconf.rb
CHANGED
@@ -60,48 +60,28 @@ abort "Can't find the PostgreSQL client library (libpq)" unless
|
|
60
60
|
have_library( 'libpq', 'PQconnectdb', ['libpq-fe.h'] ) ||
|
61
61
|
have_library( 'ms/libpq', 'PQconnectdb', ['libpq-fe.h'] )
|
62
62
|
|
63
|
+
if /mingw/ =~ RUBY_PLATFORM && RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
|
64
|
+
# Work around: https://sourceware.org/bugzilla/show_bug.cgi?id=22504
|
65
|
+
checking_for "workaround gcc version with link issue" do
|
66
|
+
`#{RbConfig::MAKEFILE_CONFIG['CC']} --version`.chomp =~ /\s(\d+)\.\d+\.\d+(\s|$)/ &&
|
67
|
+
$1.to_i >= 6 &&
|
68
|
+
have_library(':libpq.lib') # Prefer linking to libpq.lib over libpq.dll if available
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
63
72
|
# optional headers/functions
|
64
|
-
have_func '
|
73
|
+
have_func 'PQsetSingleRowMode' or
|
65
74
|
abort "Your PostgreSQL is too old. Either install an older version " +
|
66
|
-
"of this gem or upgrade your database."
|
67
|
-
have_func 'PQisthreadsafe'
|
68
|
-
have_func 'PQprepare'
|
69
|
-
have_func 'PQexecParams'
|
70
|
-
have_func 'PQescapeString'
|
71
|
-
have_func 'PQescapeStringConn'
|
72
|
-
have_func 'PQescapeLiteral'
|
73
|
-
have_func 'PQescapeIdentifier'
|
74
|
-
have_func 'PQgetCancel'
|
75
|
-
have_func 'lo_create'
|
76
|
-
have_func 'pg_encoding_to_char'
|
77
|
-
have_func 'pg_char_to_encoding'
|
78
|
-
have_func 'PQsetClientEncoding'
|
79
|
-
have_func 'PQlibVersion'
|
80
|
-
have_func 'PQping'
|
81
|
-
have_func 'PQsetSingleRowMode'
|
75
|
+
"of this gem or upgrade your database to at least PostgreSQL-9.2."
|
82
76
|
have_func 'PQconninfo'
|
83
77
|
have_func 'PQsslAttribute'
|
78
|
+
have_func 'PQencryptPasswordConn'
|
84
79
|
|
85
|
-
have_func 'rb_encdb_alias'
|
86
|
-
have_func 'rb_enc_alias'
|
87
|
-
have_func 'rb_thread_call_without_gvl'
|
88
|
-
have_func 'rb_thread_call_with_gvl'
|
89
|
-
have_func 'rb_thread_fd_select'
|
90
|
-
have_func 'rb_w32_wrap_io_handle'
|
91
|
-
have_func 'rb_str_modify_expand'
|
92
|
-
have_func 'rb_hash_dup'
|
93
|
-
|
94
|
-
have_const 'PGRES_COPY_BOTH', 'libpq-fe.h'
|
95
|
-
have_const 'PGRES_SINGLE_TUPLE', 'libpq-fe.h'
|
96
80
|
have_const 'PG_DIAG_TABLE_NAME', 'libpq-fe.h'
|
97
81
|
|
98
|
-
$defs.push( "-DHAVE_ST_NOTIFY_EXTRA" ) if
|
99
|
-
have_struct_member 'struct pgNotify', 'extra', 'libpq-fe.h'
|
100
|
-
|
101
82
|
# unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
|
102
83
|
have_header 'unistd.h'
|
103
84
|
have_header 'inttypes.h'
|
104
|
-
have_header 'ruby/st.h' or have_header 'st.h' or abort "pg currently requires the ruby/st.h header"
|
105
85
|
|
106
86
|
checking_for "C99 variable length arrays" do
|
107
87
|
$defs.push( "-DHAVE_VARIABLE_LENGTH_ARRAYS" ) if try_compile('void test_vla(int l){ int vla[l]; }')
|
data/ext/gvl_wrappers.c
CHANGED
@@ -5,6 +5,10 @@
|
|
5
5
|
|
6
6
|
#include "pg.h"
|
7
7
|
|
8
|
+
#ifndef HAVE_PQENCRYPTPASSWORDCONN
|
9
|
+
char *PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm){return NULL;}
|
10
|
+
#endif
|
11
|
+
|
8
12
|
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_WRAPPER_STRUCT );
|
9
13
|
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_SKELETON );
|
10
14
|
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_STUB );
|
data/ext/gvl_wrappers.h
CHANGED
@@ -15,14 +15,7 @@
|
|
15
15
|
#ifndef __gvl_wrappers_h
|
16
16
|
#define __gvl_wrappers_h
|
17
17
|
|
18
|
-
#
|
19
|
-
extern void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
|
20
|
-
#endif
|
21
|
-
|
22
|
-
#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
|
23
|
-
extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1,
|
24
|
-
rb_unblock_function_t *ubf, void *data2);
|
25
|
-
#endif
|
18
|
+
#include <ruby/thread.h>
|
26
19
|
|
27
20
|
#define DEFINE_PARAM_LIST1(type, name) \
|
28
21
|
name,
|
@@ -53,21 +46,14 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1,
|
|
53
46
|
return NULL; \
|
54
47
|
}
|
55
48
|
|
56
|
-
#
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
}
|
65
|
-
#else
|
66
|
-
#define DEFINE_GVL_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
67
|
-
rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
|
68
|
-
return name( FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname ); \
|
69
|
-
}
|
70
|
-
#endif
|
49
|
+
#define DEFINE_GVL_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
50
|
+
rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
|
51
|
+
struct gvl_wrapper_##name##_params params = { \
|
52
|
+
{FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname}, when_non_void((rettype)0) \
|
53
|
+
}; \
|
54
|
+
rb_thread_call_without_gvl(gvl_##name##_skeleton, ¶ms, RUBY_UBF_IO, 0); \
|
55
|
+
when_non_void( return params.retval; ) \
|
56
|
+
}
|
71
57
|
|
72
58
|
#define DEFINE_GVL_STUB_DECL(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
73
59
|
rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname);
|
@@ -80,21 +66,14 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1,
|
|
80
66
|
return NULL; \
|
81
67
|
}
|
82
68
|
|
83
|
-
#
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
}
|
92
|
-
#else
|
93
|
-
#define DEFINE_GVLCB_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
94
|
-
rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
|
95
|
-
return name( FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname ); \
|
96
|
-
}
|
97
|
-
#endif
|
69
|
+
#define DEFINE_GVLCB_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
|
70
|
+
rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
|
71
|
+
struct gvl_wrapper_##name##_params params = { \
|
72
|
+
{FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname}, when_non_void((rettype)0) \
|
73
|
+
}; \
|
74
|
+
rb_thread_call_with_gvl(gvl_##name##_skeleton, ¶ms); \
|
75
|
+
when_non_void( return params.retval; ) \
|
76
|
+
}
|
98
77
|
|
99
78
|
#define GVL_TYPE_VOID(string)
|
100
79
|
#define GVL_TYPE_NONVOID(string) string
|
@@ -200,6 +179,11 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1,
|
|
200
179
|
|
201
180
|
#define FOR_EACH_PARAM_OF_PQisBusy(param)
|
202
181
|
|
182
|
+
#define FOR_EACH_PARAM_OF_PQencryptPasswordConn(param) \
|
183
|
+
param(PGconn *, conn) \
|
184
|
+
param(const char *, passwd) \
|
185
|
+
param(const char *, user)
|
186
|
+
|
203
187
|
#define FOR_EACH_PARAM_OF_PQcancel(param) \
|
204
188
|
param(PGcancel *, cancel) \
|
205
189
|
param(char *, errbuf)
|
@@ -231,9 +215,9 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1,
|
|
231
215
|
function(PQsendDescribePortal, GVL_TYPE_NONVOID, int, const char *, portal) \
|
232
216
|
function(PQsetClientEncoding, GVL_TYPE_NONVOID, int, const char *, encoding) \
|
233
217
|
function(PQisBusy, GVL_TYPE_NONVOID, int, PGconn *, conn) \
|
218
|
+
function(PQencryptPasswordConn, GVL_TYPE_NONVOID, char *, const char *, algorithm) \
|
234
219
|
function(PQcancel, GVL_TYPE_NONVOID, int, int, errbufsize);
|
235
220
|
|
236
|
-
|
237
221
|
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_STUB_DECL );
|
238
222
|
|
239
223
|
|
data/ext/pg.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* pg.c - Toplevel extension
|
3
|
-
* $Id$
|
3
|
+
* $Id: pg.c,v 1f0926bfa9a5 2018/01/04 18:14:32 lars $
|
4
4
|
*
|
5
5
|
* Author/s:
|
6
6
|
*
|
@@ -69,7 +69,6 @@ VALUE rb_mPGconstants;
|
|
69
69
|
* M17n functions
|
70
70
|
*/
|
71
71
|
|
72
|
-
#ifdef M17N_SUPPORTED
|
73
72
|
/**
|
74
73
|
* The mapping from canonical encoding names in PostgreSQL to ones in Ruby.
|
75
74
|
*/
|
@@ -144,7 +143,7 @@ pg_find_or_create_johab(void)
|
|
144
143
|
|
145
144
|
enc_index = rb_define_dummy_encoding(aliases[0]);
|
146
145
|
for (i = 1; i < sizeof(aliases)/sizeof(aliases[0]); ++i) {
|
147
|
-
|
146
|
+
rb_encdb_alias(aliases[i], aliases[0]);
|
148
147
|
}
|
149
148
|
return rb_enc_from_index(enc_index);
|
150
149
|
}
|
@@ -229,8 +228,6 @@ pg_get_rb_encoding_as_pg_encoding( rb_encoding *enc )
|
|
229
228
|
return encname;
|
230
229
|
}
|
231
230
|
|
232
|
-
#endif /* M17N_SUPPORTED */
|
233
|
-
|
234
231
|
|
235
232
|
/*
|
236
233
|
* Ensures that the given string has enough capacity to take expand_len
|
@@ -260,45 +257,26 @@ pg_get_rb_encoding_as_pg_encoding( rb_encoding *enc )
|
|
260
257
|
* rb_str_set_len( string, current_out - RSTRING_PTR(string) );
|
261
258
|
*
|
262
259
|
*/
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
rb_str_modify_expand( str, (curr_len + expand_len) * 2 - curr_capa );
|
273
|
-
curr_ptr = RSTRING_PTR(str) + curr_len;
|
274
|
-
}
|
275
|
-
if( end_ptr )
|
276
|
-
*end_ptr = RSTRING_PTR(str) + rb_str_capacity( str );
|
277
|
-
return curr_ptr;
|
278
|
-
}
|
279
|
-
#else
|
280
|
-
/* Use the more portable version */
|
281
|
-
char *
|
282
|
-
pg_rb_str_ensure_capa( VALUE str, long expand_len, char *curr_ptr, char **end_ptr )
|
283
|
-
{
|
284
|
-
long curr_len = curr_ptr - RSTRING_PTR(str);
|
285
|
-
long curr_capa = RSTRING_LEN( str );
|
286
|
-
if( curr_capa < curr_len + expand_len ){
|
287
|
-
rb_str_resize( str, (curr_len + expand_len) * 2 - curr_capa );
|
288
|
-
curr_ptr = RSTRING_PTR(str) + curr_len;
|
289
|
-
}
|
290
|
-
if( end_ptr )
|
291
|
-
*end_ptr = RSTRING_PTR(str) + RSTRING_LEN(str);
|
292
|
-
return curr_ptr;
|
260
|
+
char *
|
261
|
+
pg_rb_str_ensure_capa( VALUE str, long expand_len, char *curr_ptr, char **end_ptr )
|
262
|
+
{
|
263
|
+
long curr_len = curr_ptr - RSTRING_PTR(str);
|
264
|
+
long curr_capa = rb_str_capacity( str );
|
265
|
+
if( curr_capa < curr_len + expand_len ){
|
266
|
+
rb_str_set_len( str, curr_len );
|
267
|
+
rb_str_modify_expand( str, (curr_len + expand_len) * 2 - curr_capa );
|
268
|
+
curr_ptr = RSTRING_PTR(str) + curr_len;
|
293
269
|
}
|
294
|
-
|
270
|
+
if( end_ptr )
|
271
|
+
*end_ptr = RSTRING_PTR(str) + rb_str_capacity( str );
|
272
|
+
return curr_ptr;
|
273
|
+
}
|
295
274
|
|
296
275
|
|
297
276
|
/**************************************************************************
|
298
277
|
* Module Methods
|
299
278
|
**************************************************************************/
|
300
279
|
|
301
|
-
#ifdef HAVE_PQLIBVERSION
|
302
280
|
/*
|
303
281
|
* call-seq:
|
304
282
|
* PG.library_version -> Integer
|
@@ -316,7 +294,6 @@ pg_s_library_version(VALUE self)
|
|
316
294
|
UNUSED( self );
|
317
295
|
return INT2NUM(PQlibVersion());
|
318
296
|
}
|
319
|
-
#endif
|
320
297
|
|
321
298
|
|
322
299
|
/*
|
@@ -410,9 +387,7 @@ Init_pg_ext()
|
|
410
387
|
/*************************
|
411
388
|
* PG module methods
|
412
389
|
*************************/
|
413
|
-
#ifdef HAVE_PQLIBVERSION
|
414
390
|
rb_define_singleton_method( rb_mPG, "library_version", pg_s_library_version, 0 );
|
415
|
-
#endif
|
416
391
|
rb_define_singleton_method( rb_mPG, "isthreadsafe", pg_s_threadsafe_p, 0 );
|
417
392
|
SINGLETON_ALIAS( rb_mPG, "is_threadsafe?", "isthreadsafe" );
|
418
393
|
SINGLETON_ALIAS( rb_mPG, "threadsafe?", "isthreadsafe" );
|
@@ -478,7 +453,6 @@ Init_pg_ext()
|
|
478
453
|
/* Verbose error verbosity level (#set_error_verbosity) */
|
479
454
|
rb_define_const(rb_mPGconstants, "PQERRORS_VERBOSE", INT2FIX(PQERRORS_VERBOSE));
|
480
455
|
|
481
|
-
#ifdef HAVE_PQPING
|
482
456
|
/****** PG::Connection CLASS CONSTANTS: Check Server Status ******/
|
483
457
|
|
484
458
|
/* Server is accepting connections. */
|
@@ -489,7 +463,6 @@ Init_pg_ext()
|
|
489
463
|
rb_define_const(rb_mPGconstants, "PQPING_NO_RESPONSE", INT2FIX(PQPING_NO_RESPONSE));
|
490
464
|
/* Connection not attempted (bad params). */
|
491
465
|
rb_define_const(rb_mPGconstants, "PQPING_NO_ATTEMPT", INT2FIX(PQPING_NO_ATTEMPT));
|
492
|
-
#endif
|
493
466
|
|
494
467
|
/****** PG::Connection CLASS CONSTANTS: Large Objects ******/
|
495
468
|
|
@@ -524,13 +497,9 @@ Init_pg_ext()
|
|
524
497
|
/* #result_status constant: A fatal error occurred. */
|
525
498
|
rb_define_const(rb_mPGconstants, "PGRES_FATAL_ERROR", INT2FIX(PGRES_FATAL_ERROR));
|
526
499
|
/* #result_status constant: Copy In/Out data transfer in progress. */
|
527
|
-
#ifdef HAVE_CONST_PGRES_COPY_BOTH
|
528
500
|
rb_define_const(rb_mPGconstants, "PGRES_COPY_BOTH", INT2FIX(PGRES_COPY_BOTH));
|
529
|
-
#endif
|
530
501
|
/* #result_status constant: Single tuple from larger resultset. */
|
531
|
-
#ifdef HAVE_CONST_PGRES_SINGLE_TUPLE
|
532
502
|
rb_define_const(rb_mPGconstants, "PGRES_SINGLE_TUPLE", INT2FIX(PGRES_SINGLE_TUPLE));
|
533
|
-
#endif
|
534
503
|
|
535
504
|
/****** Result CONSTANTS: result error field codes ******/
|
536
505
|
|
@@ -642,9 +611,7 @@ Init_pg_ext()
|
|
642
611
|
/* Add the constants to the toplevel namespace */
|
643
612
|
rb_include_module( rb_mPG, rb_mPGconstants );
|
644
613
|
|
645
|
-
#ifdef M17N_SUPPORTED
|
646
614
|
enc_pg2ruby = st_init_numtable();
|
647
|
-
#endif
|
648
615
|
|
649
616
|
/* Initialize the main extension classes */
|
650
617
|
init_pg_connection();
|
data/ext/pg.h
CHANGED
@@ -18,89 +18,21 @@
|
|
18
18
|
|
19
19
|
/* Ruby headers */
|
20
20
|
#include "ruby.h"
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#elif HAVE_ST_H
|
24
|
-
# include "st.h"
|
25
|
-
#endif
|
21
|
+
#include "ruby/st.h"
|
22
|
+
#include "ruby/encoding.h"
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
#
|
31
|
-
extern int rb_encdb_alias(const char *, const char *);
|
32
|
-
# define ENC_ALIAS(name, orig) rb_encdb_alias((name), (orig))
|
33
|
-
# elif HAVE_RB_ENC_ALIAS
|
34
|
-
extern int rb_enc_alias(const char *, const char *);
|
35
|
-
# define ENC_ALIAS(name, orig) rb_enc_alias((name), (orig))
|
36
|
-
# else
|
37
|
-
extern int rb_enc_alias(const char *alias, const char *orig); /* declaration missing in Ruby 1.9.1 */
|
38
|
-
# define ENC_ALIAS(name, orig) rb_enc_alias((name), (orig))
|
39
|
-
# endif
|
40
|
-
|
41
|
-
|
42
|
-
# if !defined(ENCODING_SET_INLINED)
|
43
|
-
/* Rubinius doesn't define ENCODING_SET_INLINED, so we fall back to the more
|
44
|
-
* portable version.
|
45
|
-
*/
|
46
|
-
# define PG_ENCODING_SET_NOCHECK(obj,i) \
|
47
|
-
do { \
|
48
|
-
rb_enc_set_index((obj), (i)); \
|
49
|
-
} while(0)
|
50
|
-
# else
|
51
|
-
# define PG_ENCODING_SET_NOCHECK(obj,i) \
|
24
|
+
/* exported by ruby-1.9.3+ but not declared */
|
25
|
+
extern int rb_encdb_alias(const char *, const char *);
|
26
|
+
|
27
|
+
#define PG_ENCODING_SET_NOCHECK(obj,i) \
|
52
28
|
do { \
|
53
29
|
if ((i) < ENCODING_INLINE_MAX) \
|
54
30
|
ENCODING_SET_INLINED((obj), (i)); \
|
55
31
|
else \
|
56
32
|
rb_enc_set_index((obj), (i)); \
|
57
33
|
} while(0)
|
58
|
-
# endif
|
59
|
-
|
60
|
-
#else
|
61
|
-
# define PG_ENCODING_SET_NOCHECK(obj,i) /* nothing */
|
62
|
-
#endif
|
63
|
-
|
64
|
-
#if RUBY_VM != 1
|
65
|
-
# define RUBY_18_COMPAT
|
66
|
-
#endif
|
67
|
-
|
68
|
-
#ifndef RARRAY_LEN
|
69
|
-
# define RARRAY_LEN(x) RARRAY((x))->len
|
70
|
-
#endif /* RARRAY_LEN */
|
71
34
|
|
72
|
-
#
|
73
|
-
# define RSTRING_LEN(x) RSTRING((x))->len
|
74
|
-
#endif /* RSTRING_LEN */
|
75
|
-
|
76
|
-
#ifndef RSTRING_PTR
|
77
|
-
# define RSTRING_PTR(x) RSTRING((x))->ptr
|
78
|
-
#endif /* RSTRING_PTR */
|
79
|
-
|
80
|
-
#ifndef StringValuePtr
|
81
|
-
# define StringValuePtr(x) STR2CSTR(x)
|
82
|
-
#endif /* StringValuePtr */
|
83
|
-
|
84
|
-
#ifdef RUBY_18_COMPAT
|
85
|
-
# define rb_io_stdio_file GetWriteFile
|
86
|
-
# include "rubyio.h"
|
87
|
-
#else
|
88
|
-
# include "ruby/io.h"
|
89
|
-
#endif
|
90
|
-
|
91
|
-
#ifdef RUBINIUS
|
92
|
-
/* Workaround for wrong FIXNUM_MAX definition */
|
93
|
-
typedef intptr_t native_int;
|
94
|
-
#endif
|
95
|
-
|
96
|
-
#ifndef RETURN_SIZED_ENUMERATOR
|
97
|
-
#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) RETURN_ENUMERATOR((obj), (argc), (argv))
|
98
|
-
#endif
|
99
|
-
|
100
|
-
#ifndef HAVE_RB_HASH_DUP
|
101
|
-
/* Rubinius doesn't define rb_hash_dup() */
|
102
|
-
#define rb_hash_dup(tuple) rb_funcall((tuple), rb_intern("dup"), 0)
|
103
|
-
#endif
|
35
|
+
#include "ruby/io.h"
|
104
36
|
|
105
37
|
#ifndef timeradd
|
106
38
|
#define timeradd(a, b, result) \
|
@@ -382,12 +314,10 @@ pgresult_get_this( VALUE self )
|
|
382
314
|
}
|
383
315
|
|
384
316
|
|
385
|
-
#ifdef M17N_SUPPORTED
|
386
317
|
rb_encoding * pg_get_pg_encoding_as_rb_encoding _(( int ));
|
387
318
|
rb_encoding * pg_get_pg_encname_as_rb_encoding _(( const char * ));
|
388
319
|
const char * pg_get_rb_encoding_as_pg_encoding _(( rb_encoding * ));
|
389
320
|
rb_encoding *pg_conn_enc_get _(( PGconn * ));
|
390
|
-
#endif /* M17N_SUPPORTED */
|
391
321
|
|
392
322
|
void notice_receiver_proxy(void *arg, const PGresult *result);
|
393
323
|
void notice_processor_proxy(void *arg, const char *message);
|