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