vertica 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/vertica/error.rb +10 -6
- data/lib/vertica/query.rb +1 -1
- data/test/functional/connection_test.rb +9 -10
- metadata +13 -13
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.1
|
data/lib/vertica/error.rb
CHANGED
@@ -8,16 +8,20 @@ class Vertica::Error < StandardError
|
|
8
8
|
|
9
9
|
class QueryError < Vertica::Error
|
10
10
|
|
11
|
-
attr_reader :error_response
|
11
|
+
attr_reader :error_response, :sql
|
12
12
|
|
13
|
-
def initialize(error_response)
|
14
|
-
@error_response = error_response
|
15
|
-
super(error_response.error_message)
|
13
|
+
def initialize(error_response, sql)
|
14
|
+
@error_response, @sql = error_response, sql
|
15
|
+
super("#{error_response.error_message}, SQL: #{one_line_sql.inspect}" )
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def one_line_sql
|
19
|
+
@sql.gsub(/[\r\n]+/, ' ')
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.from_error_response(error_response, sql)
|
19
23
|
klass = QUERY_ERROR_CLASSES[error_response.sqlstate] || self
|
20
|
-
klass.new(error_response)
|
24
|
+
klass.new(error_response, sql)
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
data/lib/vertica/query.rb
CHANGED
@@ -18,7 +18,7 @@ class Vertica::Query
|
|
18
18
|
begin
|
19
19
|
case message = @connection.read_message
|
20
20
|
when Vertica::Messages::ErrorResponse
|
21
|
-
error = Vertica::Error::QueryError.from_error_response(message)
|
21
|
+
error = Vertica::Error::QueryError.from_error_response(message, @sql)
|
22
22
|
when Vertica::Messages::EmptyQueryResponse
|
23
23
|
error = Vertica::Error::EmptyQueryError.new("A SQL string was expected, but the given string was blank or only contained SQL comments.")
|
24
24
|
when Vertica::Messages::CopyInResponse
|
@@ -50,17 +50,16 @@ class ConnectionTest < Test::Unit::TestCase
|
|
50
50
|
assert_nil @connection.transaction_status
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
53
|
+
def test_reset_connection
|
54
54
|
@connection = Vertica::Connection.new(TEST_CONNECTION_HASH)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
assert_nil @connection.transaction_status
|
55
|
+
original_backend_pid = @connection.backend_pid
|
56
|
+
original_backend_key = @connection.backend_key
|
57
|
+
|
58
|
+
@connection.reset_connection
|
59
|
+
|
60
|
+
assert_not_equal original_backend_pid, @connection.backend_pid
|
61
|
+
assert_not_equal original_backend_key, @connection.backend_key
|
62
|
+
assert_equal :no_transaction, @connection.transaction_status
|
64
63
|
end
|
65
64
|
|
66
65
|
def test_interrupt_connection
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vertica
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 57
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 1
|
10
|
+
version: 0.9.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeff Smick
|
@@ -17,14 +17,11 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-
|
20
|
+
date: 2012-03-01 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
|
-
|
25
|
-
name: rake
|
26
|
-
prerelease: false
|
27
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
28
25
|
none: false
|
29
26
|
requirements:
|
30
27
|
- - ">="
|
@@ -33,12 +30,12 @@ dependencies:
|
|
33
30
|
segments:
|
34
31
|
- 0
|
35
32
|
version: "0"
|
36
|
-
|
37
|
-
- !ruby/object:Gem::Dependency
|
33
|
+
name: rake
|
38
34
|
type: :runtime
|
39
|
-
name: jeweler
|
40
35
|
prerelease: false
|
41
|
-
version_requirements:
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
40
|
requirements:
|
44
41
|
- - ">="
|
@@ -47,7 +44,10 @@ dependencies:
|
|
47
44
|
segments:
|
48
45
|
- 0
|
49
46
|
version: "0"
|
50
|
-
|
47
|
+
name: jeweler
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: *id002
|
51
51
|
description: Query Vertica with ruby
|
52
52
|
email: sprsquish@gmail.com
|
53
53
|
executables: []
|