1 /***********************************************************************\
2 *                               sqlucode.d                              *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                                                                       *
8 *                       Placed into public domain                       *
9 \***********************************************************************/
10 module windows.sqlucode;
11 nothrow:
12 private import windows.sqlext;
13 
14 const SQL_WCHAR        = -8;
15 const SQL_WVARCHAR     = -9;
16 const SQL_WLONGVARCHAR = -10;
17 const SQL_C_WCHAR      = SQL_WCHAR;
18 
19 const SQL_SQLSTATE_SIZEW = 10;
20 version(Unicode) {
21 	const SQL_C_TCHAR = SQL_C_WCHAR;
22 } else {
23 	const SQL_C_TCHAR = SQL_C_CHAR;
24 }
25 
26 // Moved from sqlext
27 static if (ODBCVER <= 0x0300) {
28 	const SQL_UNICODE             = -95;
29 	const SQL_UNICODE_VARCHAR     = -96;
30 	const SQL_UNICODE_LONGVARCHAR = -97;
31 	const SQL_UNICODE_CHAR        = SQL_UNICODE;
32 } else {
33 	const SQL_UNICODE             = SQL_WCHAR;
34 	const SQL_UNICODE_VARCHAR     = SQL_WVARCHAR;
35 	const SQL_UNICODE_LONGVARCHAR = SQL_WLONGVARCHAR;
36 	const SQL_UNICODE_CHAR        = SQL_WCHAR;
37 }
38 
39 extern (Windows) {
40 	SQLRETURN SQLBrowseConnectA(SQLHDBC, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLSMALLINT*);
41 	SQLRETURN SQLBrowseConnectW(SQLHDBC, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*);
42 	SQLRETURN SQLColAttributeA(SQLHSTMT, SQLSMALLINT, SQLSMALLINT, SQLPOINTER, SQLSMALLINT, SQLSMALLINT*, SQLPOINTER);
43 	SQLRETURN SQLColAttributeW(SQLHSTMT, SQLUSMALLINT, SQLUSMALLINT, SQLPOINTER, SQLSMALLINT, SQLSMALLINT*, SQLPOINTER);
44 	SQLRETURN SQLColAttributesA(SQLHSTMT, SQLUSMALLINT, SQLUSMALLINT, SQLPOINTER, SQLSMALLINT, SQLSMALLINT*, SQLLEN*);
45 	SQLRETURN SQLColAttributesW(SQLHSTMT, SQLUSMALLINT, SQLUSMALLINT, SQLPOINTER, SQLSMALLINT, SQLSMALLINT*, SQLLEN*);
46 	SQLRETURN SQLColumnPrivilegesA( SQLHSTMT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT , SQLCHAR*, SQLSMALLINT );
47 	SQLRETURN SQLColumnPrivilegesW( SQLHSTMT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT );
48 	SQLRETURN SQLColumnsA(SQLHSTMT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT , SQLCHAR*, SQLSMALLINT );
49 	SQLRETURN SQLColumnsW(SQLHSTMT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT , SQLWCHAR*, SQLSMALLINT );
50 	SQLRETURN SQLConnectA(SQLHDBC, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT);
51 	SQLRETURN SQLConnectW(SQLHDBC, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT);
52 	SQLRETURN SQLDataSourcesA(SQLHENV, SQLUSMALLINT, SQLCHAR*, SQLSMALLINT, SQLSMALLINT*, SQLCHAR*, SQLSMALLINT, SQLSMALLINT*);
53 	SQLRETURN SQLDataSourcesW(SQLHENV, SQLUSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*);
54 	SQLRETURN SQLDescribeColA(SQLHSTMT, SQLUSMALLINT, SQLCHAR*, SQLSMALLINT, SQLSMALLINT*, SQLSMALLINT*, SQLULEN*, SQLSMALLINT*, SQLSMALLINT*);
55 	SQLRETURN SQLDescribeColW(SQLHSTMT, SQLUSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*, SQLSMALLINT*, SQLULEN*, SQLSMALLINT*, SQLSMALLINT*);
56 	SQLRETURN SQLDriverConnectA(SQLHDBC, SQLHWND, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLSMALLINT*, SQLUSMALLINT);
57 	SQLRETURN SQLDriverConnectW(SQLHDBC, SQLHWND, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*, SQLUSMALLINT);
58 	SQLRETURN SQLDriversA(SQLHENV, SQLUSMALLINT, SQLCHAR*, SQLSMALLINT, SQLSMALLINT*, SQLCHAR*, SQLSMALLINT, SQLSMALLINT*);
59 	SQLRETURN SQLDriversW(SQLHENV, SQLUSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*);
60 	SQLRETURN SQLErrorA(SQLHENV, SQLHDBC, SQLHSTMT, SQLCHAR*, SQLINTEGER*, SQLCHAR*, SQLSMALLINT, SQLSMALLINT*);
61 	SQLRETURN SQLErrorW(SQLHENV, SQLHDBC, SQLHSTMT, SQLWCHAR*, SQLINTEGER*, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*);
62 	SQLRETURN SQLExecDirectA(SQLHSTMT, SQLCHAR*, SQLINTEGER);
63 	SQLRETURN SQLExecDirectW(SQLHSTMT, SQLWCHAR*, SQLINTEGER);
64 	SQLRETURN SQLForeignKeysA(SQLHSTMT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT);
65 	SQLRETURN SQLForeignKeysW(SQLHSTMT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT);
66 	SQLRETURN SQLGetConnectAttrA(SQLHDBC, SQLINTEGER, SQLPOINTER, SQLINTEGER, SQLINTEGER*);
67 	SQLRETURN SQLGetConnectAttrW(SQLHDBC, SQLINTEGER, SQLPOINTER, SQLINTEGER, SQLINTEGER*);
68 	SQLRETURN SQLGetConnectOptionA(SQLHDBC, SQLUSMALLINT, SQLPOINTER);
69 	SQLRETURN SQLGetConnectOptionW(SQLHDBC, SQLUSMALLINT, SQLPOINTER);
70 	SQLRETURN SQLGetCursorNameA(SQLHSTMT, SQLCHAR*, SQLSMALLINT, SQLSMALLINT*);
71 	SQLRETURN SQLGetCursorNameW(SQLHSTMT, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*);
72 	SQLRETURN SQLGetInfoA(SQLHDBC, SQLUSMALLINT, SQLPOINTER, SQLSMALLINT, SQLSMALLINT*);
73 	SQLRETURN SQLGetInfoW(SQLHDBC, SQLUSMALLINT, SQLPOINTER, SQLSMALLINT, SQLSMALLINT*);
74 	SQLRETURN SQLGetTypeInfoA(SQLHSTMT, SQLSMALLINT);
75 	SQLRETURN SQLGetTypeInfoW(SQLHSTMT, SQLSMALLINT);
76 	SQLRETURN SQLNativeSqlA(SQLHDBC, SQLCHAR*, SQLINTEGER, SQLCHAR*, SQLINTEGER, SQLINTEGER*);
77 	SQLRETURN SQLNativeSqlW(SQLHDBC, SQLWCHAR*, SQLINTEGER, SQLWCHAR*, SQLINTEGER, SQLINTEGER*);
78 	SQLRETURN SQLPrepareA(SQLHSTMT, SQLCHAR*, SQLINTEGER);
79 	SQLRETURN SQLPrepareW(SQLHSTMT, SQLWCHAR*, SQLINTEGER);
80 	SQLRETURN SQLPrimaryKeysA(SQLHSTMT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT );
81 	SQLRETURN SQLPrimaryKeysW(SQLHSTMT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT);
82 	SQLRETURN SQLProcedureColumnsA(SQLHSTMT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT);
83 	SQLRETURN SQLProcedureColumnsW(SQLHSTMT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT);
84 	SQLRETURN SQLProceduresA(SQLHSTMT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT);
85 	SQLRETURN SQLProceduresW(SQLHSTMT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT);
86 	SQLRETURN SQLSetConnectAttrA(SQLHDBC, SQLINTEGER, SQLPOINTER, SQLINTEGER);
87 	SQLRETURN SQLSetConnectAttrW(SQLHDBC, SQLINTEGER, SQLPOINTER, SQLINTEGER);
88 	SQLRETURN SQLSetConnectOptionA(SQLHDBC, SQLUSMALLINT, SQLULEN);
89 	SQLRETURN SQLSetConnectOptionW(SQLHDBC, SQLUSMALLINT, SQLULEN);
90 	SQLRETURN SQLSetCursorNameA(SQLHSTMT, SQLCHAR*, SQLSMALLINT);
91 	SQLRETURN SQLSetCursorNameW(SQLHSTMT, SQLWCHAR*, SQLSMALLINT);
92 	SQLRETURN SQLSpecialColumnsA(SQLHSTMT, SQLUSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT , SQLUSMALLINT, SQLUSMALLINT);
93 	SQLRETURN SQLSpecialColumnsW(SQLHSTMT, SQLUSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT , SQLUSMALLINT, SQLUSMALLINT);
94 	SQLRETURN SQLStatisticsA(SQLHSTMT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT , SQLUSMALLINT, SQLUSMALLINT);
95 	SQLRETURN SQLStatisticsW(SQLHSTMT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT , SQLUSMALLINT, SQLUSMALLINT);
96 	SQLRETURN SQLTablePrivilegesA(SQLHSTMT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT);
97 	SQLRETURN SQLTablePrivilegesW(SQLHSTMT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT );
98 	SQLRETURN SQLTablesA(SQLHSTMT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLCHAR*, SQLSMALLINT);
99 	SQLRETURN SQLTablesW(SQLHSTMT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT);
100 	static if (ODBCVER >= 0x0300) {
101 		SQLRETURN SQLGetDescFieldA(SQLHDESC, SQLSMALLINT, SQLSMALLINT, SQLPOINTER, SQLINTEGER, SQLINTEGER*);
102 		SQLRETURN SQLGetDescFieldW(SQLHDESC, SQLSMALLINT, SQLSMALLINT, SQLPOINTER, SQLINTEGER, SQLINTEGER*);
103 		SQLRETURN SQLSetDescFieldA(SQLHDESC, SQLSMALLINT, SQLSMALLINT, SQLPOINTER, SQLINTEGER);
104 		SQLRETURN SQLSetDescFieldW(SQLHDESC, SQLSMALLINT, SQLSMALLINT, SQLPOINTER, SQLINTEGER);
105 		SQLRETURN SQLGetDescRecA(SQLHDESC, SQLSMALLINT, SQLCHAR*, SQLSMALLINT, SQLSMALLINT*, SQLSMALLINT*, SQLSMALLINT*, SQLLEN*, SQLSMALLINT*, SQLSMALLINT*, SQLSMALLINT*);
106 		SQLRETURN SQLGetDescRecW(SQLHDESC, SQLSMALLINT, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*, SQLSMALLINT*, SQLSMALLINT*, SQLLEN*, SQLSMALLINT*, SQLSMALLINT*, SQLSMALLINT*);
107 		SQLRETURN SQLGetDiagFieldA(SQLSMALLINT, SQLHANDLE, SQLSMALLINT, SQLSMALLINT, SQLPOINTER, SQLSMALLINT, SQLSMALLINT*);
108 		SQLRETURN SQLGetDiagFieldW(SQLSMALLINT, SQLHANDLE, SQLSMALLINT, SQLSMALLINT, SQLPOINTER, SQLSMALLINT, SQLSMALLINT*);
109 		SQLRETURN SQLGetDiagRecA(SQLSMALLINT, SQLHANDLE, SQLSMALLINT, SQLCHAR*, SQLINTEGER*, SQLCHAR*, SQLSMALLINT, SQLSMALLINT*);
110 		SQLRETURN SQLGetDiagRecW(SQLSMALLINT, SQLHANDLE, SQLSMALLINT, SQLWCHAR*, SQLINTEGER*, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*);
111 		SQLRETURN SQLGetStmtAttrA(SQLHSTMT, SQLINTEGER, SQLPOINTER, SQLINTEGER, SQLINTEGER*);
112 		SQLRETURN SQLGetStmtAttrW(SQLHSTMT, SQLINTEGER, SQLPOINTER, SQLINTEGER, SQLINTEGER*);
113 		SQLRETURN SQLSetStmtAttrA(SQLHSTMT, SQLINTEGER, SQLPOINTER, SQLINTEGER);
114 		SQLRETURN SQLSetStmtAttrW(SQLHSTMT, SQLINTEGER, SQLPOINTER, SQLINTEGER);
115 	} // #endif /* (ODBCVER >= 0x0300) */
116 }
117 
118 version (Unicode) {
119 	alias SQLBrowseConnectW SQLBrowseConnect;
120 	alias SQLColAttributeW SQLColAttribute;
121 	alias SQLColAttributesW SQLColAttributes;
122 	alias SQLColumnPrivilegesW SQLColumnPrivileges;
123 	alias SQLColumnsW SQLColumns;
124 	alias SQLConnectW SQLConnect;
125 	alias SQLDataSourcesW SQLDataSources;
126 	alias SQLDescribeColW SQLDescribeCol;
127 	alias SQLDriverConnectW SQLDriverConnect;
128 	alias SQLDriversW SQLDrivers;
129 	alias SQLErrorW SQLError;
130 	alias SQLExecDirectW SQLExecDirect;
131 	alias SQLForeignKeysW SQLForeignKeys;
132 	alias SQLGetConnectAttrW SQLGetConnectAttr;
133 	alias SQLGetConnectOptionW SQLGetConnectOption;
134 	alias SQLGetCursorNameW SQLGetCursorName;
135 	alias SQLGetDescFieldW SQLGetDescField;
136 	alias SQLGetDescRecW SQLGetDescRec;
137 	alias SQLGetDiagFieldW SQLGetDiagField;
138 	alias SQLGetDiagRecW SQLGetDiagRec;
139 	alias SQLGetInfoW SQLGetInfo;
140 	alias SQLGetStmtAttrW SQLGetStmtAttr;
141 	alias SQLGetTypeInfoW SQLGetTypeInfo;
142 	alias SQLNativeSqlW SQLNativeSql;
143 	alias SQLPrepareW SQLPrepare;
144 	alias SQLPrimaryKeysW SQLPrimaryKeys;
145 	alias SQLProcedureColumnsW SQLProcedureColumns;
146 	alias SQLProceduresW SQLProcedures;
147 	alias SQLSetConnectAttrW SQLSetConnectAttr;
148 	alias SQLSetConnectOptionW SQLSetConnectOption;
149 	alias SQLSetCursorNameW SQLSetCursorName;
150 	alias SQLSetDescFieldW SQLSetDescField;
151 	alias SQLSetStmtAttrW SQLSetStmtAttr;
152 	alias SQLSpecialColumnsW SQLSpecialColumns;
153 	alias SQLStatisticsW SQLStatistics;
154 	alias SQLTablePrivilegesW SQLTablePrivileges;
155 	alias SQLTablesW SQLTables;
156 }