1 /**
2 $(RED Warning:
3       This binding is out-of-date and does not allow use on non-Windows platforms. Use `etc.c.odbc.sqltypes` instead.)
4 
5  * Windows API header module
6  *
7  * Translated from MinGW Windows headers
8  *
9  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
10  * Source: $(DRUNTIMESRC core/sys/windows/_sqltypes.d)
11  */
12 
13 module core.sys.windows.sqltypes;
14 version (Windows):
15 
16 version (ANSI) {} else version = Unicode;
17 
18 /* Conversion notes:
19   It's assumed that ODBC >= 0x0300.
20 */
21 
22 import core.sys.windows.windef;
23 import core.sys.windows.basetyps; // for GUID
24 
25 alias byte SCHAR, SQLSCHAR;
26 alias int SDWORD, SLONG, SQLINTEGER;
27 alias short SWORD, SSHORT, RETCODE, SQLSMALLINT;
28 alias ULONG UDWORD;
29 alias USHORT UWORD, SQLUSMALLINT;
30 alias double SDOUBLE, LDOUBLE;
31 alias float SFLOAT;
32 alias PVOID PTR, HENV, HDBC, HSTMT, SQLPOINTER;
33 alias UCHAR SQLCHAR;
34 // #ifndef _WIN64
35 alias UDWORD SQLUINTEGER;
36 // #endif
37 
38 //static if (ODBCVER >= 0x0300) {
39 alias HANDLE SQLHANDLE;
40 alias SQLHANDLE SQLHENV, SQLHDBC, SQLHSTMT, SQLHDESC;
41 /*
42 } else {
43 alias void* SQLHENV;
44 alias void* SQLHDBC;
45 alias void* SQLHSTMT;
46 }
47 */
48 alias SQLSMALLINT SQLRETURN;
49 alias HWND SQLHWND;
50 alias ULONG BOOKMARK;
51 
52 alias SQLINTEGER SQLLEN, SQLROWOFFSET;
53 alias SQLUINTEGER SQLROWCOUNT, SQLULEN;
54 alias DWORD SQLTRANSID;
55 alias SQLUSMALLINT SQLSETPOSIROW;
56 alias wchar SQLWCHAR;
57 
58 version (Unicode) {
59     alias SQLWCHAR SQLTCHAR;
60 } else {
61     alias SQLCHAR  SQLTCHAR;
62 }
63 //static if (ODBCVER >= 0x0300) {
64 alias ubyte  SQLDATE, SQLDECIMAL;
65 alias double SQLDOUBLE, SQLFLOAT;
66 alias ubyte  SQLNUMERIC;
67 alias float  SQLREAL;
68 alias ubyte  SQLTIME, SQLTIMESTAMP, SQLVARCHAR;
69 alias long   ODBCINT64, SQLBIGINT;
70 alias ulong  SQLUBIGINT;
71 //}
72 
73 struct DATE_STRUCT {
74     SQLSMALLINT year;
75     SQLUSMALLINT month;
76     SQLUSMALLINT day;
77 }
78 
79 struct TIME_STRUCT {
80     SQLUSMALLINT hour;
81     SQLUSMALLINT minute;
82     SQLUSMALLINT second;
83 }
84 
85 struct TIMESTAMP_STRUCT {
86     SQLSMALLINT year;
87     SQLUSMALLINT month;
88     SQLUSMALLINT day;
89     SQLUSMALLINT hour;
90     SQLUSMALLINT minute;
91     SQLUSMALLINT second;
92     SQLUINTEGER fraction;
93 }
94 
95 //static if (ODBCVER >= 0x0300) {
96 alias DATE_STRUCT SQL_DATE_STRUCT;
97 alias TIME_STRUCT SQL_TIME_STRUCT;
98 alias TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT;
99 
100 enum SQLINTERVAL {
101     SQL_IS_YEAR = 1,
102     SQL_IS_MONTH,
103     SQL_IS_DAY,
104     SQL_IS_HOUR,
105     SQL_IS_MINUTE,
106     SQL_IS_SECOND,
107     SQL_IS_YEAR_TO_MONTH,
108     SQL_IS_DAY_TO_HOUR,
109     SQL_IS_DAY_TO_MINUTE,
110     SQL_IS_DAY_TO_SECOND,
111     SQL_IS_HOUR_TO_MINUTE,
112     SQL_IS_HOUR_TO_SECOND,
113     SQL_IS_MINUTE_TO_SECOND
114 }
115 
116 struct SQL_YEAR_MONTH_STRUCT {
117     SQLUINTEGER year;
118     SQLUINTEGER month;
119 }
120 
121 struct SQL_DAY_SECOND_STRUCT {
122     SQLUINTEGER day;
123     SQLUINTEGER hour;
124     SQLUINTEGER minute;
125     SQLUINTEGER second;
126     SQLUINTEGER fraction;
127 }
128 
129 struct SQL_INTERVAL_STRUCT {
130     SQLINTERVAL interval_type;
131     SQLSMALLINT interval_sign;
132     union _intval {
133         SQL_YEAR_MONTH_STRUCT year_month;
134         SQL_DAY_SECOND_STRUCT day_second;
135     }
136     _intval intval;
137 }
138 
139 enum SQL_MAX_NUMERIC_LEN = 16;
140 
141 struct SQL_NUMERIC_STRUCT {
142     SQLCHAR precision;
143     SQLSCHAR scale;
144     SQLCHAR sign;
145     SQLCHAR[SQL_MAX_NUMERIC_LEN] val;
146 }
147 // } ODBCVER >= 0x0300
148 alias GUID SQLGUID;