From 75ee4f90ad4fa37f8491da812fe7088249c54b48 Mon Sep 17 00:00:00 2001 From: yitam Date: Mon, 8 May 2017 08:57:30 -0700 Subject: [PATCH] modified sqlsrv test --- source/sqlsrv/conn.cpp | 2 +- test/sqlsrv/sqlsrv_azure_ad_authentication.phpt | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/source/sqlsrv/conn.cpp b/source/sqlsrv/conn.cpp index 9b1c336f..69c9ce10 100644 --- a/source/sqlsrv/conn.cpp +++ b/source/sqlsrv/conn.cpp @@ -1217,7 +1217,7 @@ int get_conn_option_key( sqlsrv_context& ctx, zend_string* key, size_t key_len, } bool valid = true; - if( stricmp( SS_CONN_OPTS[i].sqlsrv_name, ODBCConnOptions::Authentication ) == 0 ) { + if( stricmp( SS_CONN_OPTS[i].sqlsrv_name, SSConnOptionNames::Authentication ) == 0 ) { valid = core_is_authentication_option_valid( value, value_len ); } diff --git a/test/sqlsrv/sqlsrv_azure_ad_authentication.phpt b/test/sqlsrv/sqlsrv_azure_ad_authentication.phpt index 7f161021..246eaee8 100644 --- a/test/sqlsrv/sqlsrv_azure_ad_authentication.phpt +++ b/test/sqlsrv/sqlsrv_azure_ad_authentication.phpt @@ -6,8 +6,19 @@ Test the Authentication keyword and its accepted values: SqlPassword and ActiveD $username, "PWD"=>$password ); +$conn = sqlsrv_connect( $serverName, $connectionInfo ); +if( $conn === false ) +{ + echo "Failed to connect!\n"; + print_r( sqlsrv_errors() ); + die(); +} + +//////////////////////////////////////// + $connectionInfo = array( "UID"=>$username, "PWD"=>$password, - "Authentication"=>'SqlPassword', "TrustServerCertificate"=>true ); + "Authentication"=>"SqlPassword", "TrustServerCertificate"=>true ); $conn = sqlsrv_connect( $serverName, $connectionInfo ); if( $conn === false ) @@ -31,11 +42,12 @@ else var_dump( $first_db ); } +sqlsrv_free_stmt( $stmt ); sqlsrv_close( $conn ); //////////////////////////////////////// -$connectionInfo = array( "Authentication"=>'ActiveDirectoryIntegrated', "TrustServerCertificate"=>true ); +$connectionInfo = array( "Authentication"=>"ActiveDirectoryIntegrated", "TrustServerCertificate"=>true ); $conn = sqlsrv_connect( $serverName, $connectionInfo ); if( $conn === false )