Class: Vertica::Protocol::Startup
- Inherits:
-
FrontendMessage
- Object
- Message
- FrontendMessage
- Vertica::Protocol::Startup
- Defined in:
- lib/vertica/protocol/frontend/startup.rb
Instance Method Summary collapse
-
#initialize(user, database, options = nil) ⇒ Startup
constructor
A new instance of Startup.
- #message_body ⇒ Object
Methods inherited from FrontendMessage
Methods inherited from Message
Constructor Details
#initialize(user, database, options = nil) ⇒ Startup
Returns a new instance of Startup.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/vertica/protocol/frontend/startup.rb', line 7 def initialize(user, database, = nil) @user = user @database = database @options = @type = "vertica-rb" @pid = Process.pid.to_s @platform = RUBY_PLATFORM @version = Vertica::VERSION @label = "#{@type}-#{@version}-#{SecureRandom.uuid}" end |
Instance Method Details
#message_body ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vertica/protocol/frontend/startup.rb', line 18 def 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 |