module Voltdb::VoltTableRowUtils

Public Instance Methods

get_long_as_boolean(column_index_or_name) click to toggle source

Get a long value from a VoltTableRow as a boolean value

@param column_index_or_name [Fixnum, String] @return [Boolean]

# File lib/voltdb/volt_table_row_utils.rb, line 8
def get_long_as_boolean(column_index_or_name)
  self.get_long(column_index_or_name) == 1
end
get_long_or_nil(column_index_or_name) click to toggle source

Get the value of the column or nil

@param column_index_or_name [Fixnum, String] @return [VoltType, Boolean]

# File lib/voltdb/volt_table_row_utils.rb, line 16
def get_long_or_nil(column_index_or_name)
  value = self.get_long(column_index_or_name)

  self.was_null? ? nil : value
end
get_timestamp_as_ruby_date(column_index_or_name) click to toggle source

Get a Ruby Date from a VoltTableRow timestamp type value

@param column_index_or_name [Fixnum, String] @return [Date]

# File lib/voltdb/volt_table_row_utils.rb, line 36
def get_timestamp_as_ruby_date(column_index_or_name)
  timestamp = get_timestamp_for_ruby(column_index_or_name)

  timestamp ? Date.parse(timestamp.to_s) : timestamp
end
get_timestamp_as_ruby_date_time(column_index_or_name) click to toggle source

Get a Ruby DateTime from a VoltTableRow timestamp type value

@param column_index_or_name [Fixnum, String] @return [DateTime]

# File lib/voltdb/volt_table_row_utils.rb, line 26
def get_timestamp_as_ruby_date_time(column_index_or_name)
  timestamp = get_timestamp_for_ruby(column_index_or_name)

  timestamp ? DateTime.parse(timestamp.to_s) : timestamp
end
get_timestamp_as_ruby_time(column_index_or_name) click to toggle source

Get a Ruby Time from a VoltTableRow timestamp type value

@param column_index_or_name [Fixnum, String] @return [Time]

# File lib/voltdb/volt_table_row_utils.rb, line 46
def get_timestamp_as_ruby_time(column_index_or_name)
  timestamp = get_timestamp_for_ruby(column_index_or_name)

  timestamp ? Time.parse(timestamp.to_s) : timestamp
end

Private Instance Methods

get_timestamp_for_ruby(column_index_or_name) click to toggle source
# File lib/voltdb/volt_table_row_utils.rb, line 54
def get_timestamp_for_ruby(column_index_or_name)
  self.get_timestamp_as_sql_timestamp(column_index_or_name)
end