Module: Sequel::Mysql2
- Defined in:
- lib/sequel/adapters/mysql2.rb
Overview
Module for holding all MySQL-related classes and modules for Sequel.
Defined Under Namespace
Constant Summary collapse
- MYSQL_TYPES =
Mapping of type numbers to conversion procs
{}
- MYSQL2_LITERAL_PROC =
lambda{|v| v}
- MYSQL_TYPE_PROCS =
Use only a single proc for each type to save on memory
{ [0, 246] => MYSQL2_LITERAL_PROC, # decimal [1] => lambda{|v| ? v != 0 : v}, # tinyint [2, 3, 8, 9, 13, 247, 248] => MYSQL2_LITERAL_PROC, # integer [4, 5] => MYSQL2_LITERAL_PROC, # float [10, 14] => MYSQL2_LITERAL_PROC, # date [7, 12] => MYSQL2_LITERAL_PROC, # datetime [11] => MYSQL2_LITERAL_PROC, # time [249, 250, 251, 252] => lambda{|v| Sequel::SQL::Blob.new(v)} # blob }
Class Attribute Summary collapse
-
.convert_invalid_date_time ⇒ Object
By default, Sequel raises an exception if in invalid date or time is used.
-
.convert_tinyint_to_bool ⇒ Object
Sequel converts the column type tinyint(1) to a boolean by default when using the native MySQL adapter.
Class Attribute Details
.convert_invalid_date_time ⇒ Object
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.
36 37 38 |
# File 'lib/sequel/adapters/mysql2.rb', line 36 def convert_invalid_date_time @convert_invalid_date_time end |
.convert_tinyint_to_bool ⇒ Object
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.
41 42 43 |
# File 'lib/sequel/adapters/mysql2.rb', line 41 def @convert_tinyint_to_bool end |