class Vertica::Protocol::Startup

Public Class Methods

new(user, database, options = nil) click to toggle source
# File lib/vertica/protocol/frontend/startup.rb, line 7
def initialize(user, database, options = nil)
  @user     = user
  @database = database
  @options  = options
  @type     = "vertica-rb"
  @pid      = Process.pid.to_s
  @platform = RUBY_PLATFORM
  @version  = Vertica::VERSION
  @label    = "#{@type}-#{@version}-#{SecureRandom.uuid}"
end

Public Instance Methods

message_body() click to toggle source
# File lib/vertica/protocol/frontend/startup.rb, line 18
def message_body
  str =  [Vertica::PROTOCOL_VERSION].pack('N')
  str << ["user", @user].pack('Z*Z*')         if @user
  str << ["database", @database].pack('Z*Z*') if @database
  str << ["client_type", @type].pack('Z*Z*')
  str << ["client_pid", @pid].pack('Z*Z*')
  str << ["client_os", @platform].pack('Z*Z*')
  str << ["client_version", @version].pack('Z*Z*')
  str << ["client_label", @label].pack('Z*Z*')
  str << ["options", @options].pack('Z*Z*')   if @options
  str << [].pack('x')
end