mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
mssql: support windows (#10336)
This commit is contained in:
parent
0615f2e236
commit
3582118b7c
4
thirdparty/mssql/include/.gitignore
vendored
Normal file
4
thirdparty/mssql/include/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*
|
||||
|
||||
!.gitignore
|
||||
!mssql.h
|
20
thirdparty/mssql/include/mssql.h
vendored
Normal file
20
thirdparty/mssql/include/mssql.h
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// Hacking some headers in windows.
|
||||
// sql headers using UNICODE to change function signatures.
|
||||
// Currently Linux bindings do not use unicode SQL C bindings,
|
||||
// So we turn off the UNICODE to make it compile on windows.
|
||||
// For future Unicode support, please raise a issue.
|
||||
|
||||
#include <windows.h>
|
||||
#include <sal.h>
|
||||
|
||||
#ifdef UNICODE
|
||||
// Turn off unicode macro and turn back on, so it only affects sql headers
|
||||
#undef UNICODE
|
||||
#include <sql.h>
|
||||
#include <sqlext.h>
|
||||
#define UNICODE
|
||||
|
||||
#else
|
||||
#include <sql.h>
|
||||
#include <sqlext.h>
|
||||
#endif
|
@ -4,14 +4,36 @@
|
||||
|
||||
## Dependencies
|
||||
* ODBC C/C++ library
|
||||
* Linux Install: https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server
|
||||
* `msodbcsql17` and `unixodbc-dev` packages needed
|
||||
* Windows Install: https://docs.microsoft.com/en-us/sql/connect/odbc/microsoft-odbc-driver-for-sql-server
|
||||
* Linux Install:
|
||||
* Details: https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server
|
||||
* `msodbcsql17` and `unixodbc-dev` packages are needed
|
||||
* Windows Install:
|
||||
* `odbc` lib is included in windows sdk for most of distributions,
|
||||
so there is no need to install it separately
|
||||
* Details: https://docs.microsoft.com/en-us/sql/connect/odbc/microsoft-odbc-driver-for-sql-server
|
||||
|
||||
## Windows Notes
|
||||
### Using `msvc`
|
||||
* Make sure `cl.exe` of `msvc` is accessible from command line.
|
||||
You can run `v` commands in `Visual Studio 2019 Developer Command Prompt` to be safe.
|
||||
* C Headers and dlls can be automatically resolved by `msvc`.
|
||||
### Using `tcc`
|
||||
* Copy those headers to `@VEXEROOT\thirdparty\mssql\include`.
|
||||
The version number `10.0.18362.0` might differ on your system.
|
||||
Command Prompt commands:
|
||||
```cmd
|
||||
copy "C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sql.h" thirdparty\mssql\include
|
||||
copy "C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqlext.h" thirdparty\mssql\include
|
||||
copy "C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqltypes.h" thirdparty\mssql\include
|
||||
copy "C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\sqlucode.h" thirdparty\mssql\include
|
||||
copy "C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\sal.h" thirdparty\mssql\include
|
||||
copy "C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\concurrencysal.h" thirdparty\mssql\include
|
||||
```
|
||||
* dlls can be automatically resolved by `tcc`
|
||||
|
||||
## TODO
|
||||
* Support Windows
|
||||
* Support Mac
|
||||
* ORM
|
||||
* Support ORM
|
||||
|
||||
## Usage
|
||||
```v ignore
|
||||
|
@ -1,5 +1,12 @@
|
||||
module mssql
|
||||
|
||||
// TODO: implement windows
|
||||
// #flag windows -I@VEXEROOT/thirdparty/msodbcsql17
|
||||
// #flag windows @VEXEROOT/thirdparty/msodbcsql17/lib64
|
||||
// mssql module does not support tcc on windows
|
||||
|
||||
// odbc32 lib comes with windows sdk and does not need to be installed separately.
|
||||
// v builder for msvc can resolve the sdk includes search path, so no need to repeat here.
|
||||
#flag windows -lodbc32
|
||||
|
||||
// Special handling of sql headers on windows.
|
||||
// Source is in v third party folder.
|
||||
#flag windows -I@VEXEROOT/thirdparty/mssql/include
|
||||
#include <mssql.h>
|
||||
|
Loading…
Reference in New Issue
Block a user