]> git.saurik.com Git - wxWidgets.git/blame - include/wx/isql.h
added macros to avoid code repetition when defining comparison operators; use them...
[wxWidgets.git] / include / wx / isql.h
CommitLineData
d76fe38b
RR
1/*
2 * isql.h
3 *
4 * $Id$
5 *
6 * iODBC defines
7 *
8 * The iODBC driver manager.
bbc3f89a
DW
9 *
10 * Copyright (C) 1995 by Ke Jin <kejin@empress.com>
d76fe38b
RR
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
3a5bcc4d 29#if defined(WIN32)
7beb59f3 30#define SQL_API __stdcall
96820af7 31
bbc3f89a
DW
32#ifndef FAR
33#define FAR
34#endif
35
36#elif defined(__OS2__)
7beb59f3 37#define SQL_API _Optlink
bbc3f89a
DW
38
39#ifndef FAR
40#define FAR
41#define EXPORT
42#define CALLBACK
96820af7
BJ
43#endif
44
d76fe38b
RR
45#else
46#define FAR
47#define EXPORT
48#define CALLBACK
7beb59f3 49#define SQL_API EXPORT CALLBACK
d76fe38b 50
64a1d923 51#ifndef __EMX__
d76fe38b
RR
52typedef void *HWND;
53#endif
64a1d923 54#endif
d76fe38b
RR
55
56typedef void *SQLHWND;
57
58typedef unsigned char UCHAR;
59typedef long int SDWORD;
60typedef short int SWORD;
61typedef unsigned long int UDWORD;
62typedef unsigned short int UWORD;
e0608d9f 63typedef long SQLINTEGER;
1d421f0c 64typedef UDWORD SQLUINTEGER;
d76fe38b
RR
65
66typedef void FAR *PTR;
67typedef void FAR *HENV;
68typedef void FAR *HDBC;
69typedef void FAR *HSTMT;
70
71typedef signed short RETCODE;
7beb59f3 72#define SQLRETURN RETCODE
d76fe38b
RR
73
74
7beb59f3 75#define ODBCVER 0x0250
d76fe38b 76
7beb59f3
WS
77#define SQL_MAX_MESSAGE_LENGTH 512
78#define SQL_MAX_DSN_LENGTH 32
d76fe38b
RR
79
80/*
81 * Function return codes
82 */
7beb59f3
WS
83#define SQL_INVALID_HANDLE (-2)
84#define SQL_ERROR (-1)
85#define SQL_SUCCESS 0
86#define SQL_SUCCESS_WITH_INFO 1
87#define SQL_NO_DATA_FOUND 100
d76fe38b
RR
88
89/*
90 * Standard SQL datatypes, using ANSI type numbering
91 */
7beb59f3
WS
92#define SQL_CHAR 1
93#define SQL_NUMERIC 2
94#define SQL_DECIMAL 3
95#define SQL_INTEGER 4
96#define SQL_SMALLINT 5
97#define SQL_FLOAT 6
98#define SQL_REAL 7
99#define SQL_DOUBLE 8
100#define SQL_VARCHAR 12
101
102#define SQL_TYPE_MIN SQL_CHAR
103#define SQL_TYPE_NULL 0
104#define SQL_TYPE_MAX SQL_VARCHAR
d76fe38b
RR
105
106/*
107 * C datatype to SQL datatype mapping
108 */
7beb59f3
WS
109#define SQL_C_CHAR SQL_CHAR
110#define SQL_C_LONG SQL_INTEGER
111#define SQL_C_SHORT SQL_SMALLINT
112#define SQL_C_FLOAT SQL_REAL
113#define SQL_C_DOUBLE SQL_DOUBLE
114#define SQL_C_DEFAULT 99
d76fe38b
RR
115
116/*
117 * NULL status constants.
118 */
7beb59f3
WS
119#define SQL_NO_NULLS 0
120#define SQL_NULLABLE 1
121#define SQL_NULLABLE_UNKNOWN 2
d76fe38b
RR
122
123/*
124 * Special length values
125 */
7beb59f3
WS
126#define SQL_NULL_DATA (-1)
127#define SQL_DATA_AT_EXEC (-2)
128#define SQL_NTS (-3)
d76fe38b
RR
129
130/*
131 * SQLFreeStmt
132 */
7beb59f3
WS
133#define SQL_CLOSE 0
134#define SQL_DROP 1
135#define SQL_UNBIND 2
136#define SQL_RESET_PARAMS 3
d76fe38b
RR
137
138/*
139 * SQLTransact
140 */
7beb59f3
WS
141#define SQL_COMMIT 0
142#define SQL_ROLLBACK 1
d76fe38b
RR
143
144/*
145 * SQLColAttributes
146 */
7beb59f3
WS
147#define SQL_COLUMN_COUNT 0
148#define SQL_COLUMN_NAME 1
149#define SQL_COLUMN_TYPE 2
150#define SQL_COLUMN_LENGTH 3
151#define SQL_COLUMN_PRECISION 4
152#define SQL_COLUMN_SCALE 5
153#define SQL_COLUMN_DISPLAY_SIZE 6
154#define SQL_COLUMN_NULLABLE 7
155#define SQL_COLUMN_UNSIGNED 8
156#define SQL_COLUMN_MONEY 9
157#define SQL_COLUMN_UPDATABLE 10
158#define SQL_COLUMN_AUTO_INCREMENT 11
159#define SQL_COLUMN_CASE_SENSITIVE 12
160#define SQL_COLUMN_SEARCHABLE 13
161#define SQL_COLUMN_TYPE_NAME 14
162#define SQL_COLUMN_TABLE_NAME 15
163#define SQL_COLUMN_OWNER_NAME 16
164#define SQL_COLUMN_QUALIFIER_NAME 17
165#define SQL_COLUMN_LABEL 18
166
167#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL
168#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT
169#define SQL_COLUMN_DRIVER_START 1000
d76fe38b
RR
170
171/*
172 * SQLColAttributes : SQL_COLUMN_UPDATABLE
173 */
7beb59f3
WS
174#define SQL_ATTR_READONLY 0
175#define SQL_ATTR_WRITE 1
176#define SQL_ATTR_READWRITE_UNKNOWN 2
d76fe38b
RR
177
178/*
179 * SQLColAttributes : SQL_COLUMN_SEARCHABLE
180 */
7beb59f3
WS
181#define SQL_UNSEARCHABLE 0
182#define SQL_LIKE_ONLY 1
183#define SQL_ALL_EXCEPT_LIKE 2
184#define SQL_SEARCHABLE 3
d76fe38b
RR
185
186/*
187 * NULL Handles
188 */
7beb59f3
WS
189#define SQL_NULL_HENV 0
190#define SQL_NULL_HDBC 0
191#define SQL_NULL_HSTMT 0
d76fe38b
RR
192
193
194/*
195 * Function Prototypes
196 */
197#ifdef __cplusplus
198extern "C"
199{
200#endif
201
202 RETCODE SQL_API SQLAllocConnect (HENV henv, HDBC FAR * phdbc);
203 RETCODE SQL_API SQLAllocEnv (HENV FAR * phenv);
204 RETCODE SQL_API SQLAllocStmt (HDBC hdbc, HSTMT FAR * phstmt);
205 RETCODE SQL_API SQLBindCol (HSTMT hstmt, UWORD icol, SWORD fCType,
206 PTR rgbValue, SDWORD cbValueMax, SDWORD FAR * pcbValue);
207 RETCODE SQL_API SQLCancel (HSTMT hstmt);
208 RETCODE SQL_API SQLColAttributes (HSTMT hstmt, UWORD icol, UWORD fDescType,
209 PTR rgbDesc, SWORD cbDescMax, SWORD FAR * pcbDesc, SDWORD FAR * pfDesc);
210 RETCODE SQL_API SQLConnect (HDBC hdbc, UCHAR FAR * szDSN, SWORD cbDSN,
211 UCHAR FAR * szUID, SWORD cbUID, UCHAR FAR * szAuthStr, SWORD cbAuthStr);
212 RETCODE SQL_API SQLDescribeCol (HSTMT hstmt, UWORD icol,
213 UCHAR FAR * szColName, SWORD cbColNameMax, SWORD FAR * pcbColName,
214 SWORD FAR * pfSqlType, UDWORD FAR * pcbColDef, SWORD FAR * pibScale,
215 SWORD FAR * pfNullable);
216 RETCODE SQL_API SQLDisconnect (HDBC hdbc);
217 RETCODE SQL_API SQLError (HENV henv, HDBC hdbc, HSTMT hstmt,
218 UCHAR FAR * szSqlState, SDWORD FAR * pfNativeError, UCHAR FAR * szErrorMsg,
219 SWORD cbErrorMsgMax, SWORD FAR * pcbErrorMsg);
220 RETCODE SQL_API SQLExecDirect (HSTMT hstmt, UCHAR FAR * szSqlStr,
221 SDWORD cbSqlStr);
222 RETCODE SQL_API SQLExecute (HSTMT hstmt);
223 RETCODE SQL_API SQLFetch (HSTMT hstmt);
224 RETCODE SQL_API SQLFreeConnect (HDBC hdbc);
225 RETCODE SQL_API SQLFreeEnv (HENV henv);
226 RETCODE SQL_API SQLFreeStmt (HSTMT hstmt, UWORD fOption);
227 RETCODE SQL_API SQLGetCursorName (HSTMT hstmt, UCHAR FAR * szCursor,
228 SWORD cbCursorMax, SWORD FAR * pcbCursor);
229 RETCODE SQL_API SQLNumResultCols (HSTMT hstmt, SWORD FAR * pccol);
230 RETCODE SQL_API SQLPrepare (HSTMT hstmt, UCHAR FAR * szSqlStr,
231 SDWORD cbSqlStr);
232 RETCODE SQL_API SQLRowCount (HSTMT hstmt, SDWORD FAR * pcrow);
233 RETCODE SQL_API SQLSetCursorName (HSTMT hstmt, UCHAR FAR * szCursor,
234 SWORD cbCursor);
235 RETCODE SQL_API SQLTransact (HENV henv, HDBC hdbc, UWORD fType);
236
237/*
34621cc5 238 * Deprecated ODBC 1.0 function - Use SQLBindParameter
d76fe38b
RR
239 */
240 RETCODE SQL_API SQLSetParam (HSTMT hstmt, UWORD ipar, SWORD fCType,
241 SWORD fSqlType, UDWORD cbColDef, SWORD ibScale, PTR rgbValue,
242 SDWORD FAR * pcbValue);
243
244#ifdef __cplusplus
245}
246#endif
247
248#endif