Class: Vertica::Messages::Startup

Inherits:
FrontendMessage show all
Defined in:
lib/vertica/messages/frontend_messages/startup.rb

Instance Method Summary collapse

Methods inherited from Message

message_id, #message_string

Constructor Details

#initialize(user, database, options = nil) ⇒ Startup

Returns a new instance of Startup.



7
8
9
10
11
# File 'lib/vertica/messages/frontend_messages/startup.rb', line 7

def initialize(user, database, options = nil)
  @user     = user
  @database = database
  @options  = options
end

Instance Method Details

#to_bytesObject



13
14
15
16
17
18
19
20
# File 'lib/vertica/messages/frontend_messages/startup.rb', line 13

def to_bytes
  str =  [Vertica::PROTOCOL_VERSION].pack('N')
  str << ["user", @user].pack('Z*Z*')         if @user
  str << ["database", @database].pack('Z*Z*') if @database
  str << ["options", @options].pack('Z*Z*')   if @options
  str << [].pack('x')
  message_string str
end