pg 0.18.0.pre20141017160319 → 0.18.0.pre20141117110243

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db79067db275bd6f5d8fb5194610716de4eba838
4
- data.tar.gz: 30aa3c6d3ea706306adc3059b16349429f2c15c6
3
+ metadata.gz: 6c38798c2c575b68ddd6cbcd8ffa69e48d4f68e8
4
+ data.tar.gz: 2bc57c9c2cb300fc235cbe8697df41c19df6b82b
5
5
  SHA512:
6
- metadata.gz: 76c17fe2bbbdcf10ffe5e6ba71fde8babc6723ff8a3673455fc647a77f8f718caecf77cab6e255a45c46db01cfaa1fde83db75a26cb39712e10e462f143629ed
7
- data.tar.gz: 77b0e5b2993e2c1a2c5a31a7ad2ffd3bd2ed292111e07bf6fc96f85074001d9434f2a9e6614aefb5f931c0534b4ba1611de54e9f0000e558790606f88aeab5ac
6
+ metadata.gz: 6cef983c3e4713dcbf77e8231e958d8b908c608054bd4fad608ce60707c9141b66092038db1021bc55837519c502579a5eb5de37e97d8b6a72dd5fa2241dcbb2
7
+ data.tar.gz: bb84463d82747afaaf08d9a1bf63d1c53d4807278d6756261fd74109bea127a067ffa956187dee6b67d8ff9c2f1a58ccfeff8b0d308b2701185fec387fa26e51
Binary file
data.tar.gz.sig CHANGED
Binary file
File without changes
data/ChangeLog CHANGED
@@ -1,8 +1,206 @@
1
+ 2014-11-10 Lars Kanis <lars@greiz-reinsdorf.de>
2
+
3
+ * ext/pg_type_map_by_class.c:
4
+ Fix typo.
5
+ [eeb8a82c5328] [tip]
6
+
7
+ * spec/pg/type_map_by_class_spec.rb:
8
+ TypeMapByClass: Add test for invlid coder object.
9
+ [64ae7cff7f40]
10
+
11
+ * ext/pg_type_map_by_class.c:
12
+ Better check than believe the value type returned by #ancestors .
13
+ [961a1fce08fd]
14
+
15
+ 2014-11-08 Lars Kanis <lars@greiz-reinsdorf.de>
16
+
17
+ * ext/pg_binary_decoder.c, ext/pg_type_map_all_strings.c:
18
+ Tweak the type cast documentation a bit more. [skip ci]
19
+ [185638b52684]
20
+
21
+ * ext/pg_type_map_by_class.c, spec/pg/type_map_by_class_spec.rb:
22
+ TypeMapByClass: Forgot to expire the cache on changes.
23
+ [1ce48a854d11]
24
+
25
+ 2014-11-07 Lars Kanis <lars@greiz-reinsdorf.de>
26
+
27
+ * Manifest.txt, ext/pg.c, ext/pg.h, ext/pg_type_map_by_class.c,
28
+ ext/pg_type_map_by_mri_type.c, lib/pg/basic_type_mapping.rb,
29
+ spec/pg/connection_spec.rb, spec/pg/type_map_by_class_spec.rb,
30
+ spec/pg/type_map_by_column_spec.rb, spec/pg/type_spec.rb:
31
+ Add PG::TypeMapByClass. This replaces PG::TypeMapByMriType with a
32
+ more portable and flexible way to encode values.
33
+ [27987dbd0b32]
34
+
35
+ 2014-11-06 Lars Kanis <lars@greiz-reinsdorf.de>
36
+
37
+ * ext/pg_connection.c, ext/pg_result.c:
38
+ Add note about function usage by the sequel_pg gem.
39
+ [989a6bd6bf0d]
40
+
41
+ 2014-11-03 Lars Kanis <lars@greiz-reinsdorf.de>
42
+
43
+ * ext/pg_result.c:
44
+ Fix possible segfault, when the GC runs within the loop of
45
+ pgresult_init_fnames().
46
+ [017bc722655b]
47
+
48
+ 2014-11-01 Lars Kanis <lars@greiz-reinsdorf.de>
49
+
50
+ * ext/pg.h, ext/pg_coder.c, lib/pg/coder.rb, spec/pg/type_spec.rb:
51
+ Set default format code for binary coders to 1.
52
+ [336f694f6362]
53
+
54
+ * ext/pg_text_encoder.c, spec/pg/type_spec.rb:
55
+ Add PG::TextEncoder::Bytea .
56
+ [b10cbaaead6b]
57
+
58
+ 2014-10-31 Lars Kanis <lars@greiz-reinsdorf.de>
59
+
60
+ * lib/pg.rb:
61
+ Windows: Set the PATH so that the bundled libpq.dll of the binary
62
+ gem is loaded preferably to other dlls in the system.
63
+
64
+ This avoids loading issues, if there is some other libpq.dll in the
65
+ path, that fails to load for some reason.
66
+
67
+ [skip ci]
68
+ [b2bf034e3b9f]
69
+
70
+ 2014-10-30 Lars Kanis <lars@greiz-reinsdorf.de>
71
+
72
+ * History.rdoc:
73
+ Update History.rdoc for PG::Connection#hostaddr .
74
+ [2d1a83316472]
75
+
76
+ * .travis.yml:
77
+ Remove Rubinius from the allowed failure list - failing specs are
78
+ now marked as pending.
79
+ [9e707fcf2070]
80
+
81
+ * ext/extconf.rb, ext/pg_connection.c, spec/pg/connection_spec.rb:
82
+ Add PG::Connection#hostaddr. This is new in PostgreSQL-9.4.
83
+ [3a7b6a1d1cfe]
84
+
85
+ * .travis.yml, spec/helpers.rb:
86
+ Update tavis-ci and specs for PostgreSQL-9.4.
87
+ [4daf11be6d3d]
88
+
89
+ 2014-10-28 Lars Kanis <lars@greiz-reinsdorf.de>
90
+
91
+ * spec/pg/type_spec.rb:
92
+ Fix typo in specs. Thanks Chris Bandy.
93
+ [9015809803aa]
94
+
95
+ 2014-10-27 Lars Kanis <lars@greiz-reinsdorf.de>
96
+
97
+ * spec/pg/result_spec.rb:
98
+ Mark failing tests on Rubinius as pending.
99
+ [12f053154a99]
100
+
101
+ * History.rdoc:
102
+ Update History.rdoc
103
+ [b7faf8c1c677]
104
+
105
+ * Merge branch 'master' of github.com:larskanis/ruby-pg
106
+ [0f49f9bc93c6]
107
+
108
+ 2014-10-27 Lars Kanis <kanis@comcard.de>
109
+
110
+ * ext/extconf.rb, ext/pg.h:
111
+ Fix compat with Rubinius.
112
+ [3a4e19c56686]
113
+
114
+ 2014-10-27 Lars Kanis <lars@greiz-reinsdorf.de>
115
+
116
+ * ext/pg_result.c, spec/pg/result_spec.rb:
117
+ Add PG::Result#stream_each and #stream_each_row methods and specs.
118
+ [9387b7aeaad3]
119
+
120
+ * ext/pg_result.c:
121
+ Fix typo.
122
+ [d2bfa9acf36b]
123
+
124
+ 2014-10-25 Lars Kanis <lars@greiz-reinsdorf.de>
125
+
126
+ * ext/pg.h, ext/pg_result.c:
127
+ Use rb_hash_dup() with a prepared tuple hash instead of
128
+ rb_hash_new().
129
+
130
+ This gives a little speedup of 5-10% for Result#each .
131
+ [dfe51787f74d]
132
+
133
+ 2014-10-24 Lars Kanis <lars@greiz-reinsdorf.de>
134
+
135
+ * ext/pg.h:
136
+ Add workaround for missing RETURN_SIZED_ENUMERATOR macro in Ruby <
137
+ 2.0.
138
+ [995d0d85d88d]
139
+
140
+ * ext/pg_text_encoder.c:
141
+ Add include <math.h>. It defines isnan() and isinf().
142
+ [cadf29e3f863]
143
+
144
+ * ext/pg_result.c:
145
+ Use rb_ary_new4() instead of rb_ary_new_from_values() for compat
146
+ with Ruby < 2.1.
147
+ [7c465876616d]
148
+
149
+ * ext/pg_result.c:
150
+ Populate the row-Array in Result#each_row and Result.values per
151
+ rb_ary_new_from_values() from VALUE array on the stack. The number
152
+ of fields is limited on the server side to ~1700, so that stack
153
+ space is not critical. This gives a small speed up by 5%.
154
+ [adc7a83326e3]
155
+
156
+ * ext/pg.h, ext/pg_result.c:
157
+ Use frozen String objects as field names and reuse them where
158
+ possible.
159
+
160
+ This speeds Result#each up by 30%.
161
+ [f50c049adc3b]
162
+
163
+ * ext/pg_result.c, spec/pg/result_spec.rb:
164
+ Add Enumerator versions to Result#each and #each_row.
165
+ [1b324be632e4]
166
+
167
+ 2014-10-22 Lars Kanis <lars@greiz-reinsdorf.de>
168
+
169
+ * ext/pg_connection.c:
170
+ Merge alloc_query_params() and alloc_query_params1(). The separation
171
+ is no longer needed.
172
+
173
+ Allocate gc_array on demand, as it's not needed for most queries.
174
+ [aae1c7dd2360]
175
+
176
+ * README.rdoc, ext/pg.h, ext/pg_connection.c, ext/pg_copy_coder.c,
177
+ ext/pg_result.c, ext/pg_type_map.c, ext/pg_type_map_all_strings.c,
178
+ ext/pg_type_map_by_column.c, ext/pg_type_map_by_mri_type.c,
179
+ ext/pg_type_map_by_oid.c, spec/pg/basic_type_mapping_spec.rb,
180
+ spec/pg/connection_spec.rb, spec/pg/result_spec.rb,
181
+ spec/pg/type_map_by_column_spec.rb,
182
+ spec/pg/type_map_by_mri_type_spec.rb,
183
+ spec/pg/type_map_by_oid_spec.rb:
184
+ Allow cascading of type maps.
185
+
186
+ If a value can not be handled by a type map this value isn't handled
187
+ implicit by TypeMapAllStrings, but instead by the assigned
188
+ default_type_map, now.
189
+ [d369d31e8fe3]
190
+
191
+ 2014-10-17 Lars Kanis <lars@greiz-reinsdorf.de>
192
+
193
+ * ext/pg.h, ext/pg_type_map.c, ext/pg_type_map_by_column.c,
194
+ spec/pg/type_map_by_column_spec.rb:
195
+ Gracefully handle not initialized state for PG::TypeMapByColumn
196
+ derivations.
197
+ [485d02650e09]
198
+
1
199
  2014-10-15 Lars Kanis <lars@greiz-reinsdorf.de>
2
200
 
3
201
  * ext/pg_text_encoder.c, spec/pg/type_spec.rb:
4
202
  Allow non Array values as input for TextEncoder::Array.
5
- [a4725dfca9e4] [tip]
203
+ [a4725dfca9e4]
6
204
 
7
205
  * ext/pg_coder.c, spec/pg/type_spec.rb:
8
206
  Clarify handling of nil/NULL values by PG::Coders.
@@ -22,7 +220,7 @@
22
220
  ext/pg_text_encoder.c:
23
221
  Fix naming and description of pg_coder_enc_to_s(). It actually uses
24
222
  #to_s not #to_str.
25
- [ac23631c96d9] [github/master]
223
+ [ac23631c96d9]
26
224
 
27
225
  * ext/pg_text_encoder.c, spec/pg/type_spec.rb:
28
226
  Use same rules for array quoting in text encoder as PostgreSQL.
@@ -1457,6 +1655,12 @@
1457
1655
  Merged with 4cc778c5ead7
1458
1656
  [67bb0f34ca05]
1459
1657
 
1658
+ 2014-08-20 Michael Granger <ged@FaerieMUD.org>
1659
+
1660
+ * spec/helpers.rb, spec/pg/connection_spec.rb:
1661
+ Check connection status with a matcher in specs
1662
+ [b32840b98e4b]
1663
+
1460
1664
  2014-10-09 Lars Kanis <lars@greiz-reinsdorf.de>
1461
1665
 
1462
1666
  * Rakefile, Rakefile.cross, ext/extconf.rb:
@@ -1532,10 +1736,6 @@
1532
1736
 
1533
1737
  2014-08-20 Michael Granger <ged@FaerieMUD.org>
1534
1738
 
1535
- * spec/helpers.rb, spec/pg/connection_spec.rb:
1536
- Check connection status with a matcher in specs
1537
- [b32840b98e4b]
1538
-
1539
1739
  * ext/pg_connection.c, lib/pg/connection.rb,
1540
1740
  spec/pg/connection_spec.rb:
1541
1741
  Implement PG::Connection#conninfo and use it to test #188
@@ -1560,19 +1760,17 @@
1560
1760
  * Merge with 6c2444dc63e1
1561
1761
  [d7160a9fb5dc]
1562
1762
 
1763
+ * .rvm.gems, Rakefile, spec/helpers.rb, spec/lib/helpers.rb,
1764
+ spec/pg/connection_spec.rb, spec/pg/result_spec.rb, spec/pg_spec.rb:
1765
+ Convert specs to expect syntax for RSpec 3
1766
+ [c9108c846ab2]
1767
+
1563
1768
  2013-12-30 Lars Kanis <lars@greiz-reinsdorf.de>
1564
1769
 
1565
1770
  * ext/pg_connection.c:
1566
1771
  Fix typo in documentation.
1567
1772
  [6c2444dc63e1]
1568
1773
 
1569
- 2014-06-05 Michael Granger <ged@FaerieMUD.org>
1570
-
1571
- * .rvm.gems, Rakefile, spec/helpers.rb, spec/lib/helpers.rb,
1572
- spec/pg/connection_spec.rb, spec/pg/result_spec.rb, spec/pg_spec.rb:
1573
- Convert specs to expect syntax for RSpec 3
1574
- [c9108c846ab2]
1575
-
1576
1774
  2013-12-18 Michael Granger <ged@FaerieMUD.org>
1577
1775
 
1578
1776
  * .hgtags:
@@ -2307,13 +2505,13 @@
2307
2505
  PQexecParams() itself.
2308
2506
 
2309
2507
  Thanks to Aaron Patterson for the idea.
2310
- [7c313c2355b7] [github/exec_params]
2508
+ [7c313c2355b7]
2311
2509
 
2312
2510
  2013-01-31 Michael Granger <ged@FaerieMUD.org>
2313
2511
 
2314
2512
  * ext/extconf.rb:
2315
2513
  Add experimental -rpath to the LDFLAGS
2316
- [8496c624dffd] [github/rpath_ldflag]
2514
+ [8496c624dffd]
2317
2515
 
2318
2516
  2013-01-30 Michael Granger <ged@FaerieMUD.org>
2319
2517
 
@@ -1,8 +1,23 @@
1
1
  == v0.18.0 [unreleased]
2
2
 
3
+ Bugfixes:
4
+ - Fix OID to Integer mapping (it is unsigned now). #187
5
+ - Fix possible segfault in conjunction with notice receiver. #185
6
+
3
7
  Enhancements:
4
8
 
5
9
  - Add an extensible type cast system.
10
+ - A lot of performance improvements.
11
+ - Return frozen String objects for result field names.
12
+ - Add PG::Result#stream_each and #stream_each_row as fast helpers for
13
+ the single row mode.
14
+ - Add Enumerator variant to PG::Result#each and #each_row.
15
+ - Add PG::Connection#conninfo and #hostaddr.
16
+ - Add PG.init_openssl and PG.init_ssl methods.
17
+ - Force zero termination for all text strings that are given to libpq.
18
+ It raises an ArgumentError if the string contains a null byte.
19
+ - Update Windows cross build to PostgreSQL 9.3.
20
+
6
21
 
7
22
  == v0.17.1 [2013-12-18] Michael Granger <ged@FaerieMUD.org>
8
23
 
@@ -30,6 +30,7 @@ ext/pg_result.c
30
30
  ext/pg_text_decoder.c
31
31
  ext/pg_text_encoder.c
32
32
  ext/pg_type_map_all_strings.c
33
+ ext/pg_type_map_by_class.c
33
34
  ext/pg_type_map_by_column.c
34
35
  ext/pg_type_map_by_mri_type.c
35
36
  ext/pg_type_map_by_oid.c
@@ -73,6 +74,7 @@ spec/helpers.rb
73
74
  spec/pg/basic_type_mapping_spec.rb
74
75
  spec/pg/connection_spec.rb
75
76
  spec/pg/result_spec.rb
77
+ spec/pg/type_map_by_class_spec.rb
76
78
  spec/pg/type_map_by_column_spec.rb
77
79
  spec/pg/type_map_by_mri_type_spec.rb
78
80
  spec/pg/type_map_by_oid_spec.rb
@@ -105,7 +105,7 @@ to convert single values to/from their string representation.
105
105
  A TypeMap defines which value will be converted by which encoder/decoder.
106
106
  There are different type map strategies, implemented by several derivations
107
107
  of this class. They can be chosen and configured according to the particular
108
- needs for type casting.
108
+ needs for type casting. The default type map is PG::TypeMapAllStrings.
109
109
 
110
110
  A type map can be assigned per connection or per query respectively per
111
111
  result set. Type maps can also be used for COPY in and out data streaming.
data/Rakefile CHANGED
@@ -29,8 +29,6 @@ TMPDIR = BASEDIR + 'tmp'
29
29
  DLEXT = RbConfig::CONFIG['DLEXT']
30
30
  EXT = LIBDIR + "pg_ext.#{DLEXT}"
31
31
 
32
- GEMSPEC = 'pg.gemspec'
33
-
34
32
  TEST_DIRECTORY = BASEDIR + "tmp_test_specs"
35
33
 
36
34
  CLOBBER.include( TEST_DIRECTORY.to_s )
@@ -189,18 +187,3 @@ file 'ext/pg_errors.c' => ['ext/errorcodes.def'] do
189
187
  # trigger compilation of changed errorcodes.def
190
188
  touch 'ext/pg_errors.c'
191
189
  end
192
-
193
- task :gemspec => GEMSPEC
194
- file GEMSPEC => __FILE__
195
- task GEMSPEC do |task|
196
- spec = $hoespec.spec
197
- spec.files.delete( '.gemtest' )
198
- spec.version = "#{spec.version}.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
199
- File.open( task.name, 'w' ) do |fh|
200
- fh.write( spec.to_ruby )
201
- end
202
- end
203
-
204
- CLOBBER.include( GEMSPEC.to_s )
205
- task :default => :gemspec
206
-
@@ -73,6 +73,7 @@ have_func 'PQlibVersion'
73
73
  have_func 'PQping'
74
74
  have_func 'PQsetSingleRowMode'
75
75
  have_func 'PQconninfo'
76
+ have_func 'PQhostaddr'
76
77
 
77
78
  have_func 'rb_encdb_alias'
78
79
  have_func 'rb_enc_alias'
@@ -81,6 +82,7 @@ have_func 'rb_thread_call_with_gvl'
81
82
  have_func 'rb_thread_fd_select'
82
83
  have_func 'rb_w32_wrap_io_handle'
83
84
  have_func 'rb_str_modify_expand'
85
+ have_func 'rb_hash_dup'
84
86
 
85
87
  have_const 'PGRES_COPY_BOTH', 'libpq-fe.h'
86
88
  have_const 'PGRES_SINGLE_TUPLE', 'libpq-fe.h'
data/ext/pg.c CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg.c - Toplevel extension
3
- * $Id: pg.c,v c2e817ef9b8c 2014/09/27 16:40:13 lars $
3
+ * $Id$
4
4
  *
5
5
  * Author/s:
6
6
  *
@@ -333,6 +333,67 @@ pg_s_threadsafe_p(VALUE self)
333
333
  return PQisthreadsafe() ? Qtrue : Qfalse;
334
334
  }
335
335
 
336
+ static int
337
+ pg_to_bool_int(VALUE value)
338
+ {
339
+ switch( TYPE(value) ){
340
+ case T_FALSE:
341
+ return 0;
342
+ case T_TRUE:
343
+ return 1;
344
+ default:
345
+ return NUM2INT(value);
346
+ }
347
+ }
348
+
349
+ /*
350
+ * call-seq:
351
+ * PG.init_openssl(do_ssl, do_crypto) -> nil
352
+ *
353
+ * Allows applications to select which security libraries to initialize.
354
+ *
355
+ * If your application initializes libssl and/or libcrypto libraries and libpq is
356
+ * built with SSL support, you should call PG.init_openssl() to tell libpq that the
357
+ * libssl and/or libcrypto libraries have been initialized by your application,
358
+ * so that libpq will not also initialize those libraries. See
359
+ * http://h71000.www7.hp.com/doc/83final/BA554_90007/ch04.html for details on the SSL API.
360
+ *
361
+ * When do_ssl is +true+, libpq will initialize the OpenSSL library before first
362
+ * opening a database connection. When do_crypto is +true+, the libcrypto library
363
+ * will be initialized. By default (if PG.init_openssl() is not called), both libraries
364
+ * are initialized. When SSL support is not compiled in, this function is present but does nothing.
365
+ *
366
+ * If your application uses and initializes either OpenSSL or its underlying libcrypto library,
367
+ * you must call this function with +false+ for the appropriate parameter(s) before first opening
368
+ * a database connection. Also be sure that you have done that initialization before opening a
369
+ * database connection.
370
+ *
371
+ */
372
+ static VALUE
373
+ pg_s_init_openssl(VALUE self, VALUE do_ssl, VALUE do_crypto)
374
+ {
375
+ UNUSED( self );
376
+ PQinitOpenSSL(pg_to_bool_int(do_ssl), pg_to_bool_int(do_crypto));
377
+ return Qnil;
378
+ }
379
+
380
+
381
+ /*
382
+ * call-seq:
383
+ * PG.init_ssl(do_ssl) -> nil
384
+ *
385
+ * Allows applications to select which security libraries to initialize.
386
+ *
387
+ * This function is equivalent to <tt>PG.init_openssl(do_ssl, do_ssl)</tt> . It is sufficient for
388
+ * applications that initialize both or neither of OpenSSL and libcrypto.
389
+ */
390
+ static VALUE
391
+ pg_s_init_ssl(VALUE self, VALUE do_ssl)
392
+ {
393
+ UNUSED( self );
394
+ PQinitSSL(pg_to_bool_int(do_ssl));
395
+ return Qnil;
396
+ }
336
397
 
337
398
 
338
399
  /**************************************************************************
@@ -355,6 +416,10 @@ Init_pg_ext()
355
416
  SINGLETON_ALIAS( rb_mPG, "is_threadsafe?", "isthreadsafe" );
356
417
  SINGLETON_ALIAS( rb_mPG, "threadsafe?", "isthreadsafe" );
357
418
 
419
+ rb_define_singleton_method( rb_mPG, "init_openssl", pg_s_init_openssl, 2 );
420
+ rb_define_singleton_method( rb_mPG, "init_ssl", pg_s_init_ssl, 1 );
421
+
422
+
358
423
  /****** PG::Connection CLASS CONSTANTS: Connection Status ******/
359
424
 
360
425
  /* Connection succeeded */
@@ -586,6 +651,7 @@ Init_pg_ext()
586
651
  init_pg_errors();
587
652
  init_pg_type_map();
588
653
  init_pg_type_map_all_strings();
654
+ init_pg_type_map_by_class();
589
655
  init_pg_type_map_by_column();
590
656
  init_pg_type_map_by_mri_type();
591
657
  init_pg_type_map_by_oid();