mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 00:49:46 +02:00
fix(templates): Corrected explicit template instantiations to avoid multiple instances.
This commit is contained in:
@@ -10,7 +10,8 @@ include ODBC.make
|
||||
|
||||
objects = Binder ConnectionHandle Connector EnvironmentHandle \
|
||||
Extractor ODBCException ODBCMetaColumn ODBCStatementImpl \
|
||||
Parameter Preparator SessionImpl TypeInfo Unicode Utility
|
||||
Parameter Preparator SessionImpl TypeInfo Unicode Utility \
|
||||
Diagnostics Error
|
||||
|
||||
target_includes = $(POCO_BASE)/Data/testsuite/include
|
||||
|
||||
|
||||
@@ -635,6 +635,14 @@
|
||||
RelativePath=".\src\Unicode.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Diagnostics.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Error.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Unicode_UNIXODBC.cpp"
|
||||
>
|
||||
|
||||
@@ -677,7 +677,17 @@
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Unicode_UNIXODBC.cpp">
|
||||
<ClCompile Include="src\Diagnostics.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Error.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Unicode_UNIXODBC.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">true</ExcludedFromBuild>
|
||||
|
||||
@@ -122,8 +122,14 @@
|
||||
<ClCompile Include="src\Utility.cpp">
|
||||
<Filter>ODBC\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Diagnostics.cpp">
|
||||
<Filter>ODBC\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Error.cpp">
|
||||
<Filter>ODBC\Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\DLLVersion.rc" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -969,7 +969,17 @@
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Unicode_UNIXODBC.cpp">
|
||||
<ClCompile Include="src\Diagnostics.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Error.cpp">
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Unicode_UNIXODBC.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug_shared|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">true</ExcludedFromBuild>
|
||||
@@ -1039,4 +1049,4 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -122,8 +122,14 @@
|
||||
<ClCompile Include="src\Utility.cpp">
|
||||
<Filter>ODBC\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Diagnostics.cpp">
|
||||
<Filter>ODBC\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Error.cpp">
|
||||
<Filter>ODBC\Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\DLLVersion.rc" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
@@ -243,10 +244,19 @@ private:
|
||||
|
||||
// explicit instantiation definition
|
||||
#ifndef POCO_DOC
|
||||
template class Diagnostics<SQLHENV, SQL_HANDLE_ENV>;
|
||||
template class Diagnostics<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
template class Diagnostics<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
template class Diagnostics<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
|
||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||
extern template class Diagnostics<SQLHENV, SQL_HANDLE_ENV>;
|
||||
extern template class Diagnostics<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
extern template class Diagnostics<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
extern template class Diagnostics<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#else
|
||||
extern template class ODBC_API Diagnostics<SQLHENV, SQL_HANDLE_ENV>;
|
||||
extern template class ODBC_API Diagnostics<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
extern template class ODBC_API Diagnostics<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
extern template class ODBC_API Diagnostics<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -126,12 +126,20 @@ private:
|
||||
|
||||
// explicit instantiation definition
|
||||
#ifndef POCO_DOC
|
||||
template class Error<SQLHENV, SQL_HANDLE_ENV>;
|
||||
template class Error<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
template class Error<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
template class Error<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
|
||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||
extern template class Error<SQLHENV, SQL_HANDLE_ENV>;
|
||||
extern template class Error<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
extern template class Error<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
extern template class Error<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#else
|
||||
extern template class ODBC_API Error<SQLHENV, SQL_HANDLE_ENV>;
|
||||
extern template class ODBC_API Error<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
extern template class ODBC_API Error<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
extern template class ODBC_API Error<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
using EnvironmentError = Error<SQLHENV, SQL_HANDLE_ENV>;
|
||||
using ConnectionError = Error<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
|
||||
@@ -140,10 +140,19 @@ private:
|
||||
|
||||
// explicit instantiation definition
|
||||
#ifndef POCO_DOC
|
||||
template class HandleException<SQLHENV, SQL_HANDLE_ENV>;
|
||||
template class HandleException<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
template class HandleException<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
template class HandleException<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
|
||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||
extern template class HandleException<SQLHENV, SQL_HANDLE_ENV>;
|
||||
extern template class HandleException<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
extern template class HandleException<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
extern template class HandleException<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#else
|
||||
extern template class ODBC_API HandleException<SQLHENV, SQL_HANDLE_ENV>;
|
||||
extern template class ODBC_API HandleException<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
extern template class ODBC_API HandleException<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
extern template class ODBC_API HandleException<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
40
Data/ODBC/src/Diagnostics.cpp
Normal file
40
Data/ODBC/src/Diagnostics.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// Diagnostics.cpp
|
||||
//
|
||||
// Library: Data/ODBC
|
||||
// Package: ODBC
|
||||
// Module: Diagnostics
|
||||
//
|
||||
// Copyright (c) 2025, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/Diagnostics.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
// explicit instantiation definition
|
||||
#ifndef POCO_DOC
|
||||
|
||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||
template class ODBC_API Diagnostics<SQLHENV, SQL_HANDLE_ENV>;
|
||||
template class ODBC_API Diagnostics<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
template class ODBC_API Diagnostics<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
template class ODBC_API Diagnostics<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#else
|
||||
template class Diagnostics<SQLHENV, SQL_HANDLE_ENV>;
|
||||
template class Diagnostics<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
template class Diagnostics<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
template class Diagnostics<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
40
Data/ODBC/src/Error.cpp
Normal file
40
Data/ODBC/src/Error.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// Error.cpp
|
||||
//
|
||||
// Library: Data/ODBC
|
||||
// Package: ODBC
|
||||
// Module: Error
|
||||
//
|
||||
// Copyright (c) 2025, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/Error.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
// explicit instantiation definition
|
||||
#ifndef POCO_DOC
|
||||
|
||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||
template class ODBC_API Error<SQLHENV, SQL_HANDLE_ENV>;
|
||||
template class ODBC_API Error<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
template class ODBC_API Error<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
template class ODBC_API Error<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#else
|
||||
template class Error<SQLHENV, SQL_HANDLE_ENV>;
|
||||
template class Error<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
template class Error<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
template class Error<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::ODBC
|
||||
@@ -20,6 +20,17 @@ namespace Poco {
|
||||
namespace Data {
|
||||
namespace ODBC {
|
||||
|
||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||
template class ODBC_API HandleException<SQLHENV, SQL_HANDLE_ENV>;
|
||||
template class ODBC_API HandleException<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
template class ODBC_API HandleException<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
template class ODBC_API HandleException<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#else
|
||||
template class HandleException<SQLHENV, SQL_HANDLE_ENV>;
|
||||
template class HandleException<SQLHDBC, SQL_HANDLE_DBC>;
|
||||
template class HandleException<SQLHSTMT, SQL_HANDLE_STMT>;
|
||||
template class HandleException<SQLHDESC, SQL_HANDLE_DESC>;
|
||||
#endif
|
||||
|
||||
POCO_IMPLEMENT_EXCEPTION(ODBCException, Poco::Data::DataException, "Generic ODBC error")
|
||||
POCO_IMPLEMENT_EXCEPTION(InsufficientStorageException, ODBCException, "Insufficient storage error")
|
||||
|
||||
Reference in New Issue
Block a user