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