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