Module: Sequel::MySQL

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

Overview

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

Defined Under Namespace

Modules: DatabaseMethods, DatasetMethods, MysqlMysql2, 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.



37
38
39
# File 'lib/sequel/adapters/mysql.rb', line 37

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.



19
20
21
# File 'lib/sequel/adapters/shared/mysql.rb', line 19

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.



23
24
25
# File 'lib/sequel/adapters/shared/mysql.rb', line 23

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.



27
28
29
# File 'lib/sequel/adapters/shared/mysql.rb', line 27

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.



31
32
33
# File 'lib/sequel/adapters/shared/mysql.rb', line 31

def default_engine
  @default_engine
end