fixed default driver version, sal annotation, and error messages
This commit is contained in:
parent
3343d1eb18
commit
fc7173df11
|
@ -397,10 +397,9 @@ pdo_error PDO_ERRORS[] = {
|
||||||
SQLSRV_ERROR_KEYSTORE_INVALID_VALUE,
|
SQLSRV_ERROR_KEYSTORE_INVALID_VALUE,
|
||||||
{ IMSSP, (SQLCHAR*) "Invalid value for loading a custom keystore provider.", -77, false}
|
{ IMSSP, (SQLCHAR*) "Invalid value for loading a custom keystore provider.", -77, false}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SQLSRV_AE_ERROR_DRIVER_NOT_INSTALLED,
|
SQLSRV_AE_ERROR_DRIVER_NOT_INSTALLED,
|
||||||
{ IMSSP, (SQLCHAR*) "This extension requires Microsoft ODBC Driver 17 or higher to "
|
{ IMSSP, (SQLCHAR*) "This extension requires Microsoft ODBC Driver 17 for SQL Server when ColumnEncryption attribute is enabled.", -78, false }
|
||||||
"communicate with SQL Server with ColumnEncryption attribute enabled.", -74, false }
|
|
||||||
},
|
},
|
||||||
{ UINT_MAX, {} }
|
{ UINT_MAX, {} }
|
||||||
};
|
};
|
||||||
|
|
|
@ -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);
|
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;
|
bool missing_driver_error = false;
|
||||||
if (conn->ce_option.enabled) {
|
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()) {
|
CHECK_CUSTOM_ERROR(missing_driver_error, conn, SQLSRV_AE_ERROR_DRIVER_NOT_INSTALLED, get_processor_arch()) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
|
@ -227,7 +227,7 @@ sqlsrv_conn* core_sqlsrv_connect( _In_ sqlsrv_context& henv_cp, _In_ sqlsrv_cont
|
||||||
return return_conn;
|
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;
|
SQLRETURN r = SQL_SUCCESS;
|
||||||
std::string conn_str = conn_options + CONNECTION_STRING_DRIVER_NAME[odbc_version];
|
std::string conn_str = conn_options + CONNECTION_STRING_DRIVER_NAME[odbc_version];
|
||||||
|
|
|
@ -1033,7 +1033,8 @@ enum SERVER_VERSION {
|
||||||
};
|
};
|
||||||
|
|
||||||
// supported driver versions.
|
// supported driver versions.
|
||||||
enum DRIVER_VERSION : size_t {
|
enum DRIVER_VERSION {
|
||||||
|
ODBC_DRIVER_UNKNOWN = -1,
|
||||||
FIRST = 0,
|
FIRST = 0,
|
||||||
ODBC_DRIVER_17 = FIRST,
|
ODBC_DRIVER_17 = FIRST,
|
||||||
ODBC_DRIVER_13 = 1,
|
ODBC_DRIVER_13 = 1,
|
||||||
|
@ -1075,7 +1076,7 @@ struct sqlsrv_conn : public sqlsrv_context {
|
||||||
sqlsrv_context( h, SQL_HANDLE_DBC, e, drv, encoding )
|
sqlsrv_context( h, SQL_HANDLE_DBC, e, drv, encoding )
|
||||||
{
|
{
|
||||||
server_version = SERVER_VERSION_UNKNOWN;
|
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
|
// 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_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[],
|
_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 );
|
_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_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_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 );
|
void core_sqlsrv_begin_transaction( _Inout_ sqlsrv_conn* conn TSRMLS_DC );
|
||||||
|
|
|
@ -394,11 +394,8 @@ ss_error SS_ERRORS[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SQLSRV_AE_ERROR_DRIVER_NOT_INSTALLED,
|
SQLSRV_AE_ERROR_DRIVER_NOT_INSTALLED,
|
||||||
{ IMSSP, (SQLCHAR*) "This extension requires Microsoft ODBC Driver 17 or higher to "
|
{ IMSSP, (SQLCHAR*) "This extension requires Microsoft ODBC Driver 17 for SQL Server when ColumnEncryption attribute is enabled.", -105, false }
|
||||||
"communicate with SQL Server with ColumnEncryption attribute enabled.", -105, false }
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// terminate the list of errors/warnings
|
// terminate the list of errors/warnings
|
||||||
{ UINT_MAX, {} }
|
{ UINT_MAX, {} }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue