itds 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,18 +13,38 @@ module Itds
13
13
  timeout: 5,
14
14
  }
15
15
 
16
+ # The default connection settings according to:
17
+ # http://stackoverflow.com/questions/9235527/incorrect-set-options-error-when-building-database-project
18
+ DEFAULT_CONN_SETTINGS = {
19
+ 'ANSI_NULLS' => 'ON',
20
+ 'ANSI_PADDING' => 'ON',
21
+ 'ANSI_WARNINGS' => 'ON',
22
+ 'ARITHABORT' => 'ON',
23
+ 'CONCAT_NULL_YIELDS_NULL' => 'ON',
24
+ 'NUMERIC_ROUNDABORT' => 'OFF',
25
+ 'QUOTED_IDENTIFIER' => 'ON'
26
+ }
27
+
16
28
  def initialize(opts={})
17
29
  opts = DEFAULT_OPTS.merge(opts)
18
30
  opts[:azure] = true if(opts[:database])
19
31
  opts[:login_timeout] = opts[:timeout]
20
32
 
21
33
  @backend = new_backend(opts)
34
+ init_env
35
+ @backend
22
36
  end
23
37
 
24
38
  def new_backend(opts)
25
39
  TinyTds::Client.new(opts)
26
40
  end
27
41
 
42
+ def init_env
43
+ DEFAULT_CONN_SETTINGS.each do |k,v|
44
+ @backend.execute("SET #{k} #{v}")
45
+ end
46
+ end
47
+
28
48
  def execute(sql)
29
49
  res = @backend.execute(sql)
30
50
  res
@@ -1,3 +1,3 @@
1
1
  module Itds
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -14,8 +14,8 @@ module Itds
14
14
  )
15
15
  end
16
16
 
17
- sleep(timeout + 1)
18
- t.alive?.should be_false
17
+ sleep(timeout + 2)
18
+ expect(t.alive?).to eq(false)
19
19
  end
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-31 00:00:00.000000000 Z
12
+ date: 2014-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tiny_tds