sequel_oracle_extensions 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sequel/oracle_extensions/schemata.rb +28 -16
- data/sequel_oracle_extensions.gemspec +61 -62
- metadata +6 -8
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
@@ -88,7 +88,7 @@ module Sequel
|
|
88
88
|
# # } }
|
89
89
|
def indexes(table, opts={})
|
90
90
|
ds, result = metadata_dataset, []
|
91
|
-
outm =
|
91
|
+
outm = sql_ident_to_sym_proc ds
|
92
92
|
schema, table = ds.schema_and_table(table).map{|k| k.to_s.send(ds.identifier_input_method) if k}
|
93
93
|
who = schema.nil? ? 'user' : 'all'
|
94
94
|
|
@@ -112,15 +112,14 @@ module Sequel
|
|
112
112
|
# Collect the indexes as a hash of subhashes, including a column list.
|
113
113
|
# As a followup, collect any additional metadata about the indexes (such as bitmap join columns).
|
114
114
|
hash, join_indexes = {}, []
|
115
|
-
p ds.sql
|
116
115
|
ds.each do |row|
|
117
|
-
key =
|
116
|
+
key = outm[row[:index_name]]
|
118
117
|
unless subhash = hash[key]
|
119
118
|
subhash = hash[key] = {
|
120
119
|
:columns=>[], :unique=>(row[:uniqueness]=='UNIQUE'), :logging=>(row[:logging]=='YES'),
|
121
120
|
:db_type=>row[:index_type], :valid=>(row[:status]=='VALID'),
|
122
121
|
:parallel=>(row[:degree]!='1' || row[:instances]!='1'),
|
123
|
-
:tablespace
|
122
|
+
:tablespace=>outm[row[:tablespace_name]], :partitioned=>(row[:partitioned]=='YES'),
|
124
123
|
:visible=>(row[:visibility]=='VISIBLE'), :compress=>(row[:compression]!='DISABLED')
|
125
124
|
}
|
126
125
|
case subhash[:db_type]; when 'BITMAP','NORMAL'
|
@@ -131,16 +130,16 @@ module Sequel
|
|
131
130
|
subhash[:join] = []
|
132
131
|
end
|
133
132
|
end
|
134
|
-
subhash[:columns] <<
|
133
|
+
subhash[:columns] << outm[row[:column_name]]
|
135
134
|
end
|
136
135
|
ds = metadata_dataset.from(:"#{who}_join_ind_columns").where(:index_name=>join_indexes)
|
137
136
|
ds = ds.where :index_owner => schema unless schema.nil?
|
138
137
|
ds.each do |row|
|
139
|
-
subhash = hash[
|
140
|
-
ref_column =
|
138
|
+
subhash = hash[outm[row[:index_name]]]
|
139
|
+
ref_column = outm[row[:outer_table_column]]
|
141
140
|
pos = subhash[:columns].index ref_column
|
142
|
-
subhash[:columns][pos] =
|
143
|
-
subhash[:join][pos] =
|
141
|
+
subhash[:columns][pos] = outm["#{row[:outer_table_name]}__#{ref_column}"]
|
142
|
+
subhash[:join][pos] = outm[row[:inner_table_column]]
|
144
143
|
end
|
145
144
|
hash
|
146
145
|
end
|
@@ -251,6 +250,19 @@ module Sequel
|
|
251
250
|
table_constraints table, 'R', options.merge(:table_name_column=>:t__table_name)
|
252
251
|
end
|
253
252
|
|
253
|
+
protected
|
254
|
+
|
255
|
+
# Type-safe (and nil safe) conversion for SQL identifers to Ruby symbols.
|
256
|
+
# Returns a proc that converts String types and passes through all other types
|
257
|
+
def sql_ident_to_sym_proc(dataset)
|
258
|
+
lambda do |k|
|
259
|
+
unless String===k then k else
|
260
|
+
k = dataset.send :output_identifier, k
|
261
|
+
String===k ? k.intern : k
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
254
266
|
private
|
255
267
|
|
256
268
|
# Overridden because Oracle has slightly different syntax.
|
@@ -341,7 +353,7 @@ module Sequel
|
|
341
353
|
# Internal helper method for introspection of table constraints.
|
342
354
|
def table_constraints(table, constraint_type, options={})
|
343
355
|
ds, result = metadata_dataset, []
|
344
|
-
outm =
|
356
|
+
outm = sql_ident_to_sym_proc ds
|
345
357
|
schema, table = ds.schema_and_table(table).map{|k| k.to_s.send(ds.identifier_input_method) if k}
|
346
358
|
x_cons = schema.nil? ? 'user_cons' : 'all_cons'
|
347
359
|
|
@@ -366,23 +378,23 @@ module Sequel
|
|
366
378
|
# Return the table constraints as a hash of subhashes, including a column list.
|
367
379
|
hash = {}
|
368
380
|
ds.each do |row|
|
369
|
-
key =
|
381
|
+
key = outm[row[:constraint_name]]
|
370
382
|
unless subhash = hash[key]
|
371
383
|
subhash = hash[key] = {
|
372
384
|
:rely=>(row[:rely]=='RELY'), :enabled=>(row[:status]=='ENABLED'),
|
373
385
|
:validated=>(row[:validated]=='VALIDATED'), :columns=>[]
|
374
386
|
}
|
375
387
|
if row.include? :r_constraint_name
|
376
|
-
subhash[:ref_constraint] =
|
388
|
+
subhash[:ref_constraint] = outm[row[:r_constraint_name]]
|
377
389
|
if options[:table_name_column]==:t__table_name
|
378
|
-
then subhash[:table] =
|
379
|
-
else subhash[:ref_table] =
|
390
|
+
then subhash[:table] = outm[row[:table_name]]
|
391
|
+
else subhash[:ref_table] = outm[row[:r_table_name]]
|
380
392
|
end
|
381
393
|
elsif row.include? :index_name
|
382
|
-
subhash[:using_index] =
|
394
|
+
subhash[:using_index] = outm[row[:index_name]]
|
383
395
|
end
|
384
396
|
end
|
385
|
-
subhash[:columns] <<
|
397
|
+
subhash[:columns] << outm[row[:column_name]]
|
386
398
|
end
|
387
399
|
hash
|
388
400
|
end
|
@@ -1,62 +1,61 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{sequel_oracle_extensions}
|
8
|
-
s.version = "0.6.
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Joe Khoobyar"]
|
12
|
-
s.date = %q{2011-08-24}
|
13
|
-
s.description = %q{Oracle extensions for Sequel, including MERGE statements, optimizer hints, and schema extensions.}
|
14
|
-
s.email = %q{joe@ankhcraft.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".rspec",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"lib/sequel/oracle_extensions.rb",
|
27
|
-
"lib/sequel/oracle_extensions/hints.rb",
|
28
|
-
"lib/sequel/oracle_extensions/merge.rb",
|
29
|
-
"lib/sequel/oracle_extensions/schemata.rb",
|
30
|
-
"lib/sequel_oracle_extensions.rb",
|
31
|
-
"sequel_oracle_extensions.gemspec",
|
32
|
-
"spec/sequel/oracle_extensions/hints_spec.rb",
|
33
|
-
"spec/sequel/oracle_extensions/merge_spec.rb",
|
34
|
-
"spec/spec_helper.rb"
|
35
|
-
]
|
36
|
-
s.homepage = %q{http://github.com/joekhoobyar/sequel_oracle_extensions}
|
37
|
-
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.
|
39
|
-
s.summary = %q{Oracle MERGE, optimizer hints, and schema extensions for Sequel}
|
40
|
-
s.test_files = [
|
41
|
-
"spec/sequel/oracle_extensions/hints_spec.rb",
|
42
|
-
"spec/sequel/oracle_extensions/merge_spec.rb",
|
43
|
-
"spec/spec_helper.rb"
|
44
|
-
]
|
45
|
-
|
46
|
-
if s.respond_to? :specification_version then
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
s.
|
52
|
-
|
53
|
-
|
54
|
-
s.add_dependency(%q<
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
s.add_dependency(%q<
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{sequel_oracle_extensions}
|
8
|
+
s.version = "0.6.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Joe Khoobyar"]
|
12
|
+
s.date = %q{2011-08-24}
|
13
|
+
s.description = %q{Oracle extensions for Sequel, including MERGE statements, optimizer hints, and schema extensions.}
|
14
|
+
s.email = %q{joe@ankhcraft.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/sequel/oracle_extensions.rb",
|
27
|
+
"lib/sequel/oracle_extensions/hints.rb",
|
28
|
+
"lib/sequel/oracle_extensions/merge.rb",
|
29
|
+
"lib/sequel/oracle_extensions/schemata.rb",
|
30
|
+
"lib/sequel_oracle_extensions.rb",
|
31
|
+
"sequel_oracle_extensions.gemspec",
|
32
|
+
"spec/sequel/oracle_extensions/hints_spec.rb",
|
33
|
+
"spec/sequel/oracle_extensions/merge_spec.rb",
|
34
|
+
"spec/spec_helper.rb"
|
35
|
+
]
|
36
|
+
s.homepage = %q{http://github.com/joekhoobyar/sequel_oracle_extensions}
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = %q{1.7.2}
|
39
|
+
s.summary = %q{Oracle MERGE, optimizer hints, and schema extensions for Sequel}
|
40
|
+
s.test_files = [
|
41
|
+
"spec/sequel/oracle_extensions/hints_spec.rb",
|
42
|
+
"spec/sequel/oracle_extensions/merge_spec.rb",
|
43
|
+
"spec/spec_helper.rb"
|
44
|
+
]
|
45
|
+
|
46
|
+
if s.respond_to? :specification_version then
|
47
|
+
s.specification_version = 3
|
48
|
+
|
49
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
+
s.add_runtime_dependency(%q<sequel>, [">= 3.25.0"])
|
51
|
+
s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<sequel>, [">= 3.25.0"])
|
54
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
55
|
+
end
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<sequel>, [">= 3.25.0"])
|
58
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0"])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel_oracle_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 5
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 1
|
10
|
+
version: 0.6.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joe Khoobyar
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-24 00:00:00
|
19
|
-
default_executable:
|
18
|
+
date: 2011-08-24 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: sequel
|
@@ -75,7 +74,6 @@ files:
|
|
75
74
|
- spec/sequel/oracle_extensions/hints_spec.rb
|
76
75
|
- spec/sequel/oracle_extensions/merge_spec.rb
|
77
76
|
- spec/spec_helper.rb
|
78
|
-
has_rdoc: true
|
79
77
|
homepage: http://github.com/joekhoobyar/sequel_oracle_extensions
|
80
78
|
licenses: []
|
81
79
|
|
@@ -105,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
103
|
requirements: []
|
106
104
|
|
107
105
|
rubyforge_project:
|
108
|
-
rubygems_version: 1.
|
106
|
+
rubygems_version: 1.7.2
|
109
107
|
signing_key:
|
110
108
|
specification_version: 3
|
111
109
|
summary: Oracle MERGE, optimizer hints, and schema extensions for Sequel
|