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