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