vertica 0.10.1 → 0.10.2

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.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/vertica/connection.rb +17 -15
  3. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.1
1
+ 0.10.2
@@ -18,18 +18,18 @@ class Vertica::Connection
18
18
  @options = {}
19
19
 
20
20
  options.each { |key, value| @options[key.to_s.to_sym] = value if value}
21
-
21
+
22
22
  @options[:port] ||= 5433
23
23
  @options[:read_timeout] ||= 600
24
24
 
25
25
  @row_style = @options[:row_style] ? @options[:row_style] : :hash
26
26
  boot_connection unless options[:skip_startup]
27
27
  end
28
-
28
+
29
29
  def on_notice(&block)
30
30
  @notice_handler = block
31
31
  end
32
-
32
+
33
33
  def socket
34
34
  @socket ||= begin
35
35
  raw_socket = TCPSocket.new(@options[:host], @options[:port].to_i)
@@ -44,7 +44,7 @@ class Vertica::Connection
44
44
  raise Vertica::Error::SSLNotSupported.new("SSL requested but server doesn't support it.")
45
45
  end
46
46
  end
47
-
47
+
48
48
  raw_socket
49
49
  end
50
50
  end
@@ -96,12 +96,12 @@ class Vertica::Connection
96
96
  close
97
97
  boot_connection
98
98
  end
99
-
99
+
100
100
  def boot_connection
101
101
  startup_connection
102
102
  initialize_connection
103
103
  end
104
-
104
+
105
105
  def cancel
106
106
  conn = self.class.new(options.merge(:skip_startup => true))
107
107
  conn.write Vertica::Messages::CancelRequest.new(backend_pid, backend_key)
@@ -138,7 +138,7 @@ class Vertica::Connection
138
138
  close_socket
139
139
  raise Vertica::Error::ConnectionError.new(e.message)
140
140
  end
141
-
141
+
142
142
  def process_message(message)
143
143
  case message
144
144
  when Vertica::Messages::ErrorResponse
@@ -157,13 +157,13 @@ class Vertica::Connection
157
157
  raise Vertica::Error::MessageError, "Unhandled message: #{message.inspect}"
158
158
  end
159
159
  end
160
-
160
+
161
161
  def query(sql, options = {}, &block)
162
162
  job = Vertica::Query.new(self, sql, { :row_style => @row_style }.merge(options))
163
163
  job.row_handler = block if block_given?
164
164
  run_with_job_lock(job)
165
165
  end
166
-
166
+
167
167
  def copy(sql, source = nil, &block)
168
168
  job = Vertica::Query.new(self, sql, :row_style => @row_style)
169
169
  if block_given?
@@ -180,7 +180,7 @@ class Vertica::Connection
180
180
  safe_options = @options.reject{ |name, _| name == :password }
181
181
  "#<Vertica::Connection:#{object_id} @parameters=#{@parameters.inspect} @backend_pid=#{@backend_pid}, @backend_key=#{@backend_key}, @transaction_status=#{@transaction_status}, @socket=#{@socket}, @options=#{safe_options.inspect}, @row_style=#{@row_style}>"
182
182
  end
183
-
183
+
184
184
  protected
185
185
 
186
186
  def run_with_job_lock(job)
@@ -199,7 +199,7 @@ class Vertica::Connection
199
199
  end
200
200
  end
201
201
  end
202
-
202
+
203
203
  def io_copy_handler(input, output)
204
204
  until input.eof?
205
205
  output << input.read(COPY_FROM_IO_BLOCK_SIZE)
@@ -208,14 +208,16 @@ class Vertica::Connection
208
208
 
209
209
  def read_bytes(n)
210
210
  bytes = socket.read(n)
211
- raise Vertica::Error::ConnectionError.new("Couldn't read #{n} characters from socket.") if bytes.nil? || bytes.size != n
211
+
212
+ raise Errno::EIO if bytes.nil? || bytes.size != n
213
+
212
214
  return bytes
213
215
  end
214
-
216
+
215
217
  def startup_connection
216
218
  write Vertica::Messages::Startup.new(@options[:user] || @options[:username], @options[:database])
217
219
  message = nil
218
- begin
220
+ begin
219
221
  case message = read_message
220
222
  when Vertica::Messages::Authentication
221
223
  if message.code != Vertica::Messages::Authentication::OK
@@ -226,7 +228,7 @@ class Vertica::Connection
226
228
  end
227
229
  end until message.kind_of?(Vertica::Messages::ReadyForQuery)
228
230
  end
229
-
231
+
230
232
  def initialize_connection
231
233
  query("SET SEARCH_PATH TO #{options[:search_path]}") if options[:search_path]
232
234
  query("SET ROLE #{options[:role]}") if options[:role]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vertica
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-04-12 00:00:00.000000000 Z
14
+ date: 2013-06-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -121,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  segments:
123
123
  - 0
124
- hash: 3247651382320769984
124
+ hash: -2608349904200928087
125
125
  required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  none: false
127
127
  requirements: