Module Sequel::MySQL
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

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

Methods

Classes and Modules

Module Sequel::MySQL::DatabaseMethods
Module Sequel::MySQL::DatasetMethods
Module Sequel::MySQL::MysqlMysql2
Module Sequel::MySQL::PreparedStatements

Constants

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

Attributes

convert_tinyint_to_bool  [RW]  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.
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

[Source]

    # File lib/sequel/adapters/shared/mysql.rb, line 14
14:     def self.mock_adapter_setup(db)
15:       db.instance_eval do
16:         @server_version = 50617
17:       end
18:     end

Public Instance methods

MySQL is different in that it supports prepared statements but not bound variables outside of prepared statements. The default implementation breaks the use of subselects in prepared statements, so extend the temporary prepared statement that this creates with a module that fixes it.

[Source]

    # File lib/sequel/adapters/utils/mysql_prepared_statements.rb, line 62
62:         def call(type, bind_arguments={}, *values, &block)
63:           ps = to_prepared_statement(type, values)
64:           ps.extend(CallableStatementMethods)
65:           ps.call(bind_arguments, &block)
66:         end

[Source]

    # File lib/sequel/adapters/mysql.rb, line 18
18:       def float(s) s.to_f end

[Source]

    # File lib/sequel/adapters/mysql.rb, line 17
17:       def integer(s) s.to_i end

Store the given type of prepared statement in the associated database with the given name.

[Source]

    # File lib/sequel/adapters/utils/mysql_prepared_statements.rb, line 70
70:         def prepare(type, name=nil, *values)
71:           ps = to_prepared_statement(type, values)
72:           ps.extend(PreparedStatementMethods)
73:           if name
74:             ps.prepared_statement_name = name
75:             db.set_prepared_statement(name, ps)
76:           end
77:           ps
78:         end

[Validate]