scenic-oracle_adapter 1.3.3 → 1.3.4

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: dc29d851c72aab3e3ff74f1a51fe0afc03f6acb9d1e4f9619027c231ad1f2729
4
- data.tar.gz: 303764a51df609bcec295a8b495a0beb0dd3575d678060a26a5d8ed5a7b61232
3
+ metadata.gz: 453bc175d2fa922a314a781064fb63a6415dc3be36aa096baa9d52c77f1542ed
4
+ data.tar.gz: 3d5ed519bc3ce673c934bc32d310b298c8d525e12fd089abf8a1201674036d4e
5
5
  SHA512:
6
- metadata.gz: 5584138f239fa8d5df30bcefa0fa6ccf25ee870c4759bf578aed41ea381d429a8ae5bf379a1103fedbe68de645e17d055f4797cb1f596e38f25e6d437edb2ae5
7
- data.tar.gz: c255d823fec8652adedb46ccd1c3638670cfdde2431ab392391fc52f0eb0b570ede4c416a77767b7ec68b0de2db0ad4a1eab301defd31f3a5a65afcb7899d3d1
6
+ metadata.gz: cb0722b1989112a9b5f48c7fdbd7b303d4fd7baf5b577dc002bcd9d174e795b120715b725ffdd72cc562f7522b09a9eea13cc8e4984dccd53d929bdea2b1b0c4
7
+ data.tar.gz: df2366ae4965f197b205f7148ecef307f17695f3c05815b17ee681bf230b53c2bb1edfc7831b854d590022422fbfc42c3ce00e526ff7d14f719ecc8399ae5ce6
data/docker-compose.yml CHANGED
@@ -11,8 +11,6 @@ services:
11
11
  build: .
12
12
  volumes:
13
13
  - .:/app
14
- environment:
15
- - TERM=dumb
16
14
  stdin_open: true
17
15
  tty: true
18
16
  depends_on:
@@ -13,13 +13,11 @@ module Scenic
13
13
  end
14
14
 
15
15
  def views
16
- all_view_objects.sort_by do |view_object|
17
- dependency_order.index(view_object.name)
18
- end
16
+ sorted_dependency_views + sorted_missing_dependency_views
19
17
  end
20
18
 
21
19
  def create_view(name, definition)
22
- execute("create view #{quote_table_name(name)} as #{definition}")
20
+ execute("create view #{quote_table_name(name)} as #{trimmed_definition(definition)}")
23
21
  end
24
22
 
25
23
  def drop_view(name)
@@ -27,7 +25,7 @@ module Scenic
27
25
  end
28
26
 
29
27
  def replace_view(name, definition)
30
- execute("create or replace view #{quote_table_name(name)} as #{definition}")
28
+ execute("create or replace view #{quote_table_name(name)} as #{trimmed_definition(definition)}")
31
29
  end
32
30
 
33
31
  def update_view(name, definition)
@@ -36,7 +34,7 @@ module Scenic
36
34
  end
37
35
 
38
36
  def create_materialized_view(name, definition, no_data: false)
39
- execute("create materialized view #{quote_table_name(name)} #{'build deferred' if no_data} as #{definition}")
37
+ execute("create materialized view #{quote_table_name(name)} #{'build deferred' if no_data} as #{trimmed_definition(definition)}")
40
38
  end
41
39
 
42
40
  def update_materialized_view(name, definition, no_data: false)
@@ -71,7 +69,7 @@ module Scenic
71
69
  private
72
70
 
73
71
  def view_dependencies
74
- select_all(<<~EOSQL)
72
+ @view_dependencies ||= select_all(<<~EOSQL)
75
73
  select lower(uo.object_name) as name, lower(ud.referenced_name) as dependency
76
74
  from user_objects uo
77
75
  left join user_dependencies ud on
@@ -88,6 +86,7 @@ module Scenic
88
86
  and ud.referenced_name in (select object_name from user_objects)
89
87
  and ud.referenced_owner = user
90
88
  where uo.object_type in ('VIEW', 'MATERIALIZED VIEW')
89
+ order by lower(uo.object_name), lower(ud.referenced_name)
91
90
  EOSQL
92
91
  end
93
92
 
@@ -102,6 +101,22 @@ module Scenic
102
101
  views_hash.tsort
103
102
  end
104
103
 
104
+ def sorted_dependency_views
105
+ all_view_objects.filter do |view|
106
+ dependency_order.include?(view.name)
107
+ end.sort_by do |view|
108
+ dependency_order.index(view.name)
109
+ end
110
+ end
111
+
112
+ def sorted_missing_dependency_views
113
+ all_view_objects.filter do |view|
114
+ dependency_order.exclude?(view.name)
115
+ end.sort_by do |view|
116
+ view.name
117
+ end
118
+ end
119
+
105
120
  def all_views
106
121
  select_all("select lower(view_name) name, text definition from user_views").map do |view|
107
122
  Scenic::View.new(name: view["name"], definition: view["definition"], materialized: false)
@@ -121,6 +136,10 @@ module Scenic
121
136
  def refresh_dependencies_for(name)
122
137
  Scenic::Adapters::Oracle::RefreshDependencies.call(name, self, connection)
123
138
  end
139
+
140
+ def trimmed_definition(sql)
141
+ sql.strip.sub(/;$/, "").strip
142
+ end
124
143
  end
125
144
  end
126
145
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Scenic
4
4
  module OracleAdapter
5
- VERSION = "1.3.3"
5
+ VERSION = "1.3.4"
6
6
  end
7
7
  end
@@ -4,7 +4,7 @@ class TSortableHash < Hash
4
4
  include TSort
5
5
 
6
6
  alias_method :tsort_each_node, :each_key
7
- def tsort_each_child(node, &)
8
- fetch(node).each(&)
7
+ def tsort_each_child(node, &block)
8
+ fetch(node).each(&block)
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scenic-oracle_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Dinger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-18 00:00:00.000000000 Z
11
+ date: 2024-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: scenic