NAME

DBIO::MSSQL - Microsoft SQL Server-specific schema management for DBIO

VERSION

version 0.900004

SYNOPSIS

package MySchema;
use DBIO Schema => -ms;

# ... later
my $schema = MySchema->connect($dsn, $user, $pass);
# The storage is declared as DBIO::MSSQL::Storage, and at its first use
# becomes that driver's class for the DBD of the DSN:
#   dbi:ODBC:...    DBIO::MSSQL::Storage::ODBC
#   dbi:Sybase:...  DBIO::MSSQL::Storage::Sybase

DESCRIPTION

This class is the schema component that declares Microsoft SQL Server as the driver of a schema: it sets the storage class to DBIO::MSSQL::Storage when a connection is established. Load it into your schema instead of the base DBIO class when connecting to Microsoft SQL Server databases.

The -ms shortcut (see DBIO::Shortcut::ms) is the recommended way to enable the MSSQL driver: on a schema class use DBIO 'Schema', -ms; pins the storage to DBIO::MSSQL::Storage, and on a result class use DBIO 'Core', -ms; loads the DBIO::MSSQL::Result component.

DBIO::MSSQL::Storage is the class that is declared, and it is the transport-neutral base: there is no DBD::MSSQL, and SQL Server is reached through DBD::ODBC or DBD::Sybase. The storage is that class from connect until its first use; then it adapts itself to the DBD the connect info leads through ("_adapt_to_access_path" in DBIO::MSSQL::Storage) and is DBIO::MSSQL::Storage::ODBC or DBIO::MSSQL::Storage::Sybase from there on -- both are subclasses of the declared class, and the storage never becomes the class of another driver. The DBD::Sybase class needs the optional DBIO::Sybase distribution.

METHODS

connection

$schema->connection($dsn, $user, $pass, \%attrs);

Sets the storage type to DBIO::MSSQL::Storage before delegating to the parent connection method. That pin declares the driver; which of its classes the storage ends as is decided at the first use, by the DBD (see "DESCRIPTION").

SEE ALSO

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.