NAME
DBIO::MSSQL::Test::Conformance - Answers the shared conformance case table for the SQL Server driver
VERSION
version 0.900007
SYNOPSIS
use DBIO::MSSQL::Test::Conformance;
DBIO::MSSQL::Test::Conformance->run('DDL');
done_testing;
DESCRIPTION
The driver's half of the shared case table of DBIO::Test::Conformance (core ADR 0060). Core owns the cases and the runner; this class says how to reach a SQL Server, how to install a declaration into it through $schema->deploy (DBIO::MSSQL::Deploy), and how to read a fact back through DBIO::MSSQL::Introspect.
The server. DBIO_TEST_MSSQL_ODBC_DSN, _USER and _PASS (DBD::ODBC, the default access path) are preferred; without them DBIO_TEST_MSSQL_DSN, _USER and _PASS (DBD::Sybase) are used. Without either, or without the DBD, only the declarations are checked. The login needs CREATE DATABASE: "diff" in DBIO::MSSQL::Deploy builds its target in a throwaway database, and so does every case here.
The namespace of a case is a database of its own, dbio_cf_<pid>_<n>, not a SQL Server schema. A connection cannot be bound to a schema (the default schema belongs to the database user, not to the session), and a table written without a schema lands in dbo of the test database, where the diff would count every other table there as a DROP. A database per case keeps dbo empty. (A source named other.t, case ddl-qualified-source-name, is made in the schema other of that database, which the deploy creates.) "conformance_connect" only picks the name -- the connection has to name it -- and builds the lazy connection; "conformance_namespace" creates the database and hands back a token { name => ..., created => 1 }, and "conformance_cleanup" drops exactly what that token names. The runner calls the cleanup always, also when the namespace threw: a name that is taken already makes the namespace throw without a token, and the database that was there before the case is never dropped.
The class names no storage class and never decides the driver: the schema component MSSQL declares it, the DSN names the access path.
METHODS
conformance_live_available
True when a server is configured (see "DESCRIPTION") and its DBD loads.
conformance_connect
Picks the name of the case's database, loads the MSSQL schema component into the case's schema class and connects to that database.
conformance_quote_ident
[name], a closing bracket doubled -- the rule of the default, written without asking the storage. The runner resolves the definition of a view before the database of the case exists ("conformance_namespace" comes after it), and over DBD::Sybase asking the storage for its SQL maker opens the connection, which fails on use of a database that is not there yet.
conformance_namespace
Creates the database of the case, on an admin connection of its own (nothing is terminated), and returns the token { name, created } for "conformance_cleanup". A database of that name that exists already makes it throw, touching nothing and returning no token.
conformance_install
Installs the declaration with $schema->deploy.
conformance_cleanup
Disconnects, and drops the database the token names (the tables and keys go with it). Without a token nothing is dropped. Also after a failed case. The throwaway databases of a diff are the diff's own to drop; a _dbio_tmp_* database left by a crash is found by name.
conformance_diff_is_empty
True when "diff" in DBIO::MSSQL::Deploy of the installed database against the same declaration has no changes.
conformance_upgrade
Connects the target schema class (the MSSQL component loaded) to the database of the installed schema -- the DSN swapped to the database of the case, as "conformance_connect" does -- and runs "upgrade" in DBIO::MSSQL::Deploy, the public entry point, through it with allow_destructive => 1 (the cases are about what the diff does; the guard has its own cases, run through "conformance_deploy"). Returns the connected target schema; a refusal of the diff is thrown from here as it came. The cleanup of that schema closes its own connection and drops nothing: the database belongs to the namespace of the first schema.
conformance_deploy
The deploy object over the target schema, for the deploy cases of the Diff list (table version 4): the target class is connected to the database of the installed one exactly as "conformance_upgrade" connects it. Returns DBIO::MSSQL::Deploy->new(schema => $to); the runner calls apply and upgrade on it.
conformance_answered_through
The table versions the answers were written against, per area: { DDL => 2, Diff => 4, Bind => 1 }, each list as it stands (version 2 of the Diff list splits U13 into diff-constraint-changed and diff-fk-action-changed, both answered right). All cases are answered, right or by a refusal or deviation of "conformance_refusals". DDL has 20 cases: 17 right (ddl-qualified-source-name: the table is made in its schema), two refused (ddl-enum-value-apostrophe, ddl-type-size-bit) and one declared deviation (ddl-default-digit-string).
Version 3 of the Diff list replaces diff-column-dropped-with-index by diff-indexed-column-dropped; it runs.
conformance_refusals
DDL list: two refusals, the engine cannot hold what the case asks for, and one deviation, the server's behaviour taken as it is. Diff list: diff-column-added-not-null-populated and diff-not-null-over-nulls are server refusals (a NOT NULL column without a default cannot be added to a table with rows, Msg 4901; a column cannot become NOT NULL over a NULL, Msg 515; "_refuse_unfillable" in DBIO::MSSQL::Deploy says so before the server is asked) (diff-default-removed is answered right: the diff drops the default constraint; the three view cases too: the diff creates, replaces and drops views). Bind list: one deviation, bind-empty-string (the server stores '' as 0 in an integer column instead of rejecting it); bind-non-ascii is answered right over DBD::ODBC (it reads back characters, odbc_utf8_on) and is a refusal over DBD::Sybase. The DDL ones:
- ddl-enum-value-apostrophe (server)
-
SQL Server has no enum type.
install_ddlthrows, naming table, column and type, instead of writingenumfor the server to refuse ("Cannot find data type enum"). The way out is avarcharcolumn with a CHECK constraint. - ddl-type-size-bit (server)
-
The case declares
bit(8). Abithas no length in SQL Server, so a size on it is refused byinstall_ddl, naming table, column and size. (The sibling caseddl-type-size-char,character(10), is answered right: the column keeps its length asnchar(10), offline in t/91.) - ddl-default-digit-string
-
A
char(5)pads the default'007'with blanks, so it reads back as'007 '. The default itself is written as the string it is (DBIO::MSSQL::DDL), not as the number 7; the padding is the type's.
conformance_fact
Reads one fact through DBIO::MSSQL::Introspect (schema dbo of the case's database); the vocabulary is the one of "Facts" in DBIO::Test::Conformance.
SEE ALSO
DBIO::Test::Conformance - the runner and the contract of the seams
DBIO::Test::Conformance::Cases::DDL - the DDL case list
DBIO::MSSQL::Deploy - install and diff, as the cases reach them
DBIO::MSSQL::Introspect - what the facts are read through
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.