forked from brianmckeen/sqitch
-
Notifications
You must be signed in to change notification settings - Fork 1
MSSQL TODO
drmuey edited this page Feb 5, 2016
·
31 revisions
- Typical engine tests for mssql.pm
-
POD for new()’s _driver attr (or do we?)we do, since its public dbd_driver() now - Determine DSN/URI logic (e.g. look at discussion in PR #6 and grep for
?how does $uri->dbi_dsn know what $self->driver to use?
) - Determine if the
this being necessary seems like a bug, no?
comment is a thing or not. - Address
# TODO: is this correct for all 3 $self->dbd_driver()?
- Should
provider()
andintegrated_security()
return a sane default (or die or ??) if its not configured (i.e. if$self->sqitch->config->get()
returns nothing)
diff --git a/lib/App/Sqitch/Engine/mssql.pm b/lib/App/Sqitch/Engine/mssql.pm
index dfb5fcd..082045a 100644
--- a/lib/App/Sqitch/Engine/mssql.pm
+++ b/lib/App/Sqitch/Engine/mssql.pm
@@ -27,7 +27,7 @@ has integrated_security => (
default => sub {
my $self = shift;
my $engine = $self->key;
- return $self->sqitch->config->get( key => "engine.$engine.integrated_security" );
+ return $self->sqitch->config->get( key => "engine.$engine.integrated_security" ) || 'SSPI'; # See registry_uri()
}
);
@@ -56,13 +56,27 @@ has registry_uri => (
my $pwd = $uri->password;
# TODO: is this correct for all 3 $self->dbd_driver()? if so: update this comment to reflect that. If not: update the code to do th
+ $uri->query_param( 'Provider', $self->provider ) if $self->provider;
+ $uri->query_param( 'Initial Catalog', $db );
+ $uri->query_param( 'Server', $host[1] );
+
if ( defined $pwd ) {
- $uri->query( "Provider=" . $self->provider . ";Initial Catalog=" . $db . ";Server=" . $host[1] . ";" );
+ $uri->query_param( "Persist Security Info", "False" );
}
- if ( not defined $pwd ) {
-
- $uri->query( "Provider=" . $self->provider . ";Integrated Security=" . $self->integrated_security . ";Initial Catalog=" . $db .
+ else {
+ # https://msdn.microsoft.com/library/ms254500(v=vs.100).aspx#Anchor_1
+ my $seckey = 'Integrated Security';
+ my $secval = $self->integrated_security;
+ if ( $self->provider =~ m/odbc/i ) {
+ $seckey = 'Trusted_Connection';
+ $secval = 'yes' if $self->integrated_security eq 'SSPI';
+ }
+ elsif ( $self->provider =~ m/oracleclient/i ) {
+ $secval = 'yes' if $self->integrated_security eq 'SSPI';
+ }
+ $uri->query_param( $seckey, $secval );
}
+
return $uri;
},
);