libis-services 0.1.9 → 0.1.10

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
  SHA1:
3
- metadata.gz: 28b1a082cd32ba0fbc505f9c8820a9dcc73adc45
4
- data.tar.gz: ee6eceae4a7122012a0fbbb9fa1a323dc5c0eca7
3
+ metadata.gz: 5f9fe9b744e913618010de91f2b9a5fc7ef83e4b
4
+ data.tar.gz: eb5635155cef852bf7e4a83f313efe1779685d2d
5
5
  SHA512:
6
- metadata.gz: 0ed2ed0ac5362c1ae088dd290ce650c3a1d2f25f53f125c496f97a0b264e32414d93763503bc67a0bce127107f289fcafaec2d0c5a16125dba2b36eb9e4cc635
7
- data.tar.gz: 8cbae17f0c14a29e427a1796e3b29aa4bc62a3adc5eb7d9b99a03be2ab022c6dd4c4eae67e763dfa3fc0d0de9bf9a90160b253098bbf7d09d8fc119b1623f758
6
+ metadata.gz: b747e3961f4e7ff3e090c3a3b3fd88dee467f984ac0757a936e140f9f043e940aee966d717e0d63bd0d39d56e3eb0e71f593bbacefae1fc7690dbd6503f727f4
7
+ data.tar.gz: b601be79d65cd639a98dd172798096e7253a0e98beba1271a74bea7fe51ffaa107375cd1efc7f3bc7eb11ccfb9a972b4de3499fd372fa8dcf4edbd31a5c6b252
@@ -1,22 +1,42 @@
1
+ require 'oci8'
2
+
1
3
  module Libis
2
4
  module Services
3
5
 
4
6
  class OracleClient
5
7
 
8
+ attr_reader :oci
9
+
6
10
  def initialize(database, user, password)
7
11
  @database = database
8
12
  @user = user
9
13
  @password = password
14
+ @oci = OCI8.new(user, password, database)
15
+ ObjectSpace.define_finalizer( self, self.class.finalize(@oci) )
16
+ end
17
+
18
+ def self.finalize(oci)
19
+ proc { oci.logoff }
20
+ end
21
+
22
+ # @param [Boolean] value
23
+ def blocking=(value)
24
+ oci.non_blocking = !value
25
+ blocking?
26
+ end
27
+
28
+ def blocking?
29
+ !oci.non_blocking?
10
30
  end
11
31
 
12
32
  def call(procedure, parameters = [])
13
33
  params = ''
14
34
  params = "'" + parameters.join("','") + "'" if parameters and parameters.size > 0
15
- system "echo \"call #{procedure}(#{params});\" | sqlplus -S #{@user}/#{@password}@#{@database}"
35
+ oci.exec("call #{procedure}(#{params})")
16
36
  end
17
37
 
18
- def execute(sql)
19
- process_result `echo "#{sql}" | sqlplus -S #{@user}/#{@password}@#{@database}`
38
+ def execute(statement, *bindvars, &block)
39
+ oci.exec(statement, *bindvars, &block)
20
40
  end
21
41
 
22
42
  def run(script, parameters = [])
@@ -40,6 +40,8 @@ module Libis
40
40
  raise RuntimeError, "Scope search failed: '#{msg}'. Details: '#{detail}'"
41
41
  elsif File.exist? md_file
42
42
  @doc = Libis::Tools::XmlDocument.open(md_file)
43
+ File.delete(md_file) rescue nil
44
+ @doc
43
45
  else
44
46
  raise RuntimeError, 'Scope search did not generate expected result file.'
45
47
  end
@@ -1,5 +1,5 @@
1
1
  module Libis
2
2
  module Services
3
- VERSION = '0.1.9'
3
+ VERSION = '0.1.10'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser