itds 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/itds/client.rb +20 -0
- data/lib/itds/version.rb +1 -1
- data/spec/itds/client_spec.rb +2 -2
- metadata +2 -2
data/lib/itds/client.rb
CHANGED
@@ -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
|
data/lib/itds/version.rb
CHANGED
data/spec/itds/client_spec.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tiny_tds
|