]> git.saurik.com Git - wxWidgets.git/blob - include/wx/isql.h
Better fix for 'int i' used twice in the same block.
[wxWidgets.git] / include / wx / isql.h
1 /*
2 * isql.h
3 *
4 * $Id$
5 *
6 * iODBC defines
7 *
8 * The iODBC driver manager.
9 *
10 * Copyright (C) 1995 by Ke Jin <kejin@empress.com>
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
21 *
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26 #ifndef _ISQL_H
27 #define _ISQL_H
28
29 #if defined(WIN32)
30 #define SQL_API __stdcall
31
32 #ifndef FAR
33 #define FAR
34 #endif
35
36 #elif defined(__OS2__)
37 #define SQL_API _Optlink
38
39 #ifndef FAR
40 #define FAR
41 #define EXPORT
42 #define CALLBACK
43 #endif
44
45 #else
46 #define FAR
47 #define EXPORT
48 #define CALLBACK
49 #define SQL_API EXPORT CALLBACK
50
51 #ifndef __EMX__
52 typedef void *HWND;
53 #endif
54 #endif
55
56 typedef void *SQLHWND;
57
58 typedef unsigned char UCHAR;
59 typedef long int SDWORD;
60 typedef short int SWORD;
61 typedef unsigned long int UDWORD;
62 typedef unsigned short int UWORD;
63 typedef long SQLINTEGER;
64
65 typedef void FAR *PTR;
66 typedef void FAR *HENV;
67 typedef void FAR *HDBC;
68 typedef void FAR *HSTMT;
69
70 typedef signed short RETCODE;
71 #define SQLRETURN RETCODE
72
73
74 #define ODBCVER 0x0250
75
76 #define SQL_MAX_MESSAGE_LENGTH 512
77 #define SQL_MAX_DSN_LENGTH 32
78
79 /*
80 * Function return codes
81 */
82 #define SQL_INVALID_HANDLE (-2)
83 #define SQL_ERROR (-1)
84 #define SQL_SUCCESS 0
85 #define SQL_SUCCESS_WITH_INFO 1
86 #define SQL_NO_DATA_FOUND 100
87
88 /*
89 * Standard SQL datatypes, using ANSI type numbering
90 */
91 #define SQL_CHAR 1
92 #define SQL_NUMERIC 2
93 #define SQL_DECIMAL 3
94 #define SQL_INTEGER 4
95 #define SQL_SMALLINT 5
96 #define SQL_FLOAT 6
97 #define SQL_REAL 7
98 #define SQL_DOUBLE 8
99 #define SQL_VARCHAR 12
100
101 #define SQL_TYPE_MIN SQL_CHAR
102 #define SQL_TYPE_NULL 0
103 #define SQL_TYPE_MAX SQL_VARCHAR
104
105 /*
106 * C datatype to SQL datatype mapping
107 */
108 #define SQL_C_CHAR SQL_CHAR
109 #define SQL_C_LONG SQL_INTEGER
110 #define SQL_C_SHORT SQL_SMALLINT
111 #define SQL_C_FLOAT SQL_REAL
112 #define SQL_C_DOUBLE SQL_DOUBLE
113 #define SQL_C_DEFAULT 99
114
115 /*
116 * NULL status constants.
117 */
118 #define SQL_NO_NULLS 0
119 #define SQL_NULLABLE 1
120 #define SQL_NULLABLE_UNKNOWN 2
121
122 /*
123 * Special length values
124 */
125 #define SQL_NULL_DATA (-1)
126 #define SQL_DATA_AT_EXEC (-2)
127 #define SQL_NTS (-3)
128
129 /*
130 * SQLFreeStmt
131 */
132 #define SQL_CLOSE 0
133 #define SQL_DROP 1
134 #define SQL_UNBIND 2
135 #define SQL_RESET_PARAMS 3
136
137 /*
138 * SQLTransact
139 */
140 #define SQL_COMMIT 0
141 #define SQL_ROLLBACK 1
142
143 /*
144 * SQLColAttributes
145 */
146 #define SQL_COLUMN_COUNT 0
147 #define SQL_COLUMN_NAME 1
148 #define SQL_COLUMN_TYPE 2
149 #define SQL_COLUMN_LENGTH 3
150 #define SQL_COLUMN_PRECISION 4
151 #define SQL_COLUMN_SCALE 5
152 #define SQL_COLUMN_DISPLAY_SIZE 6
153 #define SQL_COLUMN_NULLABLE 7
154 #define SQL_COLUMN_UNSIGNED 8
155 #define SQL_COLUMN_MONEY 9
156 #define SQL_COLUMN_UPDATABLE 10
157 #define SQL_COLUMN_AUTO_INCREMENT 11
158 #define SQL_COLUMN_CASE_SENSITIVE 12
159 #define SQL_COLUMN_SEARCHABLE 13
160 #define SQL_COLUMN_TYPE_NAME 14
161 #define SQL_COLUMN_TABLE_NAME 15
162 #define SQL_COLUMN_OWNER_NAME 16
163 #define SQL_COLUMN_QUALIFIER_NAME 17
164 #define SQL_COLUMN_LABEL 18
165
166 #define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL
167 #define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT
168 #define SQL_COLUMN_DRIVER_START 1000
169
170 /*
171 * SQLColAttributes : SQL_COLUMN_UPDATABLE
172 */
173 #define SQL_ATTR_READONLY 0
174 #define SQL_ATTR_WRITE 1
175 #define SQL_ATTR_READWRITE_UNKNOWN 2
176
177 /*
178 * SQLColAttributes : SQL_COLUMN_SEARCHABLE
179 */
180 #define SQL_UNSEARCHABLE 0
181 #define SQL_LIKE_ONLY 1
182 #define SQL_ALL_EXCEPT_LIKE 2
183 #define SQL_SEARCHABLE 3
184
185 /*
186 * NULL Handles
187 */
188 #define SQL_NULL_HENV 0
189 #define SQL_NULL_HDBC 0
190 #define SQL_NULL_HSTMT 0
191
192
193 /*
194 * Function Prototypes
195 */
196 #ifdef __cplusplus
197 extern "C"
198 {
199 #endif
200
201 RETCODE SQL_API SQLAllocConnect (HENV henv, HDBC FAR * phdbc);
202 RETCODE SQL_API SQLAllocEnv (HENV FAR * phenv);
203 RETCODE SQL_API SQLAllocStmt (HDBC hdbc, HSTMT FAR * phstmt);
204 RETCODE SQL_API SQLBindCol (HSTMT hstmt, UWORD icol, SWORD fCType,
205 PTR rgbValue, SDWORD cbValueMax, SDWORD FAR * pcbValue);
206 RETCODE SQL_API SQLCancel (HSTMT hstmt);
207 RETCODE SQL_API SQLColAttributes (HSTMT hstmt, UWORD icol, UWORD fDescType,
208 PTR rgbDesc, SWORD cbDescMax, SWORD FAR * pcbDesc, SDWORD FAR * pfDesc);
209 RETCODE SQL_API SQLConnect (HDBC hdbc, UCHAR FAR * szDSN, SWORD cbDSN,
210 UCHAR FAR * szUID, SWORD cbUID, UCHAR FAR * szAuthStr, SWORD cbAuthStr);
211 RETCODE SQL_API SQLDescribeCol (HSTMT hstmt, UWORD icol,
212 UCHAR FAR * szColName, SWORD cbColNameMax, SWORD FAR * pcbColName,
213 SWORD FAR * pfSqlType, UDWORD FAR * pcbColDef, SWORD FAR * pibScale,
214 SWORD FAR * pfNullable);
215 RETCODE SQL_API SQLDisconnect (HDBC hdbc);
216 RETCODE SQL_API SQLError (HENV henv, HDBC hdbc, HSTMT hstmt,
217 UCHAR FAR * szSqlState, SDWORD FAR * pfNativeError, UCHAR FAR * szErrorMsg,
218 SWORD cbErrorMsgMax, SWORD FAR * pcbErrorMsg);
219 RETCODE SQL_API SQLExecDirect (HSTMT hstmt, UCHAR FAR * szSqlStr,
220 SDWORD cbSqlStr);
221 RETCODE SQL_API SQLExecute (HSTMT hstmt);
222 RETCODE SQL_API SQLFetch (HSTMT hstmt);
223 RETCODE SQL_API SQLFreeConnect (HDBC hdbc);
224 RETCODE SQL_API SQLFreeEnv (HENV henv);
225 RETCODE SQL_API SQLFreeStmt (HSTMT hstmt, UWORD fOption);
226 RETCODE SQL_API SQLGetCursorName (HSTMT hstmt, UCHAR FAR * szCursor,
227 SWORD cbCursorMax, SWORD FAR * pcbCursor);
228 RETCODE SQL_API SQLNumResultCols (HSTMT hstmt, SWORD FAR * pccol);
229 RETCODE SQL_API SQLPrepare (HSTMT hstmt, UCHAR FAR * szSqlStr,
230 SDWORD cbSqlStr);
231 RETCODE SQL_API SQLRowCount (HSTMT hstmt, SDWORD FAR * pcrow);
232 RETCODE SQL_API SQLSetCursorName (HSTMT hstmt, UCHAR FAR * szCursor,
233 SWORD cbCursor);
234 RETCODE SQL_API SQLTransact (HENV henv, HDBC hdbc, UWORD fType);
235
236 /*
237 * Deprecated ODBC 1.0 function - Use SQLBindParameter
238 */
239 RETCODE SQL_API SQLSetParam (HSTMT hstmt, UWORD ipar, SWORD fCType,
240 SWORD fSqlType, UDWORD cbColDef, SWORD ibScale, PTR rgbValue,
241 SDWORD FAR * pcbValue);
242
243 #ifdef __cplusplus
244 }
245 #endif
246
247 #endif