fixed Windows build for DB drivers
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 28 Jul 2016 09:54:14 +0000 (12:54 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 28 Jul 2016 09:54:14 +0000 (12:54 +0300)
src/db/dbdrv/db2/db2.vcproj
src/db/dbdrv/db2/db2drv.h
src/db/dbdrv/informix/informix.cpp
src/db/dbdrv/informix/informix.vcproj
src/db/dbdrv/mssql/mssql.cpp
src/db/dbdrv/mssql/mssql.vcproj
src/db/dbdrv/mysql/mysql.vcproj
src/db/dbdrv/odbc/odbc.vcproj
src/db/dbdrv/oracle/oracle.vcproj
src/db/dbdrv/pgsql/pgsql.vcproj
src/db/dbdrv/sqlite/sqlite.vcproj

index 86ccfc4..7aed028 100644 (file)
@@ -23,7 +23,7 @@
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
index 433c928..66baa39 100644 (file)
 
 /**
  * Fixes build failure
- * Allows to use SQLConnectA in unicode builds
+ * Allows to use SQLConnect and SQLSetEnvAttr in unicode builds
  */
 #undef SQLConnect
+#undef SQLSetEnvAttr
 
 /**
  * Driver connection handle structure
index 7ba5b8a..2201f95 100644 (file)
@@ -227,7 +227,7 @@ extern "C" DBDRV_CONNECTION EXPORT DrvConnect(char *host, char *login, char *pas
        SQLSMALLINT outLen;
        char connectString[1024];
        snprintf(connectString, 1024, "DSN=%s;UID=%s;PWD=%s", database, login, password);
-       iResult = SQLDriverConnect(pConn->sqlConn, NULL, (SQLCHAR *)connectString, SQL_NTS, NULL, 0, &outLen, SQL_DRIVER_NOPROMPT);
+       iResult = SQLDriverConnectA(pConn->sqlConn, NULL, (SQLCHAR *)connectString, SQL_NTS, NULL, 0, &outLen, SQL_DRIVER_NOPROMPT);
        if ((iResult != SQL_SUCCESS) && (iResult != SQL_SUCCESS_WITH_INFO))
        {
                GetSQLErrorInfo(SQL_HANDLE_DBC, pConn->sqlConn, errorText);
index 60a230f..4adfe3b 100644 (file)
@@ -23,7 +23,7 @@
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        />
                </Configuration>
                <Configuration
-                       Name="Release|Win32"
-                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-                       IntermediateDirectory="$(ConfigurationName)"
+                       Name="Debug|x64"
+                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
-                       WholeProgramOptimization="1"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        />
                        <Tool
                                Name="VCMIDLTool"
+                               TargetEnvironment="3"
                        />
                        <Tool
                                Name="VCCLCompilerTool"
+                               Optimization="0"
                                AdditionalIncludeDirectories="..\..\..\..\include"
-                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;INFORMIX_EXPORTS"
-                               RuntimeLibrary="2"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;INFORMIX_EXPORTS"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
                                UsePrecompiledHeader="0"
                                WarningLevel="3"
                                Detect64BitPortabilityProblems="true"
                                Name="VCLinkerTool"
                                AdditionalDependencies="iclit09b.lib"
                                OutputFile="$(OutDir)\$(ProjectName).ddr"
-                               LinkIncremental="1"
+                               LinkIncremental="2"
                                GenerateDebugInformation="true"
                                SubSystem="2"
-                               OptimizeReferences="2"
-                               EnableCOMDATFolding="2"
-                               TargetMachine="1"
+                               TargetMachine="17"
                        />
                        <Tool
                                Name="VCALinkTool"
                        />
                </Configuration>
                <Configuration
-                       Name="Debug|x64"
-                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
-                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+                       Name="Release|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
+                       WholeProgramOptimization="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        />
                        <Tool
                                Name="VCMIDLTool"
-                               TargetEnvironment="3"
                        />
                        <Tool
                                Name="VCCLCompilerTool"
-                               Optimization="0"
                                AdditionalIncludeDirectories="..\..\..\..\include"
-                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;INFORMIX_EXPORTS"
-                               MinimalRebuild="true"
-                               BasicRuntimeChecks="3"
-                               RuntimeLibrary="3"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;INFORMIX_EXPORTS"
+                               RuntimeLibrary="2"
                                UsePrecompiledHeader="0"
                                WarningLevel="3"
                                Detect64BitPortabilityProblems="true"
                                Name="VCLinkerTool"
                                AdditionalDependencies="iclit09b.lib"
                                OutputFile="$(OutDir)\$(ProjectName).ddr"
-                               LinkIncremental="2"
+                               LinkIncremental="1"
                                GenerateDebugInformation="true"
                                SubSystem="2"
-                               TargetMachine="17"
+                               OptimizeReferences="2"
+                               EnableCOMDATFolding="2"
+                               TargetMachine="1"
                        />
                        <Tool
                                Name="VCALinkTool"
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
index b1a1402..fc92bc5 100644 (file)
@@ -30,7 +30,7 @@ DECLARE_DRIVER_HEADER("MSSQL")
 /**
  * Selected ODBC driver
  */
-static TCHAR s_driver[SQL_MAX_DSN_LENGTH + 1] = _T("SQL Native Client");
+static char s_driver[SQL_MAX_DSN_LENGTH + 1] = "SQL Native Client";
 
 /**
  * Convert ODBC state to NetXMS database error code and get error text
@@ -179,18 +179,18 @@ extern "C" bool EXPORT DrvInit(const char *cmdLine)
 
        // Find correct driver
        // Default is "SQL Native Client", but switch to "SQL Server Native Client 10.0" if found
-       TCHAR name[SQL_MAX_DSN_LENGTH + 1], attrs[1024];
+       char name[SQL_MAX_DSN_LENGTH + 1], attrs[1024];
        SQLSMALLINT l1, l2;
-       rc = SQLDrivers(sqlEnv, SQL_FETCH_FIRST, (SQLCHAR *)name, SQL_MAX_DSN_LENGTH + 1, &l1, (SQLCHAR *)attrs, 1024, &l2);
+       rc = SQLDriversA(sqlEnv, SQL_FETCH_FIRST, (SQLCHAR *)name, SQL_MAX_DSN_LENGTH + 1, &l1, (SQLCHAR *)attrs, 1024, &l2);
        while((rc == SQL_SUCCESS) || (rc == SQL_SUCCESS_WITH_INFO))
        {
-               if (!_tcscmp(name, _T("SQL Server Native Client 10.0")) ||
-          !_tcscmp(name, _T("SQL Server Native Client 11.0")))
+               if (!strcmp(name, "SQL Server Native Client 10.0") ||
+          !strcmp(name, "SQL Server Native Client 11.0"))
                {
-                       _tcscpy(s_driver, name);
+                       strcpy(s_driver, name);
                        break;
                }
-               rc = SQLDrivers(sqlEnv, SQL_FETCH_NEXT, (SQLCHAR *)name, SQL_MAX_DSN_LENGTH + 1, &l1, (SQLCHAR *)attrs, 1024, &l2);
+               rc = SQLDriversA(sqlEnv, SQL_FETCH_NEXT, (SQLCHAR *)name, SQL_MAX_DSN_LENGTH + 1, &l1, (SQLCHAR *)attrs, 1024, &l2);
        }
 
    SQLFreeHandle(SQL_HANDLE_ENV, sqlEnv);
@@ -248,15 +248,13 @@ extern "C" DBDRV_CONNECTION EXPORT DrvConnect(const char *host, const char *logi
 
        if (!strcmp(login, "*"))
        {
-               snprintf(connectString, 1024, "DRIVER={%s};Server=%s;Trusted_Connection=yes;Database=%s;APP=NetXMS",
-                             s_driver, host, database);
+               snprintf(connectString, 1024, "DRIVER={%s};Server=%s;Trusted_Connection=yes;Database=%s;APP=NetXMS", s_driver, host, database);
        }
        else
        {
-               snprintf(connectString, 1024, "DRIVER={%s};Server=%s;UID=%s;PWD=%s;Database=%s;APP=NetXMS",
-                        s_driver, host, login, password, database);
+               snprintf(connectString, 1024, "DRIVER={%s};Server=%s;UID=%s;PWD=%s;Database=%s;APP=NetXMS", s_driver, host, login, password, database);
        }
-       iResult = SQLDriverConnect(pConn->sqlConn, NULL, (SQLCHAR *)connectString, SQL_NTS, NULL, 0, &outLen, SQL_DRIVER_NOPROMPT);
+       iResult = SQLDriverConnectA(pConn->sqlConn, NULL, (SQLCHAR *)connectString, SQL_NTS, NULL, 0, &outLen, SQL_DRIVER_NOPROMPT);
 
        if ((iResult != SQL_SUCCESS) && (iResult != SQL_SUCCESS_WITH_INFO))
        {
index 62c72ae..9a22a04 100644 (file)
@@ -23,7 +23,7 @@
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
index 91d35fd..2f4a875 100644 (file)
@@ -23,7 +23,7 @@
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
index 7db96e3..89ddf2f 100644 (file)
@@ -23,7 +23,7 @@
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
index 72981d6..3c7ce4c 100644 (file)
@@ -23,7 +23,7 @@
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
index 8404dce..4c8c19b 100644 (file)
@@ -23,7 +23,7 @@
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
index be5b167..74dd1dc 100644 (file)
@@ -23,7 +23,7 @@
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        >
                        <Tool
                                Name="VCPreBuildEventTool"
                        OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                        IntermediateDirectory="$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool
                        OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
                        IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
                        ConfigurationType="2"
-                       CharacterSet="2"
+                       CharacterSet="1"
                        WholeProgramOptimization="1"
                        >
                        <Tool