fixed default driver version, sal annotation, and error messages

This commit is contained in:
Hadis-Fard 2017-09-08 10:28:01 -07:00
parent 3343d1eb18
commit fc7173df11
4 changed files with 9 additions and 12 deletions

View file

@ -397,10 +397,9 @@ pdo_error PDO_ERRORS[] = {
SQLSRV_ERROR_KEYSTORE_INVALID_VALUE,
{ IMSSP, (SQLCHAR*) "Invalid value for loading a custom keystore provider.", -77, false}
},
{
{
SQLSRV_AE_ERROR_DRIVER_NOT_INSTALLED,
{ IMSSP, (SQLCHAR*) "This extension requires Microsoft ODBC Driver 17 or higher to "
"communicate with SQL Server with ColumnEncryption attribute enabled.", -74, false }
{ IMSSP, (SQLCHAR*) "This extension requires Microsoft ODBC Driver 17 for SQL Server when ColumnEncryption attribute is enabled.", -78, false }
},
{ UINT_MAX, {} }
};

View file

@ -148,7 +148,7 @@ sqlsrv_conn* core_sqlsrv_connect( _In_ sqlsrv_context& henv_cp, _In_ sqlsrv_cont
build_connection_string_and_set_conn_attr(conn, server, uid, pwd, options_ht, valid_conn_opts, driver, conn_options TSRMLS_CC);
bool missing_driver_error = false;
if (conn->ce_option.enabled) {
r = core_odbc_connect(conn, conn_options, DRIVER_VERSION::ODBC_DRIVER_17, wconn_string, wconn_len, missing_driver_error);
r = core_odbc_connect( conn, conn_options, DRIVER_VERSION::ODBC_DRIVER_17, wconn_string, wconn_len, missing_driver_error );
CHECK_CUSTOM_ERROR(missing_driver_error, conn, SQLSRV_AE_ERROR_DRIVER_NOT_INSTALLED, get_processor_arch()) {
throw core::CoreException();
@ -227,7 +227,7 @@ sqlsrv_conn* core_sqlsrv_connect( _In_ sqlsrv_context& henv_cp, _In_ sqlsrv_cont
return return_conn;
}
SQLRETURN core_odbc_connect(_Inout_ sqlsrv_conn* conn, const std::string& conn_options, const DRIVER_VERSION odbc_version, SQLWCHAR* wconn_string, unsigned int& wconn_len, bool& missing_driver_error)
SQLRETURN core_odbc_connect(_Inout_ sqlsrv_conn* conn, _In_ const std::string& conn_options, _In_ const DRIVER_VERSION odbc_version, _Inout_ SQLWCHAR* wconn_string, _Inout_ unsigned int& wconn_len, _Inout_ bool& missing_driver_error)
{
SQLRETURN r = SQL_SUCCESS;
std::string conn_str = conn_options + CONNECTION_STRING_DRIVER_NAME[odbc_version];

View file

@ -1033,7 +1033,8 @@ enum SERVER_VERSION {
};
// supported driver versions.
enum DRIVER_VERSION : size_t {
enum DRIVER_VERSION {
ODBC_DRIVER_UNKNOWN = -1,
FIRST = 0,
ODBC_DRIVER_17 = FIRST,
ODBC_DRIVER_13 = 1,
@ -1075,7 +1076,7 @@ struct sqlsrv_conn : public sqlsrv_context {
sqlsrv_context( h, SQL_HANDLE_DBC, e, drv, encoding )
{
server_version = SERVER_VERSION_UNKNOWN;
driver_version = ODBC_DRIVER_13;
driver_version = ODBC_DRIVER_UNKNOWN;
}
// sqlsrv_conn has no destructor since its allocated using placement new, which requires that the destructor be
@ -1216,7 +1217,7 @@ sqlsrv_conn* core_sqlsrv_connect( _In_ sqlsrv_context& henv_cp, _In_ sqlsrv_cont
_Inout_z_ const char* server, _Inout_opt_z_ const char* uid, _Inout_opt_z_ const char* pwd,
_Inout_opt_ HashTable* options_ht, _In_ error_callback err, _In_ const connection_option valid_conn_opts[],
_In_ void* driver, _In_z_ const char* driver_func TSRMLS_DC );
SQLRETURN core_odbc_connect(_Inout_ sqlsrv_conn* conn, const std::string& conn_options, const DRIVER_VERSION odbc_version, SQLWCHAR* wconn_string, unsigned int& wconn_len, bool& missing_driver_error);
SQLRETURN core_odbc_connect( _Inout_ sqlsrv_conn* conn, _In_ const std::string& conn_options, _In_ const DRIVER_VERSION odbc_version, _Inout_ SQLWCHAR* wconn_string, _Inout_ unsigned int& wconn_len, _Inout_ bool& missing_driver_error);
void core_sqlsrv_close( _Inout_opt_ sqlsrv_conn* conn TSRMLS_DC );
void core_sqlsrv_prepare( _Inout_ sqlsrv_stmt* stmt, _In_reads_bytes_(sql_len) const char* sql, _In_ SQLLEN sql_len TSRMLS_DC );
void core_sqlsrv_begin_transaction( _Inout_ sqlsrv_conn* conn TSRMLS_DC );

View file

@ -394,11 +394,8 @@ ss_error SS_ERRORS[] = {
},
{
SQLSRV_AE_ERROR_DRIVER_NOT_INSTALLED,
{ IMSSP, (SQLCHAR*) "This extension requires Microsoft ODBC Driver 17 or higher to "
"communicate with SQL Server with ColumnEncryption attribute enabled.", -105, false }
{ IMSSP, (SQLCHAR*) "This extension requires Microsoft ODBC Driver 17 for SQL Server when ColumnEncryption attribute is enabled.", -105, false }
},
// terminate the list of errors/warnings
{ UINT_MAX, {} }
};