{include,crt}: Add Microsoft OLE DB driver for SQL server
In August of 2011[1] Microsoft announced deprecation of the Microsoft
OLE DB Provider for SQL Server. But in October of 2017 Microsoft had to
undeprecate[2] OLE DB data access technology releasing the ``Microsoft
OLE DB Driver for SQL Server'' known as ``msoledbsql''.
This commit adds the ``msoledbsql'' API to mingw-w64 -- the only OLE DB
data access solution supported and maintained by Microsoft now.
To provide class and interface identifiers msoledbsql.h in this commit
uses the same technique as, for example, mingw-w64's sqloledb.h file,
i.e. it uses the `DBINITCONSTANTS` guard to define identifiers only in
one module. Original Microsoft's files (both msoledbsql.h from the new
API and sqloledb.h from Microsoft Windows 10 SDK) use
`__declspec(selectany)` to move that "burden" to the linker.
The original Microsoft's msoledbsql.h uses a Microsoft-specific
"extension", which allows Microsoft Visual C++ compiler to ignore the
following paragraph of the Standard for programming language C++:
> 10.4.1 Anonymous unions [class.union.anon]
> 1 ... Each member-declaration in the member-specification of an
> anonymous union shall either define a non-static data member or be a
> static_assert-declaration. [Note: Nested types, anonymous unions, and
> functions cannot be declared within an anonymous union. end note]
and successfully compile a code like this:
```
struct SSVARIANT
{
union
{
struct _Time2Val
{
} Time2Val;
};
};
```
GNU C++ and clang++ aren't compatible with such behavior. Moreover,
those compilers don't allow `typedef`s within anonymous unions (again
because of the [class.union.anon]). Therefore, I have to break public
API of the original header file related to the `SSVARIANT` structure
type.
Review log: https://sf.net/p/mingw-w64/mailman/mingw-w64-public/thread/
9754bd81-b475-728f-79ce-10e626757a17%40gmail.com/.
[1]: https://blogs.msdn.microsoft.com/sqlnativeclient/2011/08/29/
microsoft-is-aligning-with-odbc-for-native-relational-data-access/
[2]: https://blogs.msdn.microsoft.com/sqlnativeclient/2017/10/06/
announcing-the-new-release-of-ole-db-driver-for-sql-server/
Signed-off-by: Ruslan Garipov <ruslanngaripov@gmail.com>
Signed-off-by: Liu Hao <lh_mouse@126.com>
5 files changed