Exception: Mysql2::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/mysql2/error.rb

Constant Summary collapse

ENCODE_OPTS =
{
  :undef => :replace,
  :invalid => :replace,
  :replace => '?'.freeze,
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, server_version = nil) ⇒ Error

Returns a new instance of Error.



19
20
21
22
23
# File 'lib/mysql2/error.rb', line 19

def initialize(msg, server_version=nil)
  self.server_version = server_version

  super(clean_message(msg))
end

Instance Attribute Details

#error_numberObject Also known as: errno

Returns the value of attribute error_number.



11
12
13
# File 'lib/mysql2/error.rb', line 11

def error_number
  @error_number
end

#server_version=(value) ⇒ Object (writeonly)

Sets the attribute server_version

Parameters:

  • value

    the value to set the attribute server_version to.



13
14
15
# File 'lib/mysql2/error.rb', line 13

def server_version=(value)
  @server_version = value
end

#sql_stateObject

Returns the value of attribute sql_state.



12
13
14
# File 'lib/mysql2/error.rb', line 12

def sql_state
  @sql_state
end