mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
fix #35026 fix MSSQL connection on MacOS
This commit is contained in:
parent
9c9b070d47
commit
09f84eb84b
@ -25,6 +25,7 @@
|
|||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
int QgsMssqlConnection::sConnectionId = 0;
|
int QgsMssqlConnection::sConnectionId = 0;
|
||||||
QMutex QgsMssqlConnection::sMutex{ QMutex::Recursive };
|
QMutex QgsMssqlConnection::sMutex{ QMutex::Recursive };
|
||||||
@ -97,6 +98,16 @@ QSqlDatabase QgsMssqlConnection::getDatabase( const QString &service, const QStr
|
|||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
connectionString = "driver={SQL Server}";
|
connectionString = "driver={SQL Server}";
|
||||||
|
#elif defined (Q_OS_MAC)
|
||||||
|
QString freeTDSDriver( QCoreApplication::applicationDirPath().append( "/lib/libtdsodbc.so" ) );
|
||||||
|
if ( QFile::exists( freeTDSDriver ) )
|
||||||
|
{
|
||||||
|
connectionString = QStringLiteral( "driver=%1;port=1433;TDS_Version=auto" ).arg( freeTDSDriver );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
connectionString = QStringLiteral( "driver={FreeTDS};port=1433;TDS_Version=auto" );
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
// It seems that FreeTDS driver by default uses an ancient TDS protocol version (4.2) to communicate with MS SQL
|
// It seems that FreeTDS driver by default uses an ancient TDS protocol version (4.2) to communicate with MS SQL
|
||||||
// which was causing various data corruption errors, for example:
|
// which was causing various data corruption errors, for example:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user