Class: OCI::Nosql::Models::StatementSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/nosql/models/statement_summary.rb

Overview

Information derived from parsing a NoSQL SQL statement.

Constant Summary collapse

OPERATION_ENUM =
[
  OPERATION_CREATE_TABLE = 'CREATE_TABLE'.freeze,
  OPERATION_ALTER_TABLE = 'ALTER_TABLE'.freeze,
  OPERATION_DROP_TABLE = 'DROP_TABLE'.freeze,
  OPERATION_CREATE_INDEX = 'CREATE_INDEX'.freeze,
  OPERATION_DROP_INDEX = 'DROP_INDEX'.freeze,
  OPERATION_SELECT = 'SELECT'.freeze,
  OPERATION_UPDATE = 'UPDATE'.freeze,
  OPERATION_INSERT = 'INSERT'.freeze,
  OPERATION_DELETE = 'DELETE'.freeze,
  OPERATION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ StatementSummary

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :operation (String)

    The value to assign to the #operation property

  • :table_name (String)

    The value to assign to the #table_name property

  • :index_name (String)

    The value to assign to the #index_name property

  • :is_if_exists (BOOLEAN)

    The value to assign to the #is_if_exists property

  • :is_if_not_exists (BOOLEAN)

    The value to assign to the #is_if_not_exists property

  • :syntax_error (String)

    The value to assign to the #syntax_error property



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/oci/nosql/models/statement_summary.rb', line 89

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.operation = attributes[:'operation'] if attributes[:'operation']

  self.table_name = attributes[:'tableName'] if attributes[:'tableName']

  raise 'You cannot provide both :tableName and :table_name' if attributes.key?(:'tableName') && attributes.key?(:'table_name')

  self.table_name = attributes[:'table_name'] if attributes[:'table_name']

  self.index_name = attributes[:'indexName'] if attributes[:'indexName']

  raise 'You cannot provide both :indexName and :index_name' if attributes.key?(:'indexName') && attributes.key?(:'index_name')

  self.index_name = attributes[:'index_name'] if attributes[:'index_name']

  self.is_if_exists = attributes[:'isIfExists'] unless attributes[:'isIfExists'].nil?

  raise 'You cannot provide both :isIfExists and :is_if_exists' if attributes.key?(:'isIfExists') && attributes.key?(:'is_if_exists')

  self.is_if_exists = attributes[:'is_if_exists'] unless attributes[:'is_if_exists'].nil?

  self.is_if_not_exists = attributes[:'isIfNotExists'] unless attributes[:'isIfNotExists'].nil?

  raise 'You cannot provide both :isIfNotExists and :is_if_not_exists' if attributes.key?(:'isIfNotExists') && attributes.key?(:'is_if_not_exists')

  self.is_if_not_exists = attributes[:'is_if_not_exists'] unless attributes[:'is_if_not_exists'].nil?

  self.syntax_error = attributes[:'syntaxError'] if attributes[:'syntaxError']

  raise 'You cannot provide both :syntaxError and :syntax_error' if attributes.key?(:'syntaxError') && attributes.key?(:'syntax_error')

  self.syntax_error = attributes[:'syntax_error'] if attributes[:'syntax_error']
end

Instance Attribute Details

#index_nameString

The index name from the SQL statement, if present.

Returns:

  • (String)


35
36
37
# File 'lib/oci/nosql/models/statement_summary.rb', line 35

def index_name
  @index_name
end

#is_if_existsBOOLEAN

True if the statement includes "IF EXISTS."

Returns:

  • (BOOLEAN)


39
40
41
# File 'lib/oci/nosql/models/statement_summary.rb', line 39

def is_if_exists
  @is_if_exists
end

#is_if_not_existsBOOLEAN

True if the statement includes "IF NOT EXISTS."

Returns:

  • (BOOLEAN)


43
44
45
# File 'lib/oci/nosql/models/statement_summary.rb', line 43

def is_if_not_exists
  @is_if_not_exists
end

#operationString

The operation represented in the statement, e.g. CREATE_TABLE.

Returns:

  • (String)


27
28
29
# File 'lib/oci/nosql/models/statement_summary.rb', line 27

def operation
  @operation
end

#syntax_errorString

If present, indicates a syntax error in the statement.

Returns:

  • (String)


47
48
49
# File 'lib/oci/nosql/models/statement_summary.rb', line 47

def syntax_error
  @syntax_error
end

#table_nameString

The table name from the SQL statement.

Returns:

  • (String)


31
32
33
# File 'lib/oci/nosql/models/statement_summary.rb', line 31

def table_name
  @table_name
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/oci/nosql/models/statement_summary.rb', line 50

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'operation': :'operation',
    'table_name': :'tableName',
    'index_name': :'indexName',
    'is_if_exists': :'isIfExists',
    'is_if_not_exists': :'isIfNotExists',
    'syntax_error': :'syntaxError'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/oci/nosql/models/statement_summary.rb', line 64

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'operation': :'String',
    'table_name': :'String',
    'index_name': :'String',
    'is_if_exists': :'BOOLEAN',
    'is_if_not_exists': :'BOOLEAN',
    'syntax_error': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



148
149
150
151
152
153
154
155
156
157
158
# File 'lib/oci/nosql/models/statement_summary.rb', line 148

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    operation == other.operation &&
    table_name == other.table_name &&
    index_name == other.index_name &&
    is_if_exists == other.is_if_exists &&
    is_if_not_exists == other.is_if_not_exists &&
    syntax_error == other.syntax_error
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/oci/nosql/models/statement_summary.rb', line 183

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


163
164
165
# File 'lib/oci/nosql/models/statement_summary.rb', line 163

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



172
173
174
# File 'lib/oci/nosql/models/statement_summary.rb', line 172

def hash
  [operation, table_name, index_name, is_if_exists, is_if_not_exists, syntax_error].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



216
217
218
219
220
221
222
223
224
225
# File 'lib/oci/nosql/models/statement_summary.rb', line 216

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



210
211
212
# File 'lib/oci/nosql/models/statement_summary.rb', line 210

def to_s
  to_hash.to_s
end