sequel_pg_extended_columns 1.6.19

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1637039d0c83db8d05f3c18752f18ade16fca5a487b2d93a61a031192d01f426
4
+ data.tar.gz: c750aaaf2f8119836cabbd8cd006cee598a649184b48166d397a18a07a8c4958
5
+ SHA512:
6
+ metadata.gz: 2defb78d12588298995ab8c7e3e9d0a0666b99c92dcae996b31c01824b125d7c6930e209a564c7051cef880c1c4a7981f02601ca4eae4042a1d9113e2deb0911
7
+ data.tar.gz: 550d7776731d377ef8b7b268cf9fd3a33c60708fb0bd0341c6fdf4a92d40e3503a87d99be3d1d763c025cad91977754b79cbe8f767f1c59a7c2b8e13cfca0d1e
data/CHANGELOG ADDED
@@ -0,0 +1,149 @@
1
+ === 1.6.19 (2017-06-13)
2
+
3
+ * Use PG::Error instead of PGError if available, avoiding deprecation warning on pg 0.21.0+ (jeremyevans)
4
+
5
+ === 1.6.18 (2017-04-27)
6
+
7
+ * Support logging of connection information in single row mode (jeremyevans)
8
+
9
+ * Check Sequel compatibility before overwriting methods, supported in Sequel 4.44.0+ (jeremyevans)
10
+
11
+ * Remove verbose mode warnings (jeremyevans)
12
+
13
+ === 1.6.17 (2016-04-29)
14
+
15
+ * Work with upcoming 4.34.0 release, supporting the duplicate_column_handler extension (jeremyevans)
16
+
17
+ === 1.6.16 (2016-04-11)
18
+
19
+ * Work with upcoming Sequel 4.34.0 release, and Sequel 4.0+ (jeremyevans) (#22)
20
+
21
+ === 1.6.15 (2016-04-11)
22
+
23
+ * Work with upcoming Sequel 4.34.0 release, supporting to_hash taking the hash to insert into (jeremyevans)
24
+
25
+ === 1.6.14 (2016-01-19)
26
+
27
+ * Make array parser ignore explicit bounds (jeremyevans)
28
+
29
+ === 1.6.13 (2015-06-29)
30
+
31
+ * Fix Dataset#paged_each when called with no arguments (jeremyevans)
32
+
33
+ * Remove handling of int2vector type (jeremyevans)
34
+
35
+ === 1.6.12 (2015-03-23)
36
+
37
+ * Fix segfault when Dataset#yield_hash_rows is passed a nil value when using ruby pg 0.18+ (jeremyevans) (#19)
38
+
39
+ === 1.6.11 (2014-11-04)
40
+
41
+ * Work with ruby pg 0.18+ (currently a prerelease) (jeremyevans)
42
+
43
+ === 1.6.10 (2014-07-11)
44
+
45
+ * Work correctly when the database timezone is not a named timezone but the application timezone is (jeremyevans)
46
+
47
+ === 1.6.9 (2014-03-05)
48
+
49
+ * When using the streaming extension, automatically use streaming to implement paging in Dataset#paged_each (jeremyevans)
50
+
51
+ === 1.6.8 (2013-08-05)
52
+
53
+ * Allow overriding maximum allowed columns in a result set via -- --with-cflags=\"-DSPG_MAX_FIELDS=1600\" (jeremyevans) (#12)
54
+
55
+ === 1.6.7 (2013-06-06)
56
+
57
+ * Correctly handle fractional seconds in the time type (jeremyevans)
58
+
59
+ === 1.6.6 (2013-05-31)
60
+
61
+ * Work correctly when using the named_timezones extension (jeremyevans)
62
+
63
+ * Work around format-security false positive (jeremyevans) (#9)
64
+
65
+ === 1.6.5 (2013-03-06)
66
+
67
+ * Handle infinite dates using Database#convert_infinite_timestamps (jeremyevans)
68
+
69
+ === 1.6.4 (2013-01-14)
70
+
71
+ * Remove type conversion of int2vector and money types on PostgreSQL, since previous conversions were wrong (jeremyevans) (#8)
72
+
73
+ === 1.6.3 (2012-11-30)
74
+
75
+ * Make streaming support not swallow errors when rows are not retrieved (jeremyevans)
76
+
77
+ === 1.6.2 (2012-11-16)
78
+
79
+ * Make sequel_pg runnable on rubinius by fixing bad rb_global_variable call (dbussink) (#7)
80
+
81
+ === 1.6.1 (2012-10-25)
82
+
83
+ * Make PostgreSQL array parser handle string encodings correctly on ruby 1.9 (jeremyevans)
84
+
85
+ === 1.6.0 (2012-09-04)
86
+
87
+ * Replace PQsetRowProcessor streaming with PQsetSingleRowMode streaming introduced in PostgreSQL 9.2beta3 (jeremyevans)
88
+
89
+ === 1.5.1 (2012-08-02)
90
+
91
+ * Sprinkle some RB_GC_GUARD to work around segfaults in the PostgreSQL array parser (jeremyevans)
92
+
93
+ === 1.5.0 (2012-07-02)
94
+
95
+ * Add C-based PostgreSQL array parser, for major speedup in parsing arrays (Dan McClain, jeremyevans)
96
+
97
+ === 1.4.0 (2012-06-01)
98
+
99
+ * Add support for streaming on PostgreSQL 9.2 using PQsetRowProcessor (jeremyevans)
100
+
101
+ * Respect DEBUG environment variable when building (jeremyevans)
102
+
103
+ === 1.3.0 (2012-04-02)
104
+
105
+ * Build Windows version against PostgreSQL 9.1.1, ruby 1.8.7, and ruby 1.9.2 (previously 9.0.1, 1.8.6, and 1.9.1) (jeremyevans)
106
+
107
+ * Add major speedup for new Sequel 3.34.0 methods Dataset#to_hash_groups and #select_hash_groups (jeremyevans)
108
+
109
+ * Handle infinite timestamp values using Database#convert_infinite_timestamps in Sequel 3.34.0 (jeremyevans)
110
+
111
+ === 1.2.2 (2012-03-09)
112
+
113
+ * Get microsecond accuracy when using datetime_class = DateTime with 1.8-1.9.2 stdlib date library via Rational (jeremyevans)
114
+
115
+ === 1.2.1 (2012-02-22)
116
+
117
+ * Handle NaN, Infinity, and -Infinity for double precision values correctly (jeremyevans)
118
+
119
+ === 1.2.0 (2011-11-01)
120
+
121
+ * Add optimize_model_load setting to speedup loading of model objects, off by default (jeremyevans)
122
+
123
+ * Add major speedup to Dataset#map, #to_hash, #select_map, #select_order_map, and #select_hash (jeremyevans)
124
+
125
+ * Work with the new Database#timezone setting in Sequel 3.29.0 (jeremyevans)
126
+
127
+ === 1.1.1 (2011-09-01)
128
+
129
+ * Work with new Sequel::SQLTime for time columns in Sequel 3.27.0 (jeremyevans)
130
+
131
+ === 1.1.0 (2011-06-01)
132
+
133
+ * Work with new Database#conversion_procs method in Sequel 3.24.0 (jeremyevans)
134
+
135
+ === 1.0.2 (2011-03-16)
136
+
137
+ * Build the Windows gem against PostgreSQL 9.0.1 to support the new default bytea serialization format (jeremyevans)
138
+
139
+ * Allow use of Sequel::Postgres::PG_TYPES to add custom conversion support for types not handled by default (funny-falcon) (#2)
140
+
141
+ * Fix handling of timestamps with fractional seconds and offsets (funny-falcon) (#1)
142
+
143
+ === 1.0.1 (2010-09-12)
144
+
145
+ * Correctly handle timestamps with negative offsets and fractional hours (jeremyevans)
146
+
147
+ === 1.0.0 (2010-08-31)
148
+
149
+ * Initial Public Release
data/MIT-LICENSE ADDED
@@ -0,0 +1,47 @@
1
+ Copyright (c) 2010-2017 Jeremy Evans
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
+
20
+
21
+ The original array parsing code (parse_pg_array, read_array) was taken from
22
+ the pg_array_parser library (https://github.com/dockyard/pg_array_parser)
23
+ and has the following license:
24
+
25
+ Copyright (c) 2012 Dan McClain
26
+
27
+ MIT License
28
+
29
+ Permission is hereby granted, free of charge, to any person obtaining
30
+ a copy of this software and associated documentation files (the
31
+ "Software"), to deal in the Software without restriction, including
32
+ without limitation the rights to use, copy, modify, merge, publish,
33
+ distribute, sublicense, and/or sell copies of the Software, and to
34
+ permit persons to whom the Software is furnished to do so, subject to
35
+ the following conditions:
36
+
37
+ The above copyright notice and this permission notice shall be
38
+ included in all copies or substantial portions of the Software.
39
+
40
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
41
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
42
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
43
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
44
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
45
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
46
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
47
+
data/README.rdoc ADDED
@@ -0,0 +1,190 @@
1
+ = sequel_pg
2
+
3
+ sequel_pg overwrites the inner loop of the Sequel postgres adapter
4
+ row fetching code with a C version. The C version is significantly
5
+ faster (2-6x) than the pure ruby version that Sequel uses by default.
6
+
7
+ == Real world difference
8
+
9
+ The speed up that sequel_pg gives you depends on what you are
10
+ selecting, but it should be noticeable whenever many rows are selected.
11
+ Here's an example that shows the difference it makes on a couple of
12
+ models:
13
+
14
+ $ irb -r model -r benchmark
15
+ irb(main):001:0> Track.count
16
+ => 140854
17
+ irb(main):002:0> Album.count
18
+ => 5579
19
+ irb(main):003:0> puts Benchmark.measure{Track.each{}}
20
+ 10.740000 0.190000 10.930000 ( 11.875343)
21
+ => nil
22
+ irb(main):004:0> puts Benchmark.measure{10.times{Album.each{}}}
23
+ 7.920000 0.070000 7.990000 ( 8.482130)
24
+ => nil
25
+ irb(main):005:0> require '/data/code/sequel_pg/ext/sequel_pg/sequel_pg'
26
+ => true
27
+ irb(main):006:0> puts Benchmark.measure{Track.each{}}
28
+ 2.360000 0.400000 2.760000 ( 3.723098)
29
+ => nil
30
+ irb(main):007:0> puts Benchmark.measure{10.times{Album.each{}}}
31
+ 1.300000 0.190000 1.490000 ( 2.001393)
32
+ => nil
33
+
34
+ Here's an example that uses a modified version of swift's benchmarks
35
+ (http://github.com/shanna/swift/tree/master/benchmarks/):
36
+
37
+ benchmark sys user total real rss
38
+ sequel #select 0.090000 2.020000 2.110000 2.246688 46.54m
39
+ sequel_pg #select 0.000000 0.250000 0.250000 0.361999 7.33m
40
+
41
+ sequel_pg also has code to speed up the map, to_hash, to_hash_groups,
42
+ select_hash, select_hash_groups, select_map, and select_order_map
43
+ Dataset methods, which is on by default. It also has code to speed
44
+ up the loading of model objects, which is off by default as it isn't
45
+ fully compatible. It doesn't handle overriding Model.call,
46
+ Model#set_values, or Model#after_initialize, which may cause problems
47
+ with the following plugins that ship with Sequel:
48
+
49
+ * class_table_inheritance
50
+ * force_encoding
51
+ * serialization
52
+ * single_table_inheritance
53
+ * typecast_on_load
54
+ * update_primary_key
55
+
56
+ If you want to extract that last ounce of performance when loading
57
+ model objects and you can live with the limitations, you can
58
+ enable the model optimization via:
59
+
60
+ # All datasets
61
+ DB.optimize_model_load = true
62
+
63
+ # Specific dataset
64
+ Artist.dataset.optimize_model_load = true
65
+
66
+ == Streaming
67
+
68
+ If you are using PostgreSQL 9.2beta3 or higher on the client, then sequel_pg
69
+ should enable streaming support. This allows you to stream returned
70
+ rows one at a time, instead of collecting the entire result set in
71
+ memory (which is how PostgreSQL works by default). You can check
72
+ if streaming is supported by:
73
+
74
+ Sequel::Postgres.supports_streaming?
75
+
76
+ If streaming is supported, you can load the streaming support into the
77
+ database:
78
+
79
+ DB.extension(:pg_streaming)
80
+
81
+ Then you can call the Dataset#stream method to have the dataset use
82
+ the streaming support:
83
+
84
+ DB[:table].stream.each{|row| ...}
85
+
86
+ If you want to enable streaming for all of a database's datasets, you
87
+ can do the following:
88
+
89
+ DB.stream_all_queries = true
90
+
91
+ Note that pg 0.14.1+ is required for streaming to work. This is not
92
+ required by the gem, as it is only a requirement for streaming, not
93
+ for general use.
94
+
95
+ == Installing the gem
96
+
97
+ gem install sequel_pg
98
+
99
+ Note that by default sequel_pg only supports result sets with up to
100
+ 256 columns. If you will have a result set with more than 256 columns,
101
+ you should modify the maximum supported number of columns via:
102
+
103
+ gem install sequel_pg -- --with-cflags=\"-DSPG_MAX_FIELDS=512\"
104
+
105
+ Make sure the pg_config binary is in your PATH so the installation
106
+ can find the PostgreSQL shared library and header files. Alternatively,
107
+ you can use the POSTGRES_LIB and POSTGRES_INCLUDE environment
108
+ variables to specify the shared library and header directories.
109
+
110
+ While previous versions of this gem supported Windows, the current
111
+ version does not, due to the need to call C functions defined
112
+ in the pg gem.
113
+
114
+ == Running the specs
115
+
116
+ sequel_pg doesn't ship with it's own specs. It's designed to
117
+ replace a part of Sequel, so it just uses Sequel's specs.
118
+ Specifically, the spec_postgres rake task from Sequel.
119
+
120
+ == Reporting issues/bugs
121
+
122
+ sequel_pg uses GitHub Issues for tracking issues/bugs:
123
+
124
+ http://github.com/jeremyevans/sequel_pg/issues
125
+
126
+ == Contributing
127
+
128
+ The source code is on GitHub:
129
+
130
+ http://github.com/jeremyevans/sequel_pg
131
+
132
+ To get a copy:
133
+
134
+ git clone git://github.com/jeremyevans/sequel_pg.git
135
+
136
+ There are only a few requirements, which you should probably
137
+ have before considering use of the library:
138
+
139
+ * Rake
140
+ * Sequel
141
+ * pg
142
+ * libpq headers and library
143
+
144
+ == Building
145
+
146
+ To build the library from a git checkout, after installing the
147
+ requirements:
148
+
149
+ rake build
150
+
151
+ == Platforms Supported
152
+
153
+ sequel_pg has been tested on the following:
154
+
155
+ * ruby 1.8.7
156
+ * ruby 1.9.3
157
+ * ruby 2.0
158
+ * ruby 2.1
159
+ * ruby 2.2
160
+ * ruby 2.3
161
+ * ruby 2.4
162
+
163
+ == Known Issues
164
+
165
+ * You must be using the ISO PostgreSQL date format (which is the
166
+ default). Using the SQL, POSTGRESQL, or GERMAN date formats will
167
+ result in incorrect date/timestamp handling. In addition to
168
+ PostgreSQL defaulting to ISO, Sequel also manually sets the
169
+ date format to ISO by default, so unless you are overriding that
170
+ setting (via Sequel::Postgres.use_iso_date_format = false), you
171
+ should be OK.
172
+ * Adding your own type conversion procs only has an effect if those
173
+ types are not handled by default.
174
+ * You do not need to require the library, the sequel postgres adapter
175
+ will require it automatically. If you are using bundler, you
176
+ should add it to your Gemfile like so:
177
+
178
+ gem 'sequel_pg', :require=>'sequel'
179
+
180
+ * sequel_pg currently calls functions defined in the pg gem, which
181
+ does not work on Windows and does not work in some unix-like
182
+ operating systems that disallow undefined functions in shared
183
+ libraries. If <tt>RbConfig::CONFIG['LDFLAGS']</tt> contains
184
+ <tt>-Wl,--no-undefined</tt>, you'll probably have issues installing
185
+ sequel_pg. You should probably fix <tt>RbConfig::CONFIG['LDFLAGS']</tt>
186
+ in that case.
187
+
188
+ == Author
189
+
190
+ Jeremy Evans <code@jeremyevans.net>
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ require "rake"
2
+ require "rake/clean"
3
+
4
+ CLEAN.include %w'**.rbc rdoc'
5
+
6
+ desc "Do a full cleaning"
7
+ task :distclean do
8
+ CLEAN.include %w'tmp pkg sequel_pg*.gem lib/*.so'
9
+ Rake::Task[:clean].invoke
10
+ end
11
+
12
+ desc "Build the gem"
13
+ task :gem do
14
+ sh %{gem build sequel_pg.gemspec}
15
+ end
16
+
17
+ begin
18
+ require 'rake/extensiontask'
19
+ Rake::ExtensionTask.new('sequel_pg')
20
+ rescue LoadError
21
+ end
@@ -0,0 +1,21 @@
1
+ require 'mkmf'
2
+ $CFLAGS << " -O0 -g -ggdb" if ENV['DEBUG']
3
+ $CFLAGS << " -Wall " unless RUBY_PLATFORM =~ /solaris/
4
+ dir_config('pg', ENV["POSTGRES_INCLUDE"] || (IO.popen("pg_config --includedir").readline.chomp rescue nil),
5
+ ENV["POSTGRES_LIB"] || (IO.popen("pg_config --libdir").readline.chomp rescue nil))
6
+
7
+ if enable_config("static-build")
8
+ # Link against all required libraries for static build, if they are available
9
+ have_library('gdi32', 'CreateDC')
10
+ have_library('secur32')
11
+ have_library('ws2_32')
12
+ have_library('eay32')
13
+ have_library('ssleay32', 'SSL_pending')
14
+ end
15
+
16
+ if (have_library('pq') || have_library('libpq') || have_library('ms/libpq')) && have_header('libpq-fe.h')
17
+ have_func 'PQsetSingleRowMode'
18
+ create_makefile("sequel_pg")
19
+ else
20
+ puts 'Could not find PostgreSQL build environment (libraries & headers): Makefile not created'
21
+ end