pg 0.18.1-x86-mingw32 → 0.18.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.
@@ -130,7 +130,7 @@ Lars Kanis <lars@greiz-reinsdorf.de>.
130
130
 
131
131
  == Copying
132
132
 
133
- Copyright (c) 1997-2013 by the authors.
133
+ Copyright (c) 1997-2015 by the authors.
134
134
 
135
135
  * Jeff Davis <ruby-pg@j-davis.com>
136
136
  * Guy Decoux (ts) <decoux@moulon.inra.fr>
@@ -217,6 +217,11 @@ class CrossLibrary < OpenStruct
217
217
 
218
218
  # make libpq.dll
219
219
  task postgresql_lib => [ postgresql_global_makefile ] do |t|
220
+ # Work around missing dependency to libcommon in PostgreSQL-9.4.0
221
+ chdir( static_postgresql_srcdir + "common" ) do
222
+ sh 'make', "-j#{NUM_CPUS}"
223
+ end
224
+
220
225
  chdir( postgresql_lib.dirname ) do
221
226
  sh 'make',
222
227
  "-j#{NUM_CPUS}",
@@ -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
@@ -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-2012 by the authors.
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 ));
@@ -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
- char *str = StringValuePtr(in_str);
3039
- /* result size at most NAMEDATALEN*2 plus surrounding
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
@@ -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[num_fields];
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[num_fields];
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[nfields];
1179
+ PG_VARIABLE_LENGTH_ARRAY(VALUE, row_values, nfields, PG_MAX_COLUMNS)
1180
1180
  int field;
1181
1181
 
1182
1182
  /* populate the row */
@@ -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::CompositeDecoder
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[len + 1];
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 = dec_func(conv, word, word_index, tuple, field, enc_idx);
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 = dec_func(conv, word, word_index, tuple, field, enc_idx);
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
  }
@@ -299,7 +299,7 @@ quote_array_buffer( void *_this, char *p_in, int strlen, char *p_out ){
299
299
  /* count data plus backslashes; detect chars needing quotes */
300
300
  if (strlen == 0)
301
301
  needquote = 1; /* force quotes for empty string */
302
- else if (strlen == 4 && pg_strncasecmp(p_in, "NULL", strlen) == 0)
302
+ else if (strlen == 4 && rbpg_strncasecmp(p_in, "NULL", strlen) == 0)
303
303
  needquote = 1; /* force quotes for literal NULL */
304
304
  else
305
305
  needquote = 0;
@@ -455,39 +455,34 @@ pg_text_enc_array(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate)
455
455
  }
456
456
  }
457
457
 
458
- static int
459
- quote_identifier_buffer( void *_this, char *p_in, int strlen, char *p_out ){
458
+ static char *
459
+ quote_identifier( VALUE value, VALUE out_string, char *current_out ){
460
+ char *p_in = RSTRING_PTR(value);
460
461
  char *ptr1;
461
- char *ptr2;
462
- int backslashs = 0;
462
+ size_t strlen = RSTRING_LEN(value);
463
+ char *end_capa = current_out;
463
464
 
464
- /* count required backlashs */
465
+ PG_RB_STR_ENSURE_CAPA( out_string, strlen + 2, current_out, end_capa );
466
+ *current_out++ = '"';
465
467
  for(ptr1 = p_in; ptr1 != p_in + strlen; ptr1++) {
466
- if (*ptr1 == '"'){
467
- backslashs++;
468
+ char c = *ptr1;
469
+ if (c == '"'){
470
+ strlen++;
471
+ PG_RB_STR_ENSURE_CAPA( out_string, p_in - ptr1 + strlen + 1, current_out, end_capa );
472
+ *current_out++ = '"';
473
+ } else if (c == 0){
474
+ break;
468
475
  }
476
+ *current_out++ = c;
469
477
  }
478
+ PG_RB_STR_ENSURE_CAPA( out_string, 1, current_out, end_capa );
479
+ *current_out++ = '"';
470
480
 
471
- ptr1 = p_in + strlen;
472
- ptr2 = p_out + strlen + backslashs + 2;
473
- /* Write end quote */
474
- *--ptr2 = '"';
475
-
476
- /* Then store the escaped string on the final position, walking
477
- * right to left, until all backslashs are placed. */
478
- while( ptr1 != p_in ) {
479
- *--ptr2 = *--ptr1;
480
- if(*ptr2 == '"'){
481
- *--ptr2 = '"';
482
- }
483
- }
484
- /* Write start quote */
485
- *p_out = '"';
486
- return strlen + backslashs + 2;
481
+ return current_out;
487
482
  }
488
483
 
489
484
  static char *
490
- pg_text_enc_array_identifier(t_pg_composite_coder *this, VALUE value, VALUE string, char *out)
485
+ pg_text_enc_array_identifier(VALUE value, VALUE string, char *out)
491
486
  {
492
487
  int i;
493
488
  int nr_elems;
@@ -498,7 +493,7 @@ pg_text_enc_array_identifier(t_pg_composite_coder *this, VALUE value, VALUE stri
498
493
  for( i=0; i<nr_elems; i++){
499
494
  VALUE entry = rb_ary_entry(value, i);
500
495
 
501
- out = quote_string(this->elem, entry, string, out, this->needs_quotation, quote_identifier_buffer, this);
496
+ out = quote_identifier(entry, string, out);
502
497
  if( i < nr_elems-1 ){
503
498
  out = pg_rb_str_ensure_capa( string, 1, out, NULL );
504
499
  *out++ = '.';
@@ -508,27 +503,29 @@ pg_text_enc_array_identifier(t_pg_composite_coder *this, VALUE value, VALUE stri
508
503
  }
509
504
 
510
505
  /*
511
- * Document-class: PG::TextEncoder::Identifier < PG::CompositeEncoder
506
+ * Document-class: PG::TextEncoder::Identifier < PG::SimpleEncoder
512
507
  *
513
508
  * This is the encoder class for PostgreSQL identifiers.
514
509
  *
515
510
  * An Array value can be used for "schema.table.column" type identifiers:
516
511
  * PG::TextEncoder::Identifier.new.encode(['schema', 'table', 'column'])
517
- * => "schema"."table"."column"
512
+ * => '"schema"."table"."column"'
518
513
  *
514
+ * This encoder can also be used per PG::Connection#quote_ident .
519
515
  */
520
- static int
521
- pg_text_enc_identifier(t_pg_coder *conv, VALUE value, char *out, VALUE *intermediate)
516
+ int
517
+ pg_text_enc_identifier(t_pg_coder *this, VALUE value, char *out, VALUE *intermediate)
522
518
  {
523
- t_pg_composite_coder *this = (t_pg_composite_coder *)conv;
524
-
525
- *intermediate = rb_str_new(NULL, 0);
526
- out = RSTRING_PTR(*intermediate);
527
-
519
+ UNUSED( this );
528
520
  if( TYPE(value) == T_ARRAY){
529
- out = pg_text_enc_array_identifier(this, value, *intermediate, out);
521
+ *intermediate = rb_str_new(NULL, 0);
522
+ out = RSTRING_PTR(*intermediate);
523
+ out = pg_text_enc_array_identifier(value, *intermediate, out);
530
524
  } else {
531
- out = quote_string(this->elem, value, *intermediate, out, this->needs_quotation, quote_identifier_buffer, this);
525
+ StringValue(value);
526
+ *intermediate = rb_str_new(NULL, RSTRING_LEN(value) + 2);
527
+ out = RSTRING_PTR(*intermediate);
528
+ out = quote_identifier(value, *intermediate, out);
532
529
  }
533
530
  rb_str_set_len( *intermediate, out - RSTRING_PTR(*intermediate) );
534
531
  return -1;
@@ -651,11 +648,11 @@ init_pg_text_encoder()
651
648
  pg_define_coder( "String", pg_coder_enc_to_s, rb_cPG_SimpleEncoder, rb_mPG_TextEncoder );
652
649
  /* dummy = rb_define_class_under( rb_mPG_TextEncoder, "Bytea", rb_cPG_SimpleEncoder ); */
653
650
  pg_define_coder( "Bytea", pg_text_enc_bytea, rb_cPG_SimpleEncoder, rb_mPG_TextEncoder );
651
+ /* dummy = rb_define_class_under( rb_mPG_TextEncoder, "Identifier", rb_cPG_SimpleEncoder ); */
652
+ pg_define_coder( "Identifier", pg_text_enc_identifier, rb_cPG_SimpleEncoder, rb_mPG_TextEncoder );
654
653
 
655
654
  /* dummy = rb_define_class_under( rb_mPG_TextEncoder, "Array", rb_cPG_CompositeEncoder ); */
656
655
  pg_define_coder( "Array", pg_text_enc_array, rb_cPG_CompositeEncoder, rb_mPG_TextEncoder );
657
- /* dummy = rb_define_class_under( rb_mPG_TextEncoder, "Identifier", rb_cPG_CompositeEncoder ); */
658
- pg_define_coder( "Identifier", pg_text_enc_identifier, rb_cPG_CompositeEncoder, rb_mPG_TextEncoder );
659
656
  /* dummy = rb_define_class_under( rb_mPG_TextEncoder, "QuotedLiteral", rb_cPG_CompositeEncoder ); */
660
657
  pg_define_coder( "QuotedLiteral", pg_text_enc_quoted_literal, rb_cPG_CompositeEncoder, rb_mPG_TextEncoder );
661
658
  /* dummy = rb_define_class_under( rb_mPG_TextEncoder, "ToBase64", rb_cPG_CompositeEncoder ); */
@@ -39,7 +39,7 @@ static VALUE rb_cTypeMapByMriType;
39
39
  typedef struct {
40
40
  t_typemap typemap;
41
41
  struct pg_tmbmt_converter {
42
- FOR_EACH_MRI_TYPE( DECLARE_CODER );
42
+ FOR_EACH_MRI_TYPE( DECLARE_CODER )
43
43
  } coders;
44
44
  } t_tmbmt;
45
45
 
@@ -212,12 +212,9 @@ pg_tmir_copy_get( t_typemap *p_typemap, VALUE field_str, int fieldno, int format
212
212
  rb_encoding *p_encoding = rb_enc_from_index(enc_idx);
213
213
  VALUE enc = rb_enc_from_encoding(p_encoding);
214
214
  /* field_str is reused in-place by pg_text_dec_copy_row(), so we need to make
215
- * a copy of the string buffer before used in ruby space.
216
- * This requires rb_str_new() instead of rb_str_dup() for Rubinius.
217
- */
218
- VALUE field_str_copy = rb_str_new(RSTRING_PTR(field_str), RSTRING_LEN(field_str));
219
- PG_ENCODING_SET_NOCHECK(field_str_copy, ENCODING_GET(field_str));
220
- OBJ_INFECT(field_str_copy, field_str);
215
+ * a copy of the string buffer for use in ruby space. */
216
+ VALUE field_str_copy = rb_str_dup(field_str);
217
+ rb_str_modify(field_str_copy);
221
218
 
222
219
  return rb_funcall( this->self, s_id_typecast_copy_get, 4, field_str_copy, INT2NUM(fieldno), INT2NUM(format), enc );
223
220
  }
data/ext/util.c CHANGED
@@ -124,7 +124,7 @@ base64_decode( char *out, char *in, unsigned int len)
124
124
  * At most n bytes will be examined from each string.
125
125
  */
126
126
  int
127
- pg_strncasecmp(const char *s1, const char *s2, size_t n)
127
+ rbpg_strncasecmp(const char *s1, const char *s2, size_t n)
128
128
  {
129
129
  while (n-- > 0)
130
130
  {
data/ext/util.h CHANGED
@@ -60,6 +60,6 @@
60
60
  void base64_encode( char *out, char *in, int len);
61
61
  int base64_decode( char *out, char *in, unsigned int len);
62
62
 
63
- int pg_strncasecmp(const char *s1, const char *s2, size_t n);
63
+ int rbpg_strncasecmp(const char *s1, const char *s2, size_t n);
64
64
 
65
65
  #endif /* end __utils_h */