sbf-dm-do-adapter 1.4.0.beta.1 → 1.5.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: 2dd3e74ec3df7300824ef62244a7ddb5cdef5f81666ada57c9e87c73a2ff1b56
4
- data.tar.gz: c20298b288433ca4d2f8ba217c8aa7174a8360f051ae3e3a5d48b228712bec50
3
+ metadata.gz: 6d4922d76838caf5b330e21d86cc2a0f6e28a569ccefd222e2587a0e11751778
4
+ data.tar.gz: b42073cdb0aa184957430316d6c0ea9ed19aa186028de447ca1f793cfb9b6a10
5
5
  SHA512:
6
- metadata.gz: 91aa518b9e8a8f8e674352e65e8d84f6252df5aca63deefa5bfaf40757e4c580670f7d76d4fc54c2400df99781b24a19b1e14cf1dc1c17f5e17b5c4f955c4801
7
- data.tar.gz: 65653f2dd72e5980c693906057c0db540d9b760ad430f0173701f86cb31e33abb65712c47da39c425fb567e67ef64e17d8694b3e2656fd934483f38ddccdb116
6
+ metadata.gz: f10c6cd7dd883d7774c6689b1a3c1f131e8e289487d3f02ee4291fb633bf2affdf604dc2bb0a973adf657c25af8bd59d2ac823c1b7f37f7ef6f526e5f460f46c
7
+ data.tar.gz: b20268dcec617b136ad327d8505278d0b5ae2db12351676e9a35af65ac2e098747ff4228438676c1e95b5b07120e44e34db50df19d0330ba00acccfe32d237b3
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
  SOURCE = ENV.fetch('SOURCE', :git).to_sym
8
8
  REPO_POSTFIX = (SOURCE == :path) ? '' : '.git'
9
9
  DATAMAPPER = (SOURCE == :path) ? Pathname(__FILE__).dirname.parent : 'https://github.com/firespring'
10
- DM_VERSION = '~> 1.3.0'.freeze
10
+ DM_VERSION = '~> 1.3'.freeze
11
11
  DO_VERSION = '~> 0.11.0'.freeze
12
12
  CURRENT_BRANCH = ENV.fetch('GIT_BRANCH', 'master')
13
13
 
@@ -16,6 +16,6 @@ Gem::Specification.new do |gem|
16
16
  gem.version = DataMapper::DoAdapter::VERSION
17
17
  gem.required_ruby_version = '>= 2.7.8'
18
18
 
19
- gem.add_runtime_dependency('sbf-data_objects', ['~> 0.11.0'])
20
- gem.add_runtime_dependency('sbf-dm-core', ['~> 1.3.0'])
19
+ gem.add_runtime_dependency('sbf-data_objects', ['~> 0.11'])
20
+ gem.add_runtime_dependency('sbf-dm-core', ['~> 1.3'])
21
21
  end
@@ -14,7 +14,6 @@ module DataMapper
14
14
  class DataObjectsAdapter < AbstractAdapter
15
15
  extend Chainable
16
16
  extend Deprecate
17
- include SQL
18
17
 
19
18
  SQL_FALSE = '1 = 0'.freeze
20
19
 
@@ -315,13 +314,13 @@ module DataMapper
315
314
  IDENTIFIER_MAX_LENGTH = 128
316
315
 
317
316
  # @api semipublic
318
- def self.property_to_column_name(property, qualify)
317
+ def property_to_column_name(property, qualify)
319
318
  column_name = ''
320
319
 
321
320
  case qualify
322
- when true
321
+ when true
323
322
  column_name << "#{quote_name(property.model.storage_name(name))}."
324
- when String
323
+ when String
325
324
  column_name << "#{quote_name(qualify)}."
326
325
  end
327
326
 
@@ -334,7 +333,7 @@ module DataMapper
334
333
  # should overwrite this to return true.
335
334
  #
336
335
  # @api private
337
- def self.supports_returning?
336
+ def supports_returning?
338
337
  false
339
338
  end
340
339
 
@@ -342,7 +341,7 @@ module DataMapper
342
341
  # INSERT statements should overwrite this to return false.
343
342
  #
344
343
  # @api private
345
- def self.supports_default_values?
344
+ def supports_default_values?
346
345
  true
347
346
  end
348
347
 
@@ -351,7 +350,7 @@ module DataMapper
351
350
  # @return [String] SELECT statement as a string
352
351
  #
353
352
  # @api private
354
- def self.select_statement(query)
353
+ def select_statement(query)
355
354
  qualify = query.links.any?
356
355
  fields = query.fields
357
356
  order_by = query.order
@@ -375,7 +374,7 @@ module DataMapper
375
374
 
376
375
  # default construction of LIMIT and OFFSET
377
376
  # overriden by some adapters (currently Oracle and SQL Server)
378
- def self.add_limit_offset!(statement, limit, offset, bind_values)
377
+ def add_limit_offset!(statement, limit, offset, bind_values)
379
378
  if limit
380
379
  statement << ' LIMIT ?'
381
380
  bind_values << limit
@@ -392,7 +391,7 @@ module DataMapper
392
391
  # @return [String] INSERT statement as a string
393
392
  #
394
393
  # @api private
395
- def self.insert_statement(model, properties, serial)
394
+ def insert_statement(model, properties, serial)
396
395
  statement = "INSERT INTO #{quote_name(model.storage_name(name))} "
397
396
 
398
397
  if supports_default_values? && properties.empty?
@@ -414,13 +413,13 @@ module DataMapper
414
413
 
415
414
  # by default PostgreSQL syntax
416
415
  # overrided in Oracle adapter
417
- def self.default_values_clause
416
+ def default_values_clause
418
417
  'DEFAULT VALUES'
419
418
  end
420
419
 
421
420
  # by default PostgreSQL syntax
422
421
  # overrided in Oracle adapter
423
- def self.returning_clause(serial)
422
+ def returning_clause(serial)
424
423
  " RETURNING #{quote_name(serial.field)}"
425
424
  end
426
425
 
@@ -429,7 +428,7 @@ module DataMapper
429
428
  # @return [String] UPDATE statement as a string
430
429
  #
431
430
  # @api private
432
- def self.update_statement(properties, query)
431
+ def update_statement(properties, query)
433
432
  model = query.model
434
433
  name = self.name
435
434
 
@@ -452,7 +451,7 @@ module DataMapper
452
451
  # @return [String] DELETE statement as a string
453
452
  #
454
453
  # @api private
455
- def self.delete_statement(query)
454
+ def delete_statement(query)
456
455
  model = query.model
457
456
  name = self.name
458
457
 
@@ -475,7 +474,7 @@ module DataMapper
475
474
  # list of fields as a string
476
475
  #
477
476
  # @api private
478
- def self.columns_statement(properties, qualify)
477
+ def columns_statement(properties, qualify)
479
478
  properties.map { |property| property_to_column_name(property, qualify) }.join(', ')
480
479
  end
481
480
 
@@ -485,7 +484,7 @@ module DataMapper
485
484
  # joins clause
486
485
  #
487
486
  # @api private
488
- def self.join_statement(query, bind_values, qualify)
487
+ def join_statement(query, bind_values, qualify)
489
488
  statements = []
490
489
  join_bind_values = []
491
490
 
@@ -519,13 +518,13 @@ module DataMapper
519
518
  statements.join(' ')
520
519
  end
521
520
 
522
- def self.add_join_conditions(relationship, target_alias, source_alias, statements)
521
+ def add_join_conditions(relationship, target_alias, source_alias, statements)
523
522
  statements << relationship.target_key.zip(relationship.source_key).map do |target_property, source_property|
524
523
  "#{property_to_column_name(target_property, target_alias)} = #{property_to_column_name(source_property, source_alias)}"
525
524
  end.join(' AND ')
526
525
  end
527
526
 
528
- def self.add_extra_join_conditions(relationship, target_alias, statements, bind_values)
527
+ def add_extra_join_conditions(relationship, target_alias, statements, bind_values)
529
528
  conditions = DataMapper.repository(name).scope do
530
529
  relationship.target_model.all(relationship.query).query.conditions
531
530
  end
@@ -543,7 +542,7 @@ module DataMapper
543
542
  # where clause
544
543
  #
545
544
  # @api private
546
- def self.conditions_statement(conditions, qualify = false)
545
+ def conditions_statement(conditions, qualify = false)
547
546
  case conditions
548
547
  when Query::Conditions::NotOperation then negate_operation(conditions.operand, qualify)
549
548
  when Query::Conditions::AbstractOperation then operation_statement(conditions, qualify)
@@ -555,12 +554,12 @@ module DataMapper
555
554
  end
556
555
 
557
556
  # @api private
558
- def self.supports_subquery?(*)
557
+ def supports_subquery?(*)
559
558
  true
560
559
  end
561
560
 
562
561
  # @api private
563
- def self.subquery(query, subject, qualify)
562
+ def subquery(query, subject, qualify)
564
563
  source_key, target_key = subquery_keys(subject)
565
564
 
566
565
  if query.repository.name == name && supports_subquery?(query, source_key, target_key, qualify)
@@ -571,7 +570,7 @@ module DataMapper
571
570
  end
572
571
 
573
572
  # @api private
574
- def self.subquery_statement(query, source_key, target_key, qualify)
573
+ def subquery_statement(query, source_key, target_key, qualify)
575
574
  query = subquery_query(query, source_key)
576
575
  select_statement, bind_values = select_statement(query)
577
576
 
@@ -587,7 +586,7 @@ module DataMapper
587
586
  end
588
587
 
589
588
  # @api private
590
- def self.subquery_execute(query, source_key, target_key, qualify)
589
+ def subquery_execute(query, source_key, target_key, qualify)
591
590
  query = subquery_query(query, source_key)
592
591
  sources = query.model.all(query)
593
592
  conditions = Query.target_conditions(sources, source_key, target_key)
@@ -600,7 +599,7 @@ module DataMapper
600
599
  end
601
600
 
602
601
  # @api private
603
- def self.subquery_keys(subject)
602
+ def subquery_keys(subject)
604
603
  case subject
605
604
  when Associations::Relationship
606
605
  relationship = subject.inverse
@@ -611,7 +610,7 @@ module DataMapper
611
610
  end
612
611
 
613
612
  # @api private
614
- def self.subquery_query(query, source_key)
613
+ def subquery_query(query, source_key)
615
614
  # force unique to be false because PostgreSQL has a problem with
616
615
  # subselects that contain a GROUP BY with different columns
617
616
  # than the outer-most query
@@ -626,7 +625,7 @@ module DataMapper
626
625
  # order clause
627
626
  #
628
627
  # @api private
629
- def self.order_statement(order, qualify)
628
+ def order_statement(order, qualify)
630
629
  statements = order.map do |direction|
631
630
  statement = property_to_column_name(direction.target, qualify)
632
631
  statement << ' DESC' if direction.operator == :desc
@@ -637,14 +636,14 @@ module DataMapper
637
636
  end
638
637
 
639
638
  # @api private
640
- def self.negate_operation(operand, qualify)
639
+ def negate_operation(operand, qualify)
641
640
  statement, bind_values = conditions_statement(operand, qualify)
642
641
  statement = "NOT(#{statement})" unless statement.nil?
643
642
  [ statement, bind_values ]
644
643
  end
645
644
 
646
645
  # @api private
647
- def self.operation_statement(operation, qualify)
646
+ def operation_statement(operation, qualify)
648
647
  statements = []
649
648
  bind_values = []
650
649
 
@@ -670,7 +669,7 @@ module DataMapper
670
669
  # comparison clause
671
670
  #
672
671
  # @api private
673
- def self.comparison_statement(comparison, qualify)
672
+ def comparison_statement(comparison, qualify)
674
673
  subject = comparison.subject
675
674
  value = comparison.value
676
675
 
@@ -743,7 +742,7 @@ module DataMapper
743
742
  end
744
743
  end
745
744
 
746
- def self.comparison_operator(comparison)
745
+ def comparison_operator(comparison)
747
746
  subject = comparison.subject
748
747
  value = comparison.value
749
748
 
@@ -760,12 +759,12 @@ module DataMapper
760
759
  end
761
760
 
762
761
  # @api private
763
- def self.equality_operator(property, operand)
762
+ def equality_operator(property, operand)
764
763
  operand.nil? ? 'IS' : '='
765
764
  end
766
765
 
767
766
  # @api private
768
- def self.include_operator(property, operand)
767
+ def include_operator(property, operand)
769
768
  case operand
770
769
  when Array then 'IN'
771
770
  when Range then 'BETWEEN'
@@ -773,20 +772,24 @@ module DataMapper
773
772
  end
774
773
 
775
774
  # @api private
776
- def self.regexp_operator(operand)
775
+ def regexp_operator(operand)
777
776
  '~'
778
777
  end
779
778
 
780
779
  # @api private
781
- def self.like_operator(operand)
780
+ def like_operator(operand)
782
781
  'LIKE'
783
782
  end
784
783
 
785
784
  # @api private
786
- def self.quote_name(name)
785
+ def quote_name(name)
787
786
  "\"#{name[0, self.class::IDENTIFIER_MAX_LENGTH].gsub('"', '""')}\""
788
787
  end
788
+
789
789
  end
790
+
791
+ include SQL
792
+
790
793
  end
791
794
 
792
795
  const_added(:DataObjectsAdapter)
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
2
  module DoAdapter
3
- VERSION = '1.4.0.beta.1'
3
+ VERSION = '1.5.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbf-dm-do-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0.beta.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - opensource_firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-19 00:00:00.000000000 Z
11
+ date: 2024-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sbf-data_objects
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.11.0
19
+ version: '0.11'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.11.0
26
+ version: '0.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sbf-dm-core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3.0
33
+ version: '1.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.3.0
40
+ version: '1.3'
41
41
  description: A unified Ruby API for popular databases.
42
42
  email:
43
43
  - opensource@firespring.com
@@ -76,9 +76,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
76
  version: 2.7.8
77
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">"
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: 1.3.1
81
+ version: '0'
82
82
  requirements: []
83
83
  rubygems_version: 3.4.10
84
84
  signing_key: