pg 0.18.1 → 0.18.2
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/ChangeLog +169 -2
- data/History.rdoc +16 -0
- data/README.rdoc +1 -1
- data/ext/extconf.rb +4 -1
- data/ext/pg.c +3 -3
- data/ext/pg.h +10 -0
- data/ext/pg_connection.c +12 -40
- data/ext/pg_result.c +4 -4
- data/ext/pg_text_decoder.c +7 -10
- data/ext/pg_text_encoder.c +37 -40
- data/ext/pg_type_map_by_mri_type.c +2 -2
- data/ext/pg_type_map_in_ruby.c +4 -7
- data/ext/util.c +2 -2
- data/ext/util.h +1 -1
- data/lib/pg.rb +2 -2
- data/lib/pg/connection.rb +37 -27
- data/lib/pg/text_decoder.rb +2 -2
- data/spec/pg/connection_spec.rb +82 -6
- data/spec/pg/type_spec.rb +53 -30
- metadata +32 -32
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8807e5610f416a9fe9a4bcc597986c25a5c35b9
|
4
|
+
data.tar.gz: a98032311306661db24f48a69d847a1896a277fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 882d2bda71c4946f3a0b72ffb8a8e31528411019dd531d472537c310f2e79c36e4bccd17280d359cf31f00e07b613b818ffb3e1f1d3df3c4a0d599c05d0d400e
|
7
|
+
data.tar.gz: 76e9118ba0e1f7e0577c1f86d5bb0c0a509000df3b8bf0fd4b1e169e34050f3849267e41066c4cd3e2f1d4d221e4a089a5466bc131debfafb675ff22c87525e2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/ChangeLog
CHANGED
@@ -1,9 +1,176 @@
|
|
1
|
+
2015-05-14 Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
* .rvmrc:
|
4
|
+
Bump default rvm Ruby to 2.2
|
5
|
+
[128b075d5800] [tip]
|
6
|
+
|
7
|
+
2015-03-13 Lars Kanis <lars@greiz-reinsdorf.de>
|
8
|
+
|
9
|
+
* ext/pg_text_encoder.c, ext/util.c, ext/util.h:
|
10
|
+
Avoid possible symbol name clash when linking againt static libpq.
|
11
|
+
|
12
|
+
This should fix issue #209 .
|
13
|
+
[b859963462b2]
|
14
|
+
|
15
|
+
2015-02-11 Lars Kanis <lars@greiz-reinsdorf.de>
|
16
|
+
|
17
|
+
* ext/pg.c, spec/pg/connection_spec.rb:
|
18
|
+
Merge from git branch.
|
19
|
+
[b60c89ee93c8]
|
20
|
+
|
21
|
+
* ext/pg.h, ext/pg_text_decoder.c:
|
22
|
+
Merge branch 'non-c99-compiler'
|
23
|
+
[b111c84b8445]
|
24
|
+
|
25
|
+
2015-02-06 Lars Kanis <lars@greiz-reinsdorf.de>
|
26
|
+
|
27
|
+
* ext/extconf.rb, ext/pg.h, ext/pg_result.c, ext/pg_text_decoder.c,
|
28
|
+
ext/pg_type_map_by_mri_type.c:
|
29
|
+
Use fixed size arrays in case the compiler doesn't support C99
|
30
|
+
variable length arrays.
|
31
|
+
|
32
|
+
This is notably the MSVC compiler.
|
33
|
+
|
34
|
+
Note: The MSVC build environment is currently not tested on a
|
35
|
+
regular base, so is not fully supported.
|
36
|
+
[1269b8ad77b8]
|
37
|
+
|
38
|
+
2015-02-11 Lars Kanis <lars@greiz-reinsdorf.de>
|
39
|
+
|
40
|
+
* ext/pg_connection.c:
|
41
|
+
Replace quote_ident implementation with that of
|
42
|
+
PG::TextEncoder::Identifier .
|
43
|
+
|
44
|
+
This allowes quoation of array of strings in addition to plain
|
45
|
+
strings and removes duplicated code.
|
46
|
+
|
47
|
+
It also removes the 63 byte limitation and therefore obsolets pull
|
48
|
+
request #21 https://bitbucket.org/ged/ruby-pg/pull-request/21
|
49
|
+
[714601d05fba]
|
50
|
+
|
51
|
+
* ext/pg.c, ext/pg.h, ext/pg_text_decoder.c, ext/pg_text_encoder.c,
|
52
|
+
spec/pg/connection_spec.rb, spec/pg/type_spec.rb:
|
53
|
+
Derive PG::TextDecoder::Identifier from PG::SimpleDecoder instead of
|
54
|
+
CompositeDecoder
|
55
|
+
|
56
|
+
.. and equally for Encoder.
|
57
|
+
|
58
|
+
Identifiers are strings, so there is no good reason to compose it
|
59
|
+
from other element types. This change allows a faster quoting
|
60
|
+
implementation.
|
61
|
+
[df67241d1a4f]
|
62
|
+
|
63
|
+
2015-02-03 Michael Granger <ged@FaerieMUD.org>
|
64
|
+
|
65
|
+
* README.rdoc, ext/pg.c:
|
66
|
+
Update copyright notices
|
67
|
+
[447962e0dcba] [github/master]
|
68
|
+
|
69
|
+
* spec/pg/connection_spec.rb:
|
70
|
+
Whitespace fixes
|
71
|
+
[f4a85f78807d]
|
72
|
+
|
73
|
+
2014-08-22 Chris Bandy <bandy.chris@gmail.com>
|
74
|
+
|
75
|
+
* lib/pg/connection.rb, spec/pg/connection_spec.rb:
|
76
|
+
Allow URI connection string
|
77
|
+
|
78
|
+
(Imported from https://github.com/ged/ruby-pg/pull/3)
|
79
|
+
[d4579ef9eae4]
|
80
|
+
|
81
|
+
2015-01-27 Lars Kanis <lars@greiz-reinsdorf.de>
|
82
|
+
|
83
|
+
* lib/pg/text_decoder.rb, spec/pg/type_spec.rb:
|
84
|
+
Fix decoding of fractional timezones like "-00:25:21".
|
85
|
+
[766aa353b392]
|
86
|
+
|
87
|
+
2015-01-27 Lars Kanis <kanis@comcard.de>
|
88
|
+
|
89
|
+
* History.rdoc, lib/pg/text_decoder.rb, spec/pg/type_spec.rb:
|
90
|
+
Fix decoding of fractional timezones like "04:30".
|
91
|
+
|
92
|
+
This fixes https://bitbucket.org/ged/ruby-pg/issue/203 .
|
93
|
+
[33225805259c]
|
94
|
+
|
95
|
+
2015-01-16 Lars Kanis <kanis@comcard.de>
|
96
|
+
|
97
|
+
* History.rdoc, ext/extconf.rb, ext/pg_connection.c,
|
98
|
+
spec/pg/connection_spec.rb:
|
99
|
+
Revert "Add PG::Connection#hostaddr. This is new in PostgreSQL-9.4."
|
100
|
+
|
101
|
+
PQhostaddr was removed from final PostgreSQL-9.4.0.
|
102
|
+
|
103
|
+
This fixes issue #202 :https://bitbucket.org/ged/ruby-pg/issue/202
|
104
|
+
|
105
|
+
This reverts commit 03deab7aa63f9a00984014ce59617d552b4eac34.
|
106
|
+
[b51d736bca77]
|
107
|
+
|
108
|
+
* History.rdoc:
|
109
|
+
Add a missing enhancement for pg-0.18.0
|
110
|
+
[a7635c3425f3]
|
111
|
+
|
112
|
+
* .travis.yml:
|
113
|
+
Update ruby and postgresql versions for travic-ci
|
114
|
+
[b67b92f7db97]
|
115
|
+
|
116
|
+
2015-01-06 Lars Kanis <kanis@comcard.de>
|
117
|
+
|
118
|
+
* Merge from git.
|
119
|
+
[625e9359ac47]
|
120
|
+
|
121
|
+
2015-01-05 Lars Kanis <kanis@comcard.de>
|
122
|
+
|
123
|
+
* ext/pg_type_map_in_ruby.c:
|
124
|
+
Use a simpler fix for https://bitbucket.org/ged/ruby-
|
125
|
+
pg/commits/a38cf53a96f
|
126
|
+
[3d89d3aae4fd]
|
127
|
+
|
128
|
+
2015-01-05 Michael Granger <ged@FaerieMUD.org>
|
129
|
+
|
130
|
+
* .hgtags:
|
131
|
+
Added tag v0.18.1 for changeset f97dd6cb4f34
|
132
|
+
[f8122014065a]
|
133
|
+
|
134
|
+
* .hgsigs:
|
135
|
+
Added signature for changeset ba5aff64b5cb
|
136
|
+
[f97dd6cb4f34] [v0.18.1]
|
137
|
+
|
138
|
+
* History.rdoc, lib/pg.rb:
|
139
|
+
Bump the patch version, update history
|
140
|
+
[ba5aff64b5cb]
|
141
|
+
|
142
|
+
* Rakefile:
|
143
|
+
Fix the minimum Ruby version (closes #199)
|
144
|
+
[69422cc8dc45]
|
145
|
+
|
146
|
+
2015-01-03 Michael Granger <ged@FaerieMUD.org>
|
147
|
+
|
148
|
+
* .hgtags:
|
149
|
+
Added tag v0.18.0 for changeset cfb2bfc0f661
|
150
|
+
[8aff3973f2d2]
|
151
|
+
|
152
|
+
* .hgsigs:
|
153
|
+
Added signature for changeset c519766e3ec9
|
154
|
+
[cfb2bfc0f661] [v0.18.0]
|
155
|
+
|
156
|
+
* History.rdoc:
|
157
|
+
Update the History
|
158
|
+
[c519766e3ec9]
|
159
|
+
|
160
|
+
* Manifest.txt:
|
161
|
+
Keep the manifest sorted so it can be diffed.
|
162
|
+
[d7cdbfd1b516]
|
163
|
+
|
164
|
+
* Rakefile:
|
165
|
+
Add a Rake task for generating the gemspec
|
166
|
+
[ec6d6ce61a15]
|
167
|
+
|
1
168
|
2014-12-26 Lars Kanis <lars@greiz-reinsdorf.de>
|
2
169
|
|
3
170
|
* lib/pg/basic_type_mapping.rb:
|
4
171
|
Add a warning about Type OIDs without decoder in
|
5
172
|
PG::BasicTypeMapForResults.
|
6
|
-
[592e29cdf2e9]
|
173
|
+
[592e29cdf2e9]
|
7
174
|
|
8
175
|
2014-12-13 Lars Kanis <lars@greiz-reinsdorf.de>
|
9
176
|
|
@@ -285,7 +452,7 @@
|
|
285
452
|
|
286
453
|
* ext/pg_text_encoder.c, spec/pg/type_spec.rb:
|
287
454
|
Allow non Array values as input for TextEncoder::Array.
|
288
|
-
[a4725dfca9e4]
|
455
|
+
[a4725dfca9e4]
|
289
456
|
|
290
457
|
* ext/pg_coder.c, spec/pg/type_spec.rb:
|
291
458
|
Clarify handling of nil/NULL values by PG::Coders.
|
data/History.rdoc
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
== v0.18.2 [2015-05-14] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
Enhancements:
|
4
|
+
|
5
|
+
- Allow URI connection string (thanks to Chris Bandy)
|
6
|
+
|
7
|
+
Bugfixes:
|
8
|
+
|
9
|
+
- Speedups and fixes for PG::TextDecoder::Identifier and quoting behavior
|
10
|
+
- Revert addition of PG::Connection#hostaddr [#202].
|
11
|
+
- Fix decoding of fractional timezones and timestamps [#203]
|
12
|
+
- Fixes for non-C99 compilers
|
13
|
+
- Avoid possible symbol name clash when linking againt static libpq.
|
14
|
+
|
15
|
+
|
1
16
|
== v0.18.1 [2015-01-05] Michael Granger <ged@FaerieMUD.org>
|
2
17
|
|
3
18
|
Correct the minimum compatible Ruby version to 1.9.3. #199
|
@@ -19,6 +34,7 @@ Enhancements:
|
|
19
34
|
- Add Enumerator variant to PG::Result#each and #each_row.
|
20
35
|
- Add PG::Connection#conninfo and #hostaddr.
|
21
36
|
- Add PG.init_openssl and PG.init_ssl methods.
|
37
|
+
- Add PG::Result.inspect
|
22
38
|
- Force zero termination for all text strings that are given to libpq.
|
23
39
|
It raises an ArgumentError if the string contains a null byte.
|
24
40
|
- Update Windows cross build to PostgreSQL 9.3.
|
data/README.rdoc
CHANGED
data/ext/extconf.rb
CHANGED
@@ -73,7 +73,6 @@ have_func 'PQlibVersion'
|
|
73
73
|
have_func 'PQping'
|
74
74
|
have_func 'PQsetSingleRowMode'
|
75
75
|
have_func 'PQconninfo'
|
76
|
-
have_func 'PQhostaddr'
|
77
76
|
|
78
77
|
have_func 'rb_encdb_alias'
|
79
78
|
have_func 'rb_enc_alias'
|
@@ -95,6 +94,10 @@ $defs.push( "-DHAVE_ST_NOTIFY_EXTRA" ) if
|
|
95
94
|
have_header 'unistd.h'
|
96
95
|
have_header 'ruby/st.h' or have_header 'st.h' or abort "pg currently requires the ruby/st.h header"
|
97
96
|
|
97
|
+
checking_for "C99 variable length arrays" do
|
98
|
+
$defs.push( "-DHAVE_VARIABLE_LENGTH_ARRAYS" ) if try_compile('void test_vla(int l){ int vla[l]; }')
|
99
|
+
end
|
100
|
+
|
98
101
|
create_header()
|
99
102
|
create_makefile( "pg_ext" )
|
100
103
|
|
data/ext/pg.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* pg.c - Toplevel extension
|
3
|
-
* $Id: pg.c,v
|
3
|
+
* $Id: pg.c,v b60c89ee93c8 2015/02/11 20:59:36 lars $
|
4
4
|
*
|
5
5
|
* Author/s:
|
6
6
|
*
|
@@ -15,7 +15,7 @@
|
|
15
15
|
* See Contributors.rdoc for the many additional fine people that have contributed
|
16
16
|
* to this library over the years.
|
17
17
|
*
|
18
|
-
* Copyright (c) 1997-
|
18
|
+
* Copyright (c) 1997-2015 by the authors.
|
19
19
|
*
|
20
20
|
* You may redistribute this software under the same terms as Ruby itself; see
|
21
21
|
* http://www.ruby-lang.org/en/LICENSE.txt or the LICENSE file in the source
|
@@ -252,7 +252,7 @@ pg_get_rb_encoding_as_pg_encoding( rb_encoding *enc )
|
|
252
252
|
* char *current_out, *end_capa;
|
253
253
|
* PG_RB_STR_NEW( string, current_out, end_capa );
|
254
254
|
* while( data_is_going_to_be_processed ){
|
255
|
-
* PG_RB_STR_ENSURE_CAPA( string, 2 current_out, end_capa );
|
255
|
+
* PG_RB_STR_ENSURE_CAPA( string, 2, current_out, end_capa );
|
256
256
|
* *current_out++ = databyte1;
|
257
257
|
* *current_out++ = databyte2;
|
258
258
|
* }
|
data/ext/pg.h
CHANGED
@@ -133,6 +133,15 @@
|
|
133
133
|
typedef long suseconds_t;
|
134
134
|
#endif
|
135
135
|
|
136
|
+
#if defined(HAVE_VARIABLE_LENGTH_ARRAYS)
|
137
|
+
#define PG_VARIABLE_LENGTH_ARRAY(type, name, len, maxlen) type name[(len)];
|
138
|
+
#else
|
139
|
+
#define PG_VARIABLE_LENGTH_ARRAY(type, name, len, maxlen) \
|
140
|
+
type name[(maxlen)] = {(len)>(maxlen) ? (rb_raise(rb_eArgError, "Number of " #name " (%d) exceeds allowed maximum of " #maxlen, (len) ), (type)1) : (type)0};
|
141
|
+
|
142
|
+
#define PG_MAX_COLUMNS 4000
|
143
|
+
#endif
|
144
|
+
|
136
145
|
/* The data behind each PG::Connection object */
|
137
146
|
typedef struct {
|
138
147
|
PGconn *pgconn;
|
@@ -313,6 +322,7 @@ VALUE lookup_error_class _(( const char * ));
|
|
313
322
|
VALUE pg_bin_dec_bytea _(( t_pg_coder*, char *, int, int, int, int ));
|
314
323
|
VALUE pg_text_dec_string _(( t_pg_coder*, char *, int, int, int, int ));
|
315
324
|
int pg_coder_enc_to_s _(( t_pg_coder*, VALUE, char *, VALUE *));
|
325
|
+
int pg_text_enc_identifier _(( t_pg_coder*, VALUE, char *, VALUE *));
|
316
326
|
t_pg_coder_enc_func pg_coder_enc_func _(( t_pg_coder* ));
|
317
327
|
t_pg_coder_dec_func pg_coder_dec_func _(( t_pg_coder*, int ));
|
318
328
|
void pg_define_coder _(( const char *, void *, VALUE, VALUE ));
|
data/ext/pg_connection.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* pg_connection.c - PG::Connection class extension
|
3
|
-
* $Id: pg_connection.c,v
|
3
|
+
* $Id: pg_connection.c,v 714601d05fba 2015/02/11 20:45:04 lars $
|
4
4
|
*
|
5
5
|
*/
|
6
6
|
|
@@ -627,22 +627,6 @@ pgconn_host(VALUE self)
|
|
627
627
|
return rb_tainted_str_new2(host);
|
628
628
|
}
|
629
629
|
|
630
|
-
#ifdef HAVE_PQHOSTADDR
|
631
|
-
/*
|
632
|
-
* call-seq:
|
633
|
-
* conn.hostaddr()
|
634
|
-
*
|
635
|
-
* Returns the server numeric IP address of the connection.
|
636
|
-
*/
|
637
|
-
static VALUE
|
638
|
-
pgconn_hostaddr(VALUE self)
|
639
|
-
{
|
640
|
-
char *hostaddr = PQhostaddr(pg_get_pgconn(self));
|
641
|
-
if (!hostaddr) return Qnil;
|
642
|
-
return rb_tainted_str_new2(hostaddr);
|
643
|
-
}
|
644
|
-
#endif
|
645
|
-
|
646
630
|
/*
|
647
631
|
* call-seq:
|
648
632
|
* conn.port()
|
@@ -3013,7 +2997,9 @@ pgconn_transaction(VALUE self)
|
|
3013
2997
|
/*
|
3014
2998
|
* call-seq:
|
3015
2999
|
* PG::Connection.quote_ident( str ) -> String
|
3000
|
+
* PG::Connection.quote_ident( array ) -> String
|
3016
3001
|
* conn.quote_ident( str ) -> String
|
3002
|
+
* conn.quote_ident( array ) -> String
|
3017
3003
|
*
|
3018
3004
|
* Returns a string that is safe for inclusion in a SQL query as an
|
3019
3005
|
* identifier. Note: this is not a quote function for values, but for
|
@@ -3030,31 +3016,20 @@ pgconn_transaction(VALUE self)
|
|
3030
3016
|
* Similarly, this function also protects against special characters,
|
3031
3017
|
* and other things that might allow SQL injection if the identifier
|
3032
3018
|
* comes from an untrusted source.
|
3019
|
+
*
|
3020
|
+
* If the parameter is an Array, then all it's values are separately quoted
|
3021
|
+
* and then joined by a "." character. This can be used for identifiers in
|
3022
|
+
* the form "schema"."table"."column" .
|
3023
|
+
*
|
3024
|
+
* This method is functional identical to the encoder PG::TextEncoder::Identifier .
|
3025
|
+
*
|
3033
3026
|
*/
|
3034
3027
|
static VALUE
|
3035
3028
|
pgconn_s_quote_ident(VALUE self, VALUE in_str)
|
3036
3029
|
{
|
3037
3030
|
VALUE ret;
|
3038
|
-
|
3039
|
-
|
3040
|
-
* double-quotes. */
|
3041
|
-
char buffer[NAMEDATALEN*2+2];
|
3042
|
-
unsigned int i=0,j=0;
|
3043
|
-
unsigned int str_len = RSTRING_LENINT(in_str);
|
3044
|
-
|
3045
|
-
if(str_len >= NAMEDATALEN) {
|
3046
|
-
rb_raise(rb_eArgError,
|
3047
|
-
"Input string is longer than NAMEDATALEN-1 (%d)",
|
3048
|
-
NAMEDATALEN-1);
|
3049
|
-
}
|
3050
|
-
buffer[j++] = '"';
|
3051
|
-
for(i = 0; i < str_len && str[i]; i++) {
|
3052
|
-
if(str[i] == '"')
|
3053
|
-
buffer[j++] = '"';
|
3054
|
-
buffer[j++] = str[i];
|
3055
|
-
}
|
3056
|
-
buffer[j++] = '"';
|
3057
|
-
ret = rb_str_new(buffer,j);
|
3031
|
+
pg_text_enc_identifier(NULL, in_str, NULL, &ret);
|
3032
|
+
|
3058
3033
|
OBJ_INFECT(ret, in_str);
|
3059
3034
|
PG_ENCODING_SET_NOCHECK(ret, ENCODING_GET( rb_obj_class(self) == rb_cPGconn ? self : in_str ));
|
3060
3035
|
|
@@ -3835,9 +3810,6 @@ init_pg_connection()
|
|
3835
3810
|
rb_define_method(rb_cPGconn, "user", pgconn_user, 0);
|
3836
3811
|
rb_define_method(rb_cPGconn, "pass", pgconn_pass, 0);
|
3837
3812
|
rb_define_method(rb_cPGconn, "host", pgconn_host, 0);
|
3838
|
-
#ifdef HAVE_PQHOSTADDR
|
3839
|
-
rb_define_method(rb_cPGconn, "hostaddr", pgconn_hostaddr, 0);
|
3840
|
-
#endif
|
3841
3813
|
rb_define_method(rb_cPGconn, "port", pgconn_port, 0);
|
3842
3814
|
rb_define_method(rb_cPGconn, "tty", pgconn_tty, 0);
|
3843
3815
|
#ifdef HAVE_PQCONNINFO
|
data/ext/pg_result.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* pg_result.c - PG::Result class extension
|
3
|
-
* $Id: pg_result.c,v
|
3
|
+
* $Id: pg_result.c,v 1269b8ad77b8 2015/02/06 16:38:23 lars $
|
4
4
|
*
|
5
5
|
*/
|
6
6
|
|
@@ -863,7 +863,7 @@ pgresult_each_row(VALUE self)
|
|
863
863
|
num_fields = PQnfields(this->pgresult);
|
864
864
|
|
865
865
|
for ( row = 0; row < num_rows; row++ ) {
|
866
|
-
VALUE row_values
|
866
|
+
PG_VARIABLE_LENGTH_ARRAY(VALUE, row_values, num_fields, PG_MAX_COLUMNS)
|
867
867
|
|
868
868
|
/* populate the row */
|
869
869
|
for ( field = 0; field < num_fields; field++ ) {
|
@@ -892,7 +892,7 @@ pgresult_values(VALUE self)
|
|
892
892
|
VALUE results = rb_ary_new2( num_rows );
|
893
893
|
|
894
894
|
for ( row = 0; row < num_rows; row++ ) {
|
895
|
-
VALUE row_values
|
895
|
+
PG_VARIABLE_LENGTH_ARRAY(VALUE, row_values, num_fields, PG_MAX_COLUMNS)
|
896
896
|
|
897
897
|
/* populate the row */
|
898
898
|
for ( field = 0; field < num_fields; field++ ) {
|
@@ -1176,7 +1176,7 @@ pgresult_stream_each_row(VALUE self)
|
|
1176
1176
|
}
|
1177
1177
|
|
1178
1178
|
for ( row = 0; row < ntuples; row++ ) {
|
1179
|
-
VALUE row_values
|
1179
|
+
PG_VARIABLE_LENGTH_ARRAY(VALUE, row_values, nfields, PG_MAX_COLUMNS)
|
1180
1180
|
int field;
|
1181
1181
|
|
1182
1182
|
/* populate the row */
|
data/ext/pg_text_decoder.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* pg_text_decoder.c - PG::TextDecoder module
|
3
|
-
* $Id: pg_text_decoder.c,v
|
3
|
+
* $Id: pg_text_decoder.c,v b111c84b8445 2015/02/11 20:54:03 lars $
|
4
4
|
*
|
5
5
|
*/
|
6
6
|
|
@@ -293,7 +293,7 @@ pg_text_dec_array(t_pg_coder *conv, char *val, int len, int tuple, int field, in
|
|
293
293
|
}
|
294
294
|
|
295
295
|
/*
|
296
|
-
* Document-class: PG::TextDecoder::Identifier < PG::
|
296
|
+
* Document-class: PG::TextDecoder::Identifier < PG::SimpleDecoder
|
297
297
|
*
|
298
298
|
* This is the decoder class for PostgreSQL identifiers.
|
299
299
|
*
|
@@ -305,16 +305,13 @@ pg_text_dec_array(t_pg_coder *conv, char *val, int len, int tuple, int field, in
|
|
305
305
|
static VALUE
|
306
306
|
pg_text_dec_identifier(t_pg_coder *conv, char *val, int len, int tuple, int field, int enc_idx)
|
307
307
|
{
|
308
|
-
t_pg_composite_coder *this = (t_pg_composite_coder *)conv;
|
309
|
-
t_pg_coder_dec_func dec_func = pg_coder_dec_func(this->elem, 0);
|
310
|
-
|
311
308
|
/* Return value: array */
|
312
309
|
VALUE array;
|
313
310
|
VALUE elem;
|
314
311
|
int word_index = 0;
|
315
312
|
int index;
|
316
313
|
/* Use a buffer of the same length, as that will be the worst case */
|
317
|
-
char word
|
314
|
+
PG_VARIABLE_LENGTH_ARRAY(char, word, len + 1, NAMEDATALEN)
|
318
315
|
|
319
316
|
/* The current character in the input string. */
|
320
317
|
char c;
|
@@ -331,7 +328,7 @@ pg_text_dec_identifier(t_pg_coder *conv, char *val, int len, int tuple, int fiel
|
|
331
328
|
if(c == '.' && openQuote < 2 ) {
|
332
329
|
word[word_index] = 0;
|
333
330
|
|
334
|
-
elem =
|
331
|
+
elem = pg_text_dec_string(conv, word, word_index, tuple, field, enc_idx);
|
335
332
|
rb_ary_push(array, elem);
|
336
333
|
|
337
334
|
openQuote = 0;
|
@@ -353,7 +350,7 @@ pg_text_dec_identifier(t_pg_coder *conv, char *val, int len, int tuple, int fiel
|
|
353
350
|
}
|
354
351
|
|
355
352
|
word[word_index] = 0;
|
356
|
-
elem =
|
353
|
+
elem = pg_text_dec_string(conv, word, word_index, tuple, field, enc_idx);
|
357
354
|
rb_ary_push(array, elem);
|
358
355
|
|
359
356
|
return array;
|
@@ -412,11 +409,11 @@ init_pg_text_decoder()
|
|
412
409
|
pg_define_coder( "String", pg_text_dec_string, rb_cPG_SimpleDecoder, rb_mPG_TextDecoder );
|
413
410
|
/* dummy = rb_define_class_under( rb_mPG_TextDecoder, "Bytea", rb_cPG_SimpleDecoder ); */
|
414
411
|
pg_define_coder( "Bytea", pg_text_dec_bytea, rb_cPG_SimpleDecoder, rb_mPG_TextDecoder );
|
412
|
+
/* dummy = rb_define_class_under( rb_mPG_TextDecoder, "Identifier", rb_cPG_SimpleDecoder ); */
|
413
|
+
pg_define_coder( "Identifier", pg_text_dec_identifier, rb_cPG_SimpleDecoder, rb_mPG_TextDecoder );
|
415
414
|
|
416
415
|
/* dummy = rb_define_class_under( rb_mPG_TextDecoder, "Array", rb_cPG_CompositeDecoder ); */
|
417
416
|
pg_define_coder( "Array", pg_text_dec_array, rb_cPG_CompositeDecoder, rb_mPG_TextDecoder );
|
418
|
-
/* dummy = rb_define_class_under( rb_mPG_TextDecoder, "Identifier", rb_cPG_CompositeDecoder ); */
|
419
|
-
pg_define_coder( "Identifier", pg_text_dec_identifier, rb_cPG_CompositeDecoder, rb_mPG_TextDecoder );
|
420
417
|
/* dummy = rb_define_class_under( rb_mPG_TextDecoder, "FromBase64", rb_cPG_CompositeDecoder ); */
|
421
418
|
pg_define_coder( "FromBase64", pg_text_dec_from_base64, rb_cPG_CompositeDecoder, rb_mPG_TextDecoder );
|
422
419
|
}
|