1 /***********************************************************************\
2 *                               odbcinst.d                              *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                                                                       *
8 *                       Placed into public domain                       *
9 \***********************************************************************/
10 module windows.odbcinst;
11 nothrow:
12 import windows.sql;
13 private import windows.windef;
14 
15 /*	FIXME: The Unicode/Ansi functions situation is a mess. How do the xxxA
16  *	versions of these functions fit into the scheme?
17  */
18 
19 // SQLConfigDataSource()
20 enum : WORD {
21 	ODBC_ADD_DSN            = 1,
22 	ODBC_CONFIG_DSN         = 2,
23 	ODBC_REMOVE_DSN         = 3,
24 	ODBC_ADD_SYS_DSN        = 4,
25 	ODBC_CONFIG_SYS_DSN     = 5,
26 	ODBC_REMOVE_SYS_DSN     = 6,
27 	ODBC_REMOVE_DEFAULT_DSN = 7
28 }
29 
30 // ODBC 3.0+
31 enum : WORD {
32 	ODBC_INSTALL_INQUIRY  = 1,
33 	ODBC_INSTALL_COMPLETE = 2
34 }
35 
36 // ODBC 2.5+
37 enum : WORD {
38 	ODBC_INSTALL_DRIVER    = 1,
39 	ODBC_REMOVE_DRIVER     = 2,
40 	ODBC_CONFIG_DRIVER     = 3,
41 	ODBC_CONFIG_DRIVER_MAX = 100
42 }
43 
44 // ODBC 3.0+
45 // SQLSetConfigMode()
46 enum : UWORD {
47 	ODBC_BOTH_DSN   = 0,
48 	ODBC_USER_DSN   = 1,
49 	ODBC_SYSTEM_DSN = 2
50 }
51 
52 enum : DWORD {
53 	ODBC_ERROR_GENERAL_ERR             = 1,
54 	ODBC_ERROR_INVALID_BUFF_LEN        = 2,
55 	ODBC_ERROR_INVALID_HWND            = 3,
56 	ODBC_ERROR_INVALID_STR             = 4,
57 	ODBC_ERROR_INVALID_REQUEST_TYPE    = 5,
58 	ODBC_ERROR_COMPONENT_NOT_FOUND     = 6,
59 	ODBC_ERROR_INVALID_NAME            = 7,
60 	ODBC_ERROR_INVALID_KEYWORD_VALUE   = 8,
61 	ODBC_ERROR_INVALID_DSN             = 9,
62 	ODBC_ERROR_INVALID_INF             = 10,
63 	ODBC_ERROR_REQUEST_FAILED          = 11,
64 	ODBC_ERROR_INVALID_PATH            = 12,
65 	ODBC_ERROR_LOAD_LIB_FAILED         = 13,
66 	ODBC_ERROR_INVALID_PARAM_SEQUENCE  = 14,
67 	ODBC_ERROR_INVALID_LOG_FILE        = 15,
68 	ODBC_ERROR_USER_CANCELED           = 16,
69 	ODBC_ERROR_USAGE_UPDATE_FAILED     = 17,
70 	ODBC_ERROR_CREATE_DSN_FAILED       = 18,
71 	ODBC_ERROR_WRITING_SYSINFO_FAILED  = 19,
72 	ODBC_ERROR_REMOVE_DSN_FAILED       = 20,
73 	ODBC_ERROR_OUT_OF_MEM              = 21,
74 	ODBC_ERROR_OUTPUT_STRING_TRUNCATED = 22
75 }
76 
77 extern (Windows):
78 BOOL  ConfigDSN(HWND,WORD,LPCSTR,LPCSTR);
79 BOOL  ConfigDSNW(HWND,WORD,LPCWSTR,LPCWSTR);
80 BOOL  ConfigTranslator(HWND,DWORD*);
81 BOOL  SQLConfigDataSource(HWND,WORD,LPCSTR,LPCSTR);
82 BOOL  SQLConfigDataSourceW(HWND,WORD,LPCWSTR,LPCWSTR);
83 BOOL  SQLCreateDataSource(HWND,LPCSTR);
84 BOOL  SQLCreateDataSourceW(HWND,LPCWSTR);
85 BOOL  SQLGetAvailableDrivers(LPCSTR,LPSTR,WORD,WORD*);
86 BOOL  SQLGetAvailableDriversW(LPCWSTR,LPWSTR,WORD,WORD*);
87 BOOL  SQLGetInstalledDrivers(LPSTR,WORD,WORD*);
88 BOOL  SQLGetInstalledDriversW(LPWSTR,WORD,WORD*);
89 int  SQLGetPrivateProfileString(LPCSTR,LPCSTR,LPCSTR,LPSTR,int,LPCSTR);
90 int  SQLGetPrivateProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,int,LPCWSTR);
91 BOOL  SQLGetTranslator(HWND,LPSTR,WORD,WORD*,LPSTR,WORD,WORD*,DWORD*);
92 BOOL  SQLGetTranslatorW(HWND,LPWSTR,WORD,WORD*,LPWSTR,WORD,WORD*,DWORD*);
93 BOOL  SQLInstallDriver(LPCSTR,LPCSTR,LPSTR,WORD,WORD*);
94 BOOL  SQLInstallDriverManager(LPSTR,WORD,WORD*);
95 BOOL  SQLInstallDriverManagerW(LPWSTR,WORD,WORD*);
96 BOOL  SQLInstallDriverW(LPCWSTR,LPCWSTR,LPWSTR,WORD,WORD*);
97 BOOL  SQLInstallODBC(HWND,LPCSTR,LPCSTR,LPCSTR);
98 BOOL  SQLInstallODBCW(HWND,LPCWSTR,LPCWSTR,LPCWSTR);
99 BOOL  SQLManageDataSources(HWND);
100 BOOL  SQLRemoveDefaultDataSource();
101 BOOL  SQLRemoveDSNFromIni(LPCSTR);
102 BOOL  SQLRemoveDSNFromIniW(LPCWSTR);
103 BOOL  SQLValidDSN(LPCSTR);
104 BOOL  SQLValidDSNW(LPCWSTR);
105 BOOL  SQLWriteDSNToIni(LPCSTR,LPCSTR);
106 BOOL  SQLWriteDSNToIniW(LPCWSTR,LPCWSTR);
107 BOOL  SQLWritePrivateProfileString(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
108 BOOL  SQLWritePrivateProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
109 
110 static if (ODBCVER >= 0x0250) {
111 	BOOL  ConfigDriver(HWND,WORD,LPCSTR,LPCSTR,LPSTR,WORD,WORD*);
112 	BOOL  ConfigDriverW(HWND,WORD,LPCWSTR,LPCWSTR,LPWSTR,WORD,WORD*);
113 	BOOL  SQLConfigDriver(HWND,WORD,LPCSTR,LPCSTR,LPSTR,WORD,WORD*);
114 	BOOL  SQLConfigDriverW(HWND,WORD,LPCWSTR,LPCWSTR,LPWSTR,WORD,WORD*);
115 	BOOL  SQLInstallTranslator(LPCSTR,LPCSTR,LPCSTR,LPSTR,WORD,WORD*,WORD,LPDWORD);
116 	BOOL  SQLInstallTranslatorW(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,WORD,WORD*,WORD,LPDWORD);
117 
118 	BOOL  SQLRemoveDriver(LPCSTR,BOOL,LPDWORD);
119 	BOOL  SQLRemoveDriverManager(LPDWORD);
120 	BOOL  SQLRemoveDriverW(LPCWSTR,BOOL,LPDWORD);
121 	BOOL  SQLRemoveTranslator(LPCSTR,LPDWORD);
122 	BOOL  SQLRemoveTranslatorW(LPCWSTR,LPDWORD);
123 }
124 static if (ODBCVER >= 0x0300) {
125 	BOOL  SQLGetConfigMode(UWORD*);
126 	BOOL  SQLInstallDriverEx(LPCSTR,LPCSTR,LPSTR,WORD,WORD*,WORD,LPDWORD);
127 	BOOL  SQLInstallDriverExW(LPCWSTR,LPCWSTR,LPWSTR,WORD,WORD*,WORD,LPDWORD);
128 	SQLRETURN  SQLInstallerError(WORD,DWORD*,LPSTR,WORD,WORD*);
129 	SQLRETURN  SQLInstallerErrorW(WORD,DWORD*,LPWSTR,WORD,WORD*);
130 	BOOL  SQLInstallTranslatorEx(LPCSTR,LPCSTR,LPSTR,WORD,WORD*,WORD,LPDWORD);
131 	BOOL  SQLInstallTranslatorExW(LPCWSTR,LPCWSTR,LPWSTR,WORD,WORD*,WORD,LPDWORD);
132 	SQLRETURN  SQLPostInstallerError(DWORD,LPCSTR);
133 	SQLRETURN  SQLPostInstallerErrorW(DWORD,LPCWSTR);
134 	BOOL  SQLReadFileDSN(LPCSTR,LPCSTR,LPCSTR,LPSTR,WORD,WORD*);
135 	BOOL  SQLReadFileDSNW(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,WORD,WORD*);
136 	BOOL  SQLSetConfigMode(UWORD);
137 	BOOL  SQLWriteFileDSN(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
138 	BOOL  SQLWriteFileDSNW(LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
139 }
140 
141 version (Unicode) {
142 	alias SQLConfigDataSourceW SQLConfigDataSource;
143 	alias SQLConfigDriverW SQLConfigDriver;
144 	alias SQLCreateDataSourceW SQLCreateDataSource;
145 	alias SQLGetAvailableDriversW SQLGetAvailableDrivers;
146 	alias SQLGetInstalledDriversW SQLGetInstalledDrivers;
147 	alias SQLGetPrivateProfileStringW SQLGetPrivateProfileString;
148 	alias SQLGetTranslatorW SQLGetTranslator;
149 	alias SQLInstallDriverW SQLInstallDriver;
150 	alias SQLInstallDriverExW SQLInstallDriverEx;
151 	alias SQLInstallDriverManagerW SQLInstallDriverManager;
152 	alias SQLInstallerErrorW SQLInstallerError;
153 	alias SQLInstallODBCW SQLInstallODBC;
154 	alias SQLInstallTranslatorW SQLInstallTranslator;
155 	alias SQLInstallTranslatorExW SQLInstallTranslatorEx;
156 	alias SQLPostInstallerErrorW SQLPostInstallerError;
157 	alias SQLReadFileDSNW SQLReadFileDSN;
158 	alias SQLRemoveDriverW SQLRemoveDriver;
159 	alias SQLRemoveDSNFromIniW SQLRemoveDSNFromIni;
160 	alias SQLRemoveTranslatorW SQLRemoveTranslator;
161 	alias SQLValidDSNW SQLValidDSN;
162 	alias SQLWriteDSNToIniW SQLWriteDSNToIni;
163 	alias SQLWriteFileDSNW SQLWriteFileDSN;
164 	alias SQLWritePrivateProfileStringW SQLWritePrivateProfileString;
165 }