sc_analytics 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06117d6a47148c891d4af3938f92aa4bffefb7e5
|
4
|
+
data.tar.gz: 3faa62b4852ae7c19a4f6f2b5d9af9ff83c516af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ce36305a428e1f3588a74b2ef0d1f6436e89d8b2d9fee0431f7a44f3b5181820294c326f3601a7bc3768f6ca72584a63521757d367e6c61dc1f8352ca3e066d
|
7
|
+
data.tar.gz: 6673bc0d9c2db54470fbc30735a3d879fb2f6602f0799eaa9bd95a3d44f223fdce01def57207f14ad3cc1e62b060edb0487f397f1b43108eace7dfdcac545008
|
@@ -4,15 +4,12 @@ module SCAnalytics
|
|
4
4
|
Struct.new("QueryResult",:headers,:rows)
|
5
5
|
|
6
6
|
class Connection
|
7
|
-
attr_reader :host, :port, :
|
7
|
+
attr_reader :host, :port, :username
|
8
8
|
|
9
|
-
def initialize(connection_name,
|
9
|
+
def initialize(connection_name, config)
|
10
10
|
@connection_name = connection_name
|
11
|
-
@
|
12
|
-
@
|
13
|
-
@service = options[:connection][:service]
|
14
|
-
@username = options[:credentials][:username]
|
15
|
-
@password = options[:credentials][:password]
|
11
|
+
@username = config[:username]
|
12
|
+
@password = config[:password]
|
16
13
|
end
|
17
14
|
|
18
15
|
private
|
@@ -22,7 +19,6 @@ module SCAnalytics
|
|
22
19
|
yield
|
23
20
|
alert "Successfully connected to #{@connection_name.to_s} as user #{@username.to_s}!"
|
24
21
|
end
|
25
|
-
|
26
22
|
end
|
27
23
|
end
|
28
24
|
end
|
@@ -20,7 +20,7 @@ module SCAnalytics
|
|
20
20
|
@credentials = symbolize_keys_for @credentials
|
21
21
|
|
22
22
|
def self.connection_type(db_name)
|
23
|
-
@credentials[db_name.downcase.to_sym][:
|
23
|
+
@credentials[db_name.downcase.to_sym][:type].downcase
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.connection_details(db_name)
|
@@ -1,13 +1,20 @@
|
|
1
1
|
module SCAnalytics
|
2
2
|
module Connections
|
3
3
|
class Oracle < Connection
|
4
|
+
attr_reader :connect_string, :service_name, :sid
|
5
|
+
|
4
6
|
require 'oci8'
|
5
7
|
OCI8::BindType::Mapping[:number_unknown_prec] = OCI8::BindType::BasicNumberType
|
6
8
|
|
7
|
-
def initialize(connection_name,
|
9
|
+
def initialize(connection_name, config)
|
8
10
|
super
|
9
11
|
|
10
|
-
|
12
|
+
@host = config[:connection][:description][:address][:host]
|
13
|
+
@port = config[:connection][:description][:address][:port]
|
14
|
+
@service_name = config[:connection][:description][:connect_data][:service_name]
|
15
|
+
@sid = config[:connection][:description][:connect_data][:sid]
|
16
|
+
|
17
|
+
@connect_string = generate_connect_string_for(config[:connection])
|
11
18
|
connect
|
12
19
|
end
|
13
20
|
|
@@ -39,18 +46,18 @@ module SCAnalytics
|
|
39
46
|
|
40
47
|
def connect
|
41
48
|
super do
|
42
|
-
@client = OCI8.new @username, @password, @
|
49
|
+
@client = OCI8.new @username, @password, @connect_string
|
43
50
|
end
|
44
51
|
end
|
45
52
|
|
46
|
-
def
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
53
|
+
def generate_connect_string_for(conn_hsh, conn_str = "")
|
54
|
+
conn_hsh.each_pair do |descriptor,detail|
|
55
|
+
conn_str << "("
|
56
|
+
conn_str << "#{descriptor.to_s}="
|
57
|
+
detail.is_a?(Hash) ? conn_str = generate_connect_string_for(detail, conn_str) : conn_str << detail.to_s
|
58
|
+
conn_str << ")"
|
59
|
+
end
|
60
|
+
conn_str
|
54
61
|
end
|
55
62
|
|
56
63
|
end
|
data/lib/sc_analytics/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sc_analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Rowan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|