sunstone 7.1.0.1 → 8.0.0

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
  SHA256:
3
- metadata.gz: 3956ea045dce2994b10bcac8535462bdf08597b85d7e15fc325110149a576aa6
4
- data.tar.gz: 02be730df372f32557112e9fb618befb5aafd7a8ef15ce1e12a866f8c18c2ed7
3
+ metadata.gz: dd0eae0dbdee21a95ca29317302b67b50647f7d6654af15553425f55d1d11aed
4
+ data.tar.gz: b0cdc960489411360b1ee4f2cb4cdcce93b7df2464dabdafa2bc26955be002b3
5
5
  SHA512:
6
- metadata.gz: c978ff5919d301007ccd326a632ed915cce129584e0ff9c25c199bddb9a65e517361f95a7d3a8af4ea70546acd1bb16fbc1118ff050a0c209f4168f9ec71feb9
7
- data.tar.gz: 3a24f347b5ca8ccf2816e8d50a28ca3effedea79a897ab3692801b5cd8095d9fc324f37f792ffba621a9669eb7ea92f58be762b62d2a1e9096a9306fc1d46be9
6
+ metadata.gz: ce768f425153db1d5a2242f845bc3de221a4d0d0d8a30a1428c128d2bb1e4353ef986020283fdd1d17e7652937c38d03eb1f42478acbc694da32135f335cab22
7
+ data.tar.gz: ece020a27e0554bad07f0e831919e8969cebdd6970adc344fb4f018b3a45032588dcd7c4eb512d9fcb8ff4acfc09ef27d9fe6124fa2b9db0d5eeff659885d800
@@ -6,7 +6,7 @@ module ActiveRecord
6
6
 
7
7
  def replace(other_array)
8
8
  other_array.each { |val| raise_on_type_mismatch!(val) }
9
- original_target = load_target.dup
9
+ original_target = skip_strict_loading { load_target }.dup
10
10
 
11
11
  if owner.new_record?
12
12
  replace_records(other_array, original_target)
@@ -52,7 +52,6 @@ module ActiveRecord
52
52
  end
53
53
  end
54
54
 
55
-
56
55
  end
57
56
 
58
57
  class HasManyThroughAssociation
@@ -25,13 +25,13 @@ module ActiveRecord
25
25
 
26
26
  include Module.new {
27
27
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
28
- def destroy_associations
29
- if !self.class.connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter)
30
- association(:#{middle_reflection.name}).delete_all(:delete_all)
31
- association(:#{name}).reset
28
+ def destroy_associations
29
+ if !self.class.connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter)
30
+ association(:#{middle_reflection.name}).delete_all(:delete_all)
31
+ association(:#{name}).reset
32
+ end
33
+ super
32
34
  end
33
- super
34
- end
35
35
  RUBY
36
36
  }
37
37
 
@@ -44,7 +44,7 @@ module ActiveRecord
44
44
  end
45
45
 
46
46
  has_many name, scope, **hm_options, &extension
47
- _reflections[name.to_s].parent_reflection = habtm_reflection
47
+ _reflections[name].parent_reflection = habtm_reflection
48
48
  end
49
49
  end
50
50
  end
@@ -8,6 +8,11 @@ module ActiveRecord
8
8
  return ["1=0"] if attributes.empty?
9
9
 
10
10
  attributes.flat_map do |key, value|
11
+ if key.is_a?(Array) && key.size == 1
12
+ key = key.first
13
+ value = value.flatten
14
+ end
15
+
11
16
  if key.is_a?(Array)
12
17
  queries = Array(value).map do |ids_set|
13
18
  raise ArgumentError, "Expected corresponding value for #{key} to be an Array" unless ids_set.is_a?(Array)
@@ -104,18 +104,22 @@ module ActiveRecord
104
104
  def _create_record(attribute_names = self.attribute_names)
105
105
  attribute_names = attributes_for_create(attribute_names)
106
106
  attribute_values = attributes_with_values(attribute_names)
107
-
108
- returning_columns = self.class._returning_columns_for_insert
109
-
110
- returning_values = self.class._insert_record(
111
- attribute_values,
112
- returning_columns
113
- )
114
-
115
- if !self.class.connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter)
116
- returning_columns.zip(returning_values).each do |column, value|
117
- _write_attribute(column, value) if !_read_attribute(column)
118
- end if returning_values
107
+ returning_values = nil
108
+
109
+ self.class.with_connection do |connection|
110
+ returning_columns = self.class._returning_columns_for_insert(connection)
111
+
112
+ returning_values = self.class._insert_record(
113
+ connection,
114
+ attribute_values,
115
+ returning_columns
116
+ )
117
+
118
+ if !self.class.connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter)
119
+ returning_columns.zip(returning_values).each do |column, value|
120
+ _write_attribute(column, value) if !_read_attribute(column)
121
+ end if returning_values
122
+ end
119
123
  end
120
124
 
121
125
  @new_record = false
@@ -4,30 +4,68 @@
4
4
  module ActiveRecord
5
5
  module Calculations
6
6
 
7
+ # Prior to Rails 8 we didn't need this method becuase it would
8
+ # return the first value if there was just one - so we'll just
9
+ # do the same as prevously because it doesn't have to be joined
10
+ def select_for_count
11
+ if select_values.empty?
12
+ :all
13
+ else
14
+ with_connection do |conn|
15
+ # Rails compiles this to a string, but we don't have string we
16
+ # have a hash
17
+ if model.connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter)
18
+ sv = arel_columns(select_values)
19
+ sv.one? ? sv.first : sv
20
+ else
21
+ sv = arel_columns(select_values).map { |column| conn.visitor.compile(column) }
22
+ sv.one? ? sv.first : sv.join(", ")
23
+ end
24
+ end
25
+ end
26
+ end
27
+
7
28
  def pluck(*column_names)
29
+ if @none
30
+ if @async
31
+ return Promise::Complete.new([])
32
+ else
33
+ return []
34
+ end
35
+ end
36
+
8
37
  if loaded? && all_attributes?(column_names)
9
- return records.pluck(*column_names)
38
+ result = records.pluck(*column_names)
39
+ if @async
40
+ return Promise::Complete.new(result)
41
+ else
42
+ return result
43
+ end
10
44
  end
11
-
45
+
12
46
  if has_include?(column_names.first)
13
47
  relation = apply_join_dependency
14
48
  relation.pluck(*column_names)
15
- elsif klass.connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter)
49
+ elsif model.connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter)
16
50
  load
17
- return records.pluck(*column_names.map{|n| n.to_s.sub(/^#{klass.table_name}\./, "")})
51
+ return records.pluck(*column_names.map{|n| n.to_s.sub(/^#{model.table_name}\./, "")})
18
52
  else
19
- klass.disallow_raw_sql!(column_names)
20
- columns = arel_columns(column_names)
53
+ model.disallow_raw_sql!(flattened_args(column_names))
21
54
  relation = spawn
55
+ columns = relation.arel_columns(column_names)
22
56
  relation.select_values = columns
23
57
  result = skip_query_cache_if_necessary do
24
58
  if where_clause.contradiction?
25
- ActiveRecord::Result.empty
59
+ ActiveRecord::Result.empty(async: @async)
26
60
  else
27
- klass.connection.select_all(relation.arel, "#{klass.name} Pluck")
61
+ model.with_connection do |c|
62
+ c.select_all(relation.arel, "#{model.name} Pluck", async: @async)
63
+ end
28
64
  end
29
65
  end
30
- type_cast_pluck_values(result, columns)
66
+ result.then do |result|
67
+ type_cast_pluck_values(result, columns)
68
+ end
31
69
  end
32
70
  end
33
71
 
@@ -1,9 +1,11 @@
1
1
  module ActiveRecord
2
2
  module QueryMethods
3
3
  private
4
- def assert_mutability!
5
- raise ImmutableRelation if @loaded
6
- raise ImmutableRelation if defined?(@arel) && @arel && !klass.connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter)
7
- end
4
+
5
+ def assert_modifiable!
6
+ raise UnmodifiableRelation if @loaded
7
+ raise UnmodifiableRelation if @arel && !model.connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter)
8
+ end
9
+
8
10
  end
9
11
  end
@@ -34,23 +34,25 @@ module ActiveRecord
34
34
  # end
35
35
 
36
36
  def with_transaction_returning_status
37
- status = nil
38
- connection = self.class.connection
39
-
40
- if connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter) && instance_variable_defined?(:@sunstone_updating) && @sunstone_updating
41
- status = yield
42
- else
43
- ensure_finalize = !connection.transaction_open?
44
- connection.transaction do
45
- add_to_transaction(ensure_finalize || has_transactional_callbacks?)
46
- remember_transaction_record_state
37
+ self.class.with_connection do |connection|
38
+ status = nil
39
+ # connection = self.class.connection
47
40
 
41
+ if connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter) && instance_variable_defined?(:@sunstone_updating) && @sunstone_updating
48
42
  status = yield
49
- raise ActiveRecord::Rollback unless status
43
+ else
44
+ ensure_finalize = !connection.transaction_open?
45
+ connection.transaction do
46
+ add_to_transaction(ensure_finalize || has_transactional_callbacks?)
47
+ remember_transaction_record_state
48
+
49
+ status = yield
50
+ raise ActiveRecord::Rollback unless status
51
+ end
50
52
  end
51
- end
52
53
 
53
- status
54
+ status
55
+ end
54
56
  end
55
57
 
56
58
 
@@ -29,7 +29,7 @@ module ActiveRecord
29
29
  sar.compile(binds)
30
30
  end
31
31
 
32
- def to_sar_and_binds(arel_or_sar_string, binds = [], preparable = nil) # :nodoc:
32
+ def to_sar_and_binds(arel_or_sar_string, binds = [], preparable = nil, allow_retry = false)
33
33
  # Arel::TreeManager -> Arel::Node
34
34
  if arel_or_sar_string.respond_to?(:ast)
35
35
  arel_or_sar_string = arel_or_sar_string.ast
@@ -41,10 +41,13 @@ module ActiveRecord
41
41
  "The values must be stored on the AST directly"
42
42
  end
43
43
 
44
- sar = visitor.accept(arel_or_sar_string, collector)
45
- [sar.freeze, sar.binds, false]
44
+ col = collector()
45
+ col.retryable = true
46
+ sar = visitor.compile(arel_or_sar_string, col)
47
+ [sar.freeze, sar.binds, false, allow_retry]
46
48
  else
47
- [arel_or_sar_string.dup.freeze, binds, false]
49
+ arel_or_sar_string = arel_or_sar_string.dup.freeze unless arel_or_sar_string.frozen?
50
+ [arel_or_sar_string, binds, false, allow_retry]
48
51
  end
49
52
  end
50
53
 
@@ -90,11 +93,15 @@ module ActiveRecord
90
93
  end
91
94
 
92
95
  # Returns an ActiveRecord::Result instance.
93
- def select_all(arel, name = nil, binds = [], preparable: nil, async: false)
96
+ def select_all(arel, name = nil, binds = [], preparable: nil, async: false, allow_retry: false)
94
97
  arel = arel_from_relation(arel)
95
- sar, binds, preparable = to_sar_and_binds(arel, binds, preparable)
98
+ sar, binds, preparable, allow_retry = to_sar_and_binds(arel, binds, preparable, allow_retry)
96
99
 
97
- select(sar, name, binds, prepare: prepared_statements && preparable, async: async && FutureResult::SelectAll)
100
+ select(sar, name, binds,
101
+ prepare: prepared_statements && preparable,
102
+ async: async && FutureResult::SelectAll,
103
+ allow_retry: allow_retry
104
+ )
98
105
  rescue ::RangeError
99
106
  ActiveRecord::Result.empty(async: async)
100
107
  end
@@ -112,8 +119,8 @@ module ActiveRecord
112
119
  internal_exec_query(sar, name, binds)
113
120
  end
114
121
 
115
- def internal_exec_query(arel, name = 'SAR', binds = [], prepare: false, async: false, allow_retry: false, materialize_transactions: true)
116
- sars = []
122
+ # Lowest level way to execute a query. Doesn't check for illegal writes, doesn't annotate queries, yields a native result object.
123
+ def raw_execute(arel, name = nil, binds = [], prepare: false, async: false, allow_retry: false, materialize_transactions: true, batch: false)
117
124
  multiple_requests = arel.is_a?(Arel::Collectors::Sunstone)
118
125
  type_casted_binds = binds#type_casted_binds(binds)
119
126
 
@@ -134,66 +141,94 @@ module ActiveRecord
134
141
  multiple_requests = true
135
142
  end
136
143
  end
137
-
138
- send_request = lambda { |req_arel|
144
+
145
+ send_request = lambda { |conn, req_arel, batch|
139
146
  sar = to_sar(req_arel, type_casted_binds)
140
- sars.push(sar)
141
147
  log_mess = sar.path.split('?', 2)
142
- log("#{sar.method} #{log_mess[0]} #{(log_mess[1] && !log_mess[1].empty?) ? MessagePack.unpack(CGI.unescape(log_mess[1])) : '' }", name) do
143
- with_raw_connection do |conn|
144
- response = conn.send_request(sar)
145
- if response.is_a?(Net::HTTPNoContent)
146
- nil
148
+ log("#{sar.method} #{log_mess[0]} #{(log_mess[1] && !log_mess[1].empty?) ? MessagePack.unpack(CGI.unescape(log_mess[1])) : '' }", name) do |notification_payload|
149
+ result = perform_query(conn, sar, prepare:, notification_payload:, batch: batch)
150
+ result.instance_variable_set(:@sunstone_calculation, true) if result && sar.instance_variable_get(:@sunstone_calculation)
151
+ result
152
+ end
153
+ }
154
+
155
+ result = with_raw_connection(allow_retry: allow_retry, materialize_transactions: materialize_transactions) do |conn|
156
+ if multiple_requests
157
+ binds.delete_at(limit_bind_index) if limit_bind_index
158
+
159
+ limit, offset, results = allowed_limit, 0, nil
160
+ last_affected_rows = 0
161
+ while requested_limit ? offset < requested_limit : true
162
+ split_arel = arel.dup
163
+ split_arel.limit = limit
164
+ split_arel.offset = offset
165
+ request_results = send_request.call(conn, split_arel, true)
166
+ last_affected_rows += @last_affected_rows
167
+ if results
168
+ results.push(*request_results)
147
169
  else
148
- JSON.parse(response.body)
170
+ results = request_results
149
171
  end
172
+ break if request_results.size < limit
173
+ offset = offset + limit
150
174
  end
175
+ @last_affected_rows = last_affected_rows
176
+ results
177
+ else
178
+ send_request.call(conn, arel, true)
151
179
  end
152
- }
153
-
154
- result = if multiple_requests
155
- binds.delete_at(limit_bind_index) if limit_bind_index
156
-
157
- limit, offset, results = allowed_limit, 0, []
158
- while requested_limit ? offset < requested_limit : true
159
- split_arel = arel.dup
160
- split_arel.limit = limit
161
- split_arel.offset = offset
162
- request_results = send_request.call(split_arel)
163
- results = results + request_results
164
- break if request_results.size < limit
165
- offset = offset + limit
166
- end
167
- results
168
- else
169
- send_request.call(arel)
170
180
  end
171
-
172
- if sars[0].instance_variable_defined?(:@sunstone_calculation) && sars[0].instance_variable_get(:@sunstone_calculation)
181
+
182
+ result
183
+ end
184
+
185
+ def perform_query(raw_connection, sar, prepare:, notification_payload:, batch: false)
186
+ response = raw_connection.send_request(sar)
187
+ result = response.is_a?(Net::HTTPNoContent) ? nil : JSON.parse(response.body)
188
+
189
+ verified!
190
+ # handle_warnings(result)
191
+ @last_affected_rows = response['Affected-Rows'] || result&.count || 0
192
+ notification_payload[:row_count] = @last_affected_rows
193
+ result
194
+ end
195
+
196
+ # Receive a native adapter result object and returns an ActiveRecord::Result object.
197
+ def cast_result(raw_result)
198
+ if raw_result.instance_variable_defined?(:@sunstone_calculation) && raw_result.instance_variable_get(:@sunstone_calculation)
173
199
  # this is a count, min, max.... yea i know..
174
- ActiveRecord::Result.new(['all'], [result], {:all => @type_map.lookup('integer', {})})
175
- elsif result.is_a?(Array)
176
- ActiveRecord::Result.new(result[0] ? result[0].keys : [], result.map{|r| r.values})
200
+ ActiveRecord::Result.new(['all'], [raw_result], {:all => @type_map.lookup('integer', {})})
201
+ elsif raw_result.is_a?(Array)
202
+ ActiveRecord::Result.new(raw_result[0] ? raw_result[0].keys : [], raw_result.map{|r| r.values})
177
203
  else
178
- ActiveRecord::Result.new(result.keys, [result.values])
204
+ ActiveRecord::Result.new(raw_result.keys, [raw_result.values])
179
205
  end
180
206
  end
207
+
208
+ def affected_rows(raw_result)
209
+ @last_affected_rows
210
+ end
181
211
 
182
- def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])
212
+ def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [], returning: nil)
183
213
  sar, binds = to_sar_and_binds(arel, binds)
184
- value = exec_insert(sar, name, binds, pk, sequence_name)
214
+ value = exec_insert(sar, name, binds, pk, sequence_name, returning: returning)
185
215
 
186
216
  return returning_column_values(value) unless returning.nil?
187
217
 
188
218
  id_value || last_inserted_id(value)
189
219
  end
190
-
220
+ alias create insert
221
+
222
+ # Executes the update statement and returns the number of rows affected.
191
223
  def update(arel, name = nil, binds = [])
192
- exec_update(arel, name, binds)
224
+ sar, binds = to_sar_and_binds(arel, binds)
225
+ internal_exec_query(sar, name, binds)
193
226
  end
194
227
 
228
+ # Executes the delete statement and returns the number of rows affected.
195
229
  def delete(arel, name = nil, binds = [])
196
- exec_delete(arel, name, binds)
230
+ sql, binds = to_sar_and_binds(arel, binds)
231
+ exec_delete(sql, name, binds)
197
232
  end
198
233
 
199
234
  def last_inserted_id(result)
@@ -0,0 +1,19 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters
3
+ module Sunstone
4
+ module Quoting
5
+ extend ActiveSupport::Concern
6
+
7
+ module ClassMethods # :nodoc:
8
+
9
+ # Quotes column names for use in SQL queries.
10
+ def quote_column_name(name) # :nodoc:
11
+ name
12
+ end
13
+
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+ end
@@ -3,6 +3,7 @@ require 'active_record/connection_adapters/abstract_adapter'
3
3
  require 'arel/nodes/relation'
4
4
  require 'arel/visitors/to_sql_extensions'
5
5
 
6
+ require 'active_record/connection_adapters/sunstone/quoting'
6
7
  require 'active_record/connection_adapters/sunstone/database_statements'
7
8
  require 'active_record/connection_adapters/sunstone/schema_statements'
8
9
  require 'active_record/connection_adapters/sunstone/schema_dumper'
@@ -15,19 +16,6 @@ require 'active_record/connection_adapters/sunstone/type/uuid'
15
16
  require 'active_record/connection_adapters/sunstone/type/json'
16
17
 
17
18
  module ActiveRecord
18
- module ConnectionHandling # :nodoc:
19
-
20
- def sunstone_adapter_class
21
- ConnectionAdapters::SunstoneAPIAdapter
22
- end
23
-
24
- # Establishes a connection to the database that's used by all Active Record
25
- # objects
26
- def sunstone_connection(config)
27
- sunstone_adapter_class.new(config)
28
- end
29
- end
30
-
31
19
  module ConnectionAdapters
32
20
  # The SunstoneAPI adapter.
33
21
  #
@@ -56,7 +44,7 @@ module ActiveRecord
56
44
  end
57
45
  end
58
46
 
59
- # include PostgreSQL::Quoting
47
+ include Sunstone::Quoting
60
48
  # include PostgreSQL::ReferentialIntegrity
61
49
  include Sunstone::SchemaStatements
62
50
  include Sunstone::DatabaseStatements
@@ -104,23 +92,30 @@ module ActiveRecord
104
92
  end
105
93
 
106
94
  def active?
107
- @raw_connection&.active?
108
- end
109
-
110
- def load_type_map
111
- @type_map = Type::HashLookupTypeMap.new
112
- initialize_type_map(@type_map)
95
+ @lock.synchronize do
96
+ @raw_connection&.active?
97
+ end
113
98
  end
114
99
 
115
- def reconnect
116
- super
117
- @raw_connection&.reconnect!
100
+ # Connects to a StandardAPI server and sets up the adapter depending
101
+ # on the connected server's characteristics.
102
+ def connect
103
+ @raw_connection = self.class.new_client(@connection_parameters)
118
104
  end
119
105
 
106
+ def reconnect
107
+ @lock.synchronize do
108
+ @raw_connection&.reconnect!
109
+ connect unless @raw_connection
110
+ end
111
+ end
112
+
120
113
  def disconnect!
121
- super
122
- @raw_connection&.disconnect!
123
- @raw_connection = nil
114
+ @lock.synchronize do
115
+ super
116
+ @raw_connection&.disconnect!
117
+ @raw_connection = nil
118
+ end
124
119
  end
125
120
 
126
121
  def discard! # :nodoc:
@@ -128,12 +123,6 @@ module ActiveRecord
128
123
  @raw_connection = nil
129
124
  end
130
125
 
131
- # Executes the delete statement and returns the number of rows affected.
132
- def delete(arel, name = nil, binds = [])
133
- r = exec_delete(arel, name, binds)
134
- r.rows.first.to_i
135
- end
136
-
137
126
  def native_database_types #:nodoc:
138
127
  NATIVE_DATABASE_TYPES
139
128
  end
@@ -169,6 +158,7 @@ module ActiveRecord
169
158
  end
170
159
 
171
160
  def lookup_cast_type_from_column(column) # :nodoc:
161
+ verify! if type_map.nil?
172
162
  cast_type = @type_map.lookup(column.sql_type, {
173
163
  limit: column.limit,
174
164
  precision: column.precision,
@@ -205,20 +195,11 @@ module ActiveRecord
205
195
  end
206
196
  alias create insert
207
197
 
208
- # Connects to a StandardAPI server and sets up the adapter depending
209
- # on the connected server's characteristics.
210
- def connect
211
- @raw_connection = self.class.new_client(@connection_parameters)
212
- end
213
-
214
- def reconnect
215
- @raw_connection&.reconnect!
216
- connect unless @raw_connection
217
- end
218
-
219
198
  # Configures the encoding, verbosity, schema search path, and time zone of the connection.
220
199
  # This is called by #connect and should not be called manually.
221
200
  def configure_connection
201
+ super
202
+
222
203
  reload_type_map
223
204
  end
224
205
 
@@ -233,7 +214,9 @@ module ActiveRecord
233
214
  end
234
215
 
235
216
  private
236
-
217
+
218
+ attr_reader :type_map
219
+
237
220
  def initialize_type_map(m = nil)
238
221
  self.class.initialize_type_map(m || @type_map)
239
222
  end
@@ -203,7 +203,7 @@ module Sunstone
203
203
  close_connection = false
204
204
  @connection.request(request) do |response|
205
205
  if response['Deprecation-Notice']
206
- ActiveSupport::Deprecation.warn(response['Deprecation-Notice'])
206
+ ::ActiveRecord.deprecator.warn(response['Deprecation-Notice'])
207
207
  end
208
208
 
209
209
  validate_response_code(response)
@@ -1,3 +1,3 @@
1
1
  module Sunstone
2
- VERSION = '7.1.0.1'
2
+ VERSION = '8.0.0'
3
3
  end
data/lib/sunstone.rb CHANGED
@@ -39,17 +39,5 @@ require File.expand_path(File.join(__FILE__, '../../ext/arel/attributes/empty_re
39
39
  require File.expand_path(File.join(__FILE__, '../../ext/arel/nodes/select_statement'))
40
40
  require File.expand_path(File.join(__FILE__, '../../ext/active_record/finder_methods'))
41
41
 
42
- if ActiveRecord::VERSION::MAJOR == 6 && ActiveRecord::VERSION::MINOR == 1
43
- # Patch to allow Rails 6.1 pass url to adapter, all other versions work
44
- require 'active_record/database_configurations'
45
- class ActiveRecord::DatabaseConfigurations::UrlConfig
46
- private
47
- def build_url_hash
48
- if url.nil? || %w(jdbc: http: https:).any? { |protocol| url.start_with?(protocol) }
49
- { url: url }
50
- else
51
- ConnectionUrlResolver.new(url).to_hash
52
- end
53
- end
54
- end
55
- end
42
+
43
+ ActiveRecord::ConnectionAdapters.register("sunstone", "ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter", "active_record/connection_adapters/sunstone_adapter")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunstone
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.0.1
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Bracy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-20 00:00:00.000000000 Z
11
+ date: 2025-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 6.5.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 6.5.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: webmock
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - ">="
186
186
  - !ruby/object:Gem::Version
187
- version: 7.1.0
187
+ version: 7.2.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
- version: 7.1.0
194
+ version: 7.2.0
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: msgpack
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -226,14 +226,14 @@ dependencies:
226
226
  requirements:
227
227
  - - ">="
228
228
  - !ruby/object:Gem::Version
229
- version: 7.1.0
229
+ version: 8.0.1
230
230
  type: :runtime
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - ">="
235
235
  - !ruby/object:Gem::Version
236
- version: 7.1.0
236
+ version: 8.0.1
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: arel-extensions
239
239
  requirement: !ruby/object:Gem::Requirement
@@ -288,6 +288,7 @@ files:
288
288
  - ext/arel/select_manager.rb
289
289
  - lib/active_record/connection_adapters/sunstone/column.rb
290
290
  - lib/active_record/connection_adapters/sunstone/database_statements.rb
291
+ - lib/active_record/connection_adapters/sunstone/quoting.rb
291
292
  - lib/active_record/connection_adapters/sunstone/schema_dumper.rb
292
293
  - lib/active_record/connection_adapters/sunstone/schema_statements.rb
293
294
  - lib/active_record/connection_adapters/sunstone/type/array.rb
@@ -323,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
323
324
  - !ruby/object:Gem::Version
324
325
  version: '0'
325
326
  requirements: []
326
- rubygems_version: 3.4.13
327
+ rubygems_version: 3.5.21
327
328
  signing_key:
328
329
  specification_version: 4
329
330
  summary: A library for interacting with REST APIs