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