Class DBI::DBD::Mysql::Database
In: lib/dbd/mysql/database.rb
Parent: DBI::BaseDatabase

Models the DBI::BaseDatabase API to create DBI::DatabaseHandle objects.

Methods

Included Modules

Util

Constants

MYSQL_to_XOPEN = { "TINYINT" => [DBI::SQL_TINYINT, 1, nil], "SMALLINT" => [DBI::SQL_SMALLINT, 6, nil], "MEDIUMINT" => [DBI::SQL_SMALLINT, 6, nil], "INT" => [DBI::SQL_INTEGER, 11, nil], "INTEGER" => [DBI::SQL_INTEGER, 11, nil], "BIGINT" => [DBI::SQL_BIGINT, 25, nil], "INT24" => [DBI::SQL_BIGINT, 25, nil], "REAL" => [DBI::SQL_REAL, 12, nil], "FLOAT" => [DBI::SQL_FLOAT, 12, nil], "DECIMAL" => [DBI::SQL_DECIMAL, 12, nil], "NUMERIC" => [DBI::SQL_NUMERIC, 12, nil], "DOUBLE" => [DBI::SQL_DOUBLE, 22, nil], "CHAR" => [DBI::SQL_CHAR, 1, nil], "VARCHAR" => [DBI::SQL_VARCHAR, 255, nil], "DATE" => [DBI::SQL_DATE, 10, nil], "TIME" => [DBI::SQL_TIME, 8, nil], "TIMESTAMP" => [DBI::SQL_TIMESTAMP, 19, nil], "DATETIME" => [DBI::SQL_TIMESTAMP, 19, nil], "TINYBLOB" => [DBI::SQL_BINARY, 255, nil], "BLOB" => [DBI::SQL_VARBINARY, 65535, nil], "MEDIUMBLOB" => [DBI::SQL_VARBINARY, 16277215, nil], "LONGBLOB" => [DBI::SQL_LONGVARBINARY, 2147483657, nil], "TINYTEXT" => [DBI::SQL_VARCHAR, 255, nil], "TEXT" => [DBI::SQL_LONGVARCHAR, 65535, nil], "MEDIUMTEXT" => [DBI::SQL_LONGVARCHAR, 16277215, nil], "LONGTEXT" => [DBI::SQL_LONGVARCHAR, 2147483657, nil], "ENUM" => [DBI::SQL_CHAR, 255, nil], "SET" => [DBI::SQL_CHAR, 255, nil], "BIT" => [DBI::SQL_BIT, 8, nil], nil => [DBI::SQL_OTHER, nil, nil]   Hash to translate MySQL type names to DBI SQL type constants

Only used in mysql_type_info.

TYPE_MAP = {}   This maps type names to DBI Types.

Public Class methods

Constructor. Attributes supported:

  • AutoCommit: Commit after each executed statement. This will raise a DBI::NotSupportedError if the backend does not support transactions.

Public Instance methods

See DBI::DBD::MySQL::Database.new for supported attributes and usage.

See DBI::BaseDatabase#columns.

Extra attributes:

  • sql_type: XOPEN integer constant relating to type.
  • nullable: true if the column allows NULL as a value.
  • indexed: true if the column belongs to an index.
  • primary: true if the column is a part of a primary key.
  • unique: true if the values in this column are unique.
  • default: the default value if this column is not explicitly set.

MySQL has several backends, some of which may not support commits. If the backend this database uses doesn‘t, calling this method will raise a DBI::NotSupportedError.

See commit for information regarding transactionless database backends.

Private Instance methods

Given a type name, weans some basic information from that and returns it in a format similar to columns.

Return is an array of sqltype, type, size, and decimal. sqltype is the XOPEN type, and type is the string with the parameters removed.

size and decimal refer to precision and scale in most cases, but not always for all types. Please consult the documentation for your MySQL version.

[Validate]