synopse / mORMot2

OpenSource RESTful ORM/SOA/MVC Framework for Delphi and FreePascal
https://synopse.info
Other
485 stars 122 forks source link

TSqlDBOleDBMSSQL2018ConnectionProperties should set fProviderName before calling SetInternalProperties #238

Closed tballing closed 5 months ago

tballing commented 5 months ago

I am using the TSqlDBOleDBMSSQL2018ConnectionProperties and I believe that there is a bug in SetInternalProperties. The procedure looks like this:

{ TSqlDBOleDBMSSQL2018ConnectionProperties }

procedure TSqlDBOleDBMSSQL2018ConnectionProperties.SetInternalProperties; begin inherited SetInternalProperties; fProviderName := 'MSOLEDBSQL'; end;

The procedure inherited SetInternalProperties is called before setting the fProviderName, which will result in that the base class TSqlDBOleDBMSSQLConnectionProperties, will set the fProviderName to 'SQLNCLI10'. This results in the wrong 'ConnectionString', that will uses 'SQLNCLI10' as the provider name. This connection string is generated in the base class TSqlDBOleDBConnectionProperties during SetInternalProperties.

Changing the above code to

{ TSqlDBOleDBMSSQL2018ConnectionProperties }

procedure TSqlDBOleDBMSSQL2018ConnectionProperties.SetInternalProperties; begin fProviderName := 'MSOLEDBSQL';

inherited SetInternalProperties; end;

fixes the issue with the 'ConnectionString'.

synopse commented 5 months ago

You are right.

Should be fixed now. Thanks for the report.