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