Module: DBI::DBD::MSSQL

Defined in:
lib/dbd/mssql.rb,
lib/dbd/mssql/driver.rb,
lib/dbd/mssql/database.rb,
lib/dbd/mssql/statement.rb

Defined Under Namespace

Modules: Type Classes: Database, Driver, Statement

Constant Summary collapse

VERSION =
"0.3"
DESCRIPTION =
"ADO.NET Microsoft SQL Server DBI DBD"
MSSQL_TO_XOPEN =

Hash to translate MS SQL Server type names to DBI SQL type constants

Only used in #mssql_type_info.

{
        "TINYINT"          => [DBI::SQL_TINYINT, 1, nil],
        "SMALLINT"         => [DBI::SQL_SMALLINT, 2, nil],
        "INT"              => [DBI::SQL_INTEGER, 4, nil],
        "INTEGER"          => [DBI::SQL_INTEGER, 4, nil],
        "BIGINT"           => [DBI::SQL_BIGINT, 8, nil],
        "REAL"             => [DBI::SQL_REAL, 24, nil],
        "FLOAT"            => [DBI::SQL_FLOAT, 12, nil],
        "DECIMAL"          => [DBI::SQL_DECIMAL, 18, nil],
        "NUMERIC"          => [DBI::SQL_DECIMAL, 18, nil],
        "MONEY"            => [DBI::SQL_DECIMAL, 8, 4],
        "SMALLMONEY"       => [DBI::SQL_DECIMAL, 4, 4],
        "DATE"             => [DBI::SQL_DATE, 10, nil],
        "TIME"             => [DBI::SQL_TIME, 8, nil],
        "DATETIME2"        => [DBI::SQL_TIMESTAMP, 19, nil],
        "DATETIME"         => [DBI::SQL_TIMESTAMP, 19, nil],
        "CHAR"             => [DBI::SQL_CHAR, 1, nil],
        "VARCHAR"          => [DBI::SQL_VARCHAR, 255, nil],
        "NCHAR"            => [DBI::SQL_CHAR, 1, nil],
        "NVARCHAR"         => [DBI::SQL_VARCHAR, 255, nil],
        "TEXT"             => [DBI::SQL_VARCHAR, 65535, nil],
        "NTEXT"            => [DBI::SQL_VARCHAR, 131070, nil],
        "BINARY"           => [DBI::SQL_VARBINARY, 65535, nil],
        "VARBINARY"        => [DBI::SQL_VARBINARY, 16277215, nil],
        "IMAGE"            => [DBI::SQL_LONGVARBINARY, 2147483657, nil],
        "BIT"              => [DBI::SQL_BIT, 1, nil],
        "UNIQUEIDENTIFIER" => [DBI::SQL_VARCHAR, 20, nil],
        "XML"              => [DBI::SQL_VARCHAR, 65535, nil],
        "TIMESTAMP"        => [DBI::SQL_VARCHAR, 18, nil],
        nil                => [DBI::SQL_OTHER, nil, nil]
}
MSSQL_TYPEMAP =
{
        "TINYINT"          => DBI::Type::Integer,
        "SMALLINT"         => DBI::Type::Integer,
        "INT"              => DBI::Type::Integer,
        "INTEGER"          => DBI::Type::Integer,
        "BIGINT"           => DBI::Type::Integer,
        "REAL"             => DBI::Type::Float,
        "FLOAT"            => DBI::Type::Float,
        "DECIMAL"          => DBI::DBD::MSSQL::Type::Decimal,
        "NUMERIC"          => DBI::DBD::MSSQL::Type::Decimal,
        "MONEY"            => DBI::DBD::MSSQL::Type::Decimal,
        "SMALLMONEY"       => DBI::DBD::MSSQL::Type::Decimal,
        "DATE"             => DBI::DBD::MSSQL::Type::Date,
        "TIME"             => DBI::DBD::MSSQL::Type::Timestamp,
        "DATETIME2"        => DBI::DBD::MSSQL::Type::Timestamp,
        "DATETIME"         => DBI::DBD::MSSQL::Type::Timestamp,
        "CHAR"             => DBI::Type::Varchar,
        "VARCHAR"          => DBI::Type::Varchar,
        "NCHAR"            => DBI::Type::Varchar,
        "NVARCHAR"         => DBI::Type::Varchar,
        "TEXT"             => DBI::Type::Varchar,
        "NTEXT"            => DBI::Type::Varchar,
        "BINARY"           => DBI::Type::Varchar,
        "VARBINARY"        => DBI::Type::Varchar,
        "IMAGE"            => DBI::Type::Varchar,
        "BIT"              => DBI::Type::Boolean,
        "UNIQUEIDENTIFIER" => DBI::Type::Varchar,
        "XML"              => DBI::Type::Varchar,
        "TIMESTAMP"        => DBI::Type::Varchar,
        nil                => DBI::DBD::MSSQL::Type::Null,
        System::DBNull     => DBI::DBD::MSSQL::Type::Null
}
CLR_TYPES =
{
        :TINYINT => "byte",
        :SMALLINT => "short",
        :BIGINT => "long",
        :INT => "int",
        :FLOAT => "double",
        :REAL => "float",
        :SMALLMONEY => "decimal",
        :MONEY => "decimal",
        :NUMERIC => "decimal",
        :DECIMAL => "decimal",
        :BIT => "bool",
        :UNIQUEIDENTIFIER => "Guid",
        :VARCHAR => "string",
        :NVARCHAR => "string",
        :TEXT => "string",
        :NTEXT => "string",
        :CHAR => "char",
        :NCHAR => "char",
        :VARBINARY => "byte[]",
        :IMAGE => "byte[]",
        :DATETIME => "DateTime"
}
SQL_TYPE_NAMES =
{
        :BIT => "BIT",
        :TINYINT => "TINYINT",
        :SMALLINT => "SMALLINT",
        :INTEGER => "INTEGER",
        :INT => "INTEGER",
        :BIGINT => "BIGINT",
        :FLOAT => "FLOAT",
        :REAL => "REAL",
        :DOUBLE => "DOUBLE",
        :NUMERIC => "NUMERIC",
        :DECIMAL => "DECIMAL",
        :CHAR => "CHAR",
        :NCHAR => "CHAR",
        :VARCHAR => "VARCHAR",
        :NVARCHAR => "VARCHAR",
        :LONGVARCHAR => "LONG VARCHAR",
        :TEXT => "LONG VARCHAR",
        :NTEXT => "LONG VARCHAR",
        :DATE => "DATE",
        :DATETIME => "DATETIME",
        :TIME => "TIME",
        :TIMESTAMP => "TIMESTAMP",
        :BINARY => "BINARY",
        :VARBINARY => "VARBINARY",
        :LONGVARBINARY => "LONG VARBINARY",
        :IMAGE => "BLOB",
        :BLOB => "BLOB",
        :CLOB => "CLOB",
        :OTHER => "",
        :BOOLEAN => "BOOLEAN",
        :UNIQUEIDENTIFIER => "VARCHAR"
}

Class Method Summary collapse

Class Method Details

.driver_nameObject



89
90
91
# File 'lib/dbd/mssql.rb', line 89

def self.driver_name
  "mssql"
end