Module: Sequel::MySQL

Defined in:
lib/sequel/adapters/mysql.rb,
lib/sequel/adapters/shared/mysql.rb,
lib/sequel/adapters/shared/mysql_prepared_statements.rb

Overview

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

Defined Under Namespace

Modules: DatabaseMethods, DatasetMethods, PreparedStatements Classes: Database, Dataset

Constant Summary collapse

TYPE_TRANSLATOR =
tt = Class.new do
  def boolean(s) s.to_i != 0 end
  def integer(s) s.to_i end
  def float(s) s.to_f end
end.new
MYSQL_TYPES =

Hash with integer keys and callable values for converting MySQL types.

{}

Class Attribute Summary collapse

Class Attribute Details

.convert_invalid_date_timeObject

Whether to convert invalid date time values by default.

Only applies to Sequel::Database instances created after this has been set.



35
36
37
# File 'lib/sequel/adapters/mysql.rb', line 35

def convert_invalid_date_time
  @convert_invalid_date_time
end

.convert_tinyint_to_boolObject

Sequel converts the column type tinyint(1) to a boolean by default when using the native MySQL or Mysql2 adapter. You can turn off the conversion by setting this to false. This setting is ignored when connecting to MySQL via the do or jdbc adapters, both of which automatically do the conversion.



17
18
19
# File 'lib/sequel/adapters/shared/mysql.rb', line 17

def convert_tinyint_to_bool
  @convert_tinyint_to_bool
end

.default_charsetObject

Set the default charset used for CREATE TABLE. You can pass the :charset option to create_table to override this setting.



21
22
23
# File 'lib/sequel/adapters/shared/mysql.rb', line 21

def default_charset
  @default_charset
end

.default_collateObject

Set the default collation used for CREATE TABLE. You can pass the :collate option to create_table to override this setting.



25
26
27
# File 'lib/sequel/adapters/shared/mysql.rb', line 25

def default_collate
  @default_collate
end

.default_engineObject

Set the default engine used for CREATE TABLE. You can pass the :engine option to create_table to override this setting.



29
30
31
# File 'lib/sequel/adapters/shared/mysql.rb', line 29

def default_engine
  @default_engine
end