Updated list of supported processor architecture (#1290)

This commit is contained in:
Jenny Tam 2021-08-27 09:29:16 -07:00 committed by GitHub
parent fffd63f3c7
commit f66b2c3e8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 40 deletions

View file

@ -383,7 +383,7 @@ pdo_error PDO_ERRORS[] = {
},
{
SQLSRV_ERROR_CE_DRIVER_REQUIRED,
{ IMSSP, (SQLCHAR*) "The Always Encrypted feature requires Microsoft ODBC Driver 17 for SQL Server.", -78, false }
{ IMSSP, (SQLCHAR*) "The Always Encrypted feature requires Microsoft ODBC Driver 17 for SQL Server (or above) for %1!s!.", -78, true }
},
{
SQLSRV_ERROR_CONNECT_INVALID_DRIVER,

View file

@ -48,9 +48,6 @@ const int INFO_BUFFER_LEN = 256;
// length for name of keystore used in CEKeyStoreData
const int MAX_CE_NAME_LEN = 260;
// processor architectures
const char* PROCESSOR_ARCH[] = { "x86", "x64", "ia64" };
// ODBC driver names.
// the order of this list should match the order of DRIVER_VERSION enum
std::vector<std::string> CONNECTION_STRING_DRIVER_NAME{ "Driver={ODBC Driver 17 for SQL Server};", "Driver={ODBC Driver 13 for SQL Server};", "Driver={ODBC Driver 11 for SQL Server};" };
@ -917,42 +914,28 @@ void build_connection_string_and_set_conn_attr( _Inout_ sqlsrv_conn* conn, _Inou
// and return the string of the processor name.
const char* get_processor_arch( void )
{
#ifndef _WIN32
struct utsname sys_info;
if ( uname(&sys_info) == -1 )
{
DIE( "Error retrieving system info" );
}
if( strcmp(sys_info.machine, "x86") == 0 ) {
return PROCESSOR_ARCH[0];
} else if ( strcmp(sys_info.machine, "x86_64") == 0) {
return PROCESSOR_ARCH[1];
} else if ( strcmp(sys_info.machine, "ia64") == 0 ) {
return PROCESSOR_ARCH[2];
} else {
DIE( "Unknown processor architecture." );
}
return NULL;
#else
// processor architectures
const char* PROCESSOR_ARCH[] = {"x86", "x64", "arm64"};
#ifdef _WIN32
SYSTEM_INFO sys_info;
GetSystemInfo( &sys_info);
switch( sys_info.wProcessorArchitecture ) {
case PROCESSOR_ARCHITECTURE_INTEL:
return PROCESSOR_ARCH[0];
case PROCESSOR_ARCHITECTURE_AMD64:
return PROCESSOR_ARCH[1];
case PROCESSOR_ARCHITECTURE_IA64:
return PROCESSOR_ARCH[2];
default:
DIE( "Unknown Windows processor architecture." );
return NULL;
GetSystemInfo(&sys_info);
switch (sys_info.wProcessorArchitecture) {
case PROCESSOR_ARCHITECTURE_INTEL:
return PROCESSOR_ARCH[0];
case PROCESSOR_ARCHITECTURE_AMD64:
return PROCESSOR_ARCH[1];
default:
DIE("Unsupported Windows processor architecture.");
return NULL;
}
#elif defined(__arm64__)
return PROCESSOR_ARCH[2];
#elif defined(__x86_64__)
return PROCESSOR_ARCH[1];
#else
DIE("Unsupported processor architecture.");
return NULL;
#endif // !_WIN32
#endif // _WIN32
}
// some features require a server of a certain version or later

View file

@ -379,7 +379,7 @@ ss_error SS_ERRORS[] = {
},
{
SQLSRV_ERROR_CE_DRIVER_REQUIRED,
{ IMSSP, (SQLCHAR*) "The Always Encrypted feature requires Microsoft ODBC Driver 17 for SQL Server.", -105, false }
{ IMSSP, (SQLCHAR*) "The Always Encrypted feature requires Microsoft ODBC Driver 17 for SQL Server (or above) for %1!s!.", -105, true }
},
{
SQLSRV_ERROR_CONNECT_INVALID_DRIVER,

View file

@ -109,7 +109,7 @@ function testEncryptedWithODBC()
$value = "ODBC Driver 13 for SQL Server";
$connectionOptions = "Driver = $value; ColumnEncryption = Enabled;";
$expected = "The Always Encrypted feature requires Microsoft ODBC Driver 17 for SQL Server.";
$expected = "The Always Encrypted feature requires Microsoft ODBC Driver 17 for SQL Server";
connectVerifyOutput($connectionOptions, $expected);
}

View file

@ -106,7 +106,7 @@ function testEncryptedWithODBC($msodbcsqlMaj, $server, $connectionOptions)
$connectionOptions['Driver']=$value;
$connectionOptions['ColumnEncryption']='Enabled';
$expected = "The Always Encrypted feature requires Microsoft ODBC Driver 17 for SQL Server.";
$expected = "The Always Encrypted feature requires Microsoft ODBC Driver 17 for SQL Server";
connectVerifyOutput($server, $connectionOptions, $expected);
}