Module | Sequel::MySQL
In: | lib/sequel/adapters/mysql.rb lib/sequel/adapters/shared/mysql.rb

Module for holding all MySQL-related classes and modules for Sequel.

### Methods

convert_date_time

### Classes and Modules

Module Sequel::MySQL::DatabaseMethods
Module Sequel::MySQL::DatasetMethods
Class Sequel::MySQL::Database
Class Sequel::MySQL::Dataset

### Constants

MYSQL_TYPES | = | {} |  | Mapping of type numbers to conversion procs

MYSQL_TYPE_PROCS

=

{ [0, 246] => lambda{|v| BigDecimal.new(v)}, # decimal [1] => lambda{|v| convert_tinyint_to_bool ? v.to_i != 0 : v.to_i}, # tinyint [2, 3, 8, 9, 13, 247, 248] => lambda{|v| v.to_i}, # integer [4, 5] => lambda{|v| v.to_f}, # float [10, 14] => lambda{|v| convert_date_time(:string_to_date, v)}, # date [7, 12] => lambda{|v| convert_date_time(:database_to_application_timestamp, v)}, # datetime [11] => lambda{|v| convert_date_time(:string_to_time, v)}, # time [249, 250, 251, 252] => lambda{|v| Sequel::SQL::Blob.new(v)}

Use only a single proc for each type to save on memory

### Attributes

convert_invalid_date_time | [RW] | By default, Sequel raises an exception if in invalid date or time is used. However, if this is set to nil or :nil, the adapter treats dates like 0000-00-00 and times like 838:00:00 as nil values. If set to :string, it returns the strings as is.
convert_tinyint_to_bool | [RW] | Sequel converts the column type tinyint(1) to a boolean by default when using the native MySQL adapter. You can turn off the conversion by setting this to false.
default_charset | [RW] | Set the default charset used for CREATE TABLE. You can pass the :charset option to create_table to override this setting.
default_collate | [RW] | Set the default collation used for CREATE TABLE. You can pass the :collate option to create_table to override this setting.
default_engine | [RW] | Set the default engine used for CREATE TABLE. You can pass the :engine option to create_table to override this setting.

### Public Class methods

convert_date_time(meth, v)

If convert_invalid_date_time is nil, :nil, or :string and the conversion raises an InvalidValue exception, return v if :string and nil otherwise.

[Source]

        # File lib/sequel/adapters/mysql.rb, line 50
    50:     def self.convert_date_time(meth, v)
    51:       begin
    52:         Sequel.send(meth, v)
    53:       rescue InvalidValue
    54:         case @convert_invalid_date_time
    55:         when nil, :nil
    56:           nil
    57:         when :string
    58:           v
    59:         else
    60:           raise
    61:         end
    62:       end
    63:     end

[Validate]