]>
Commit | Line | Data |
---|---|---|
1 | #ifndef _INTRINSIC_SQL_H | |
2 | # define _INTRINSIC_SQL_H | |
3 | ||
4 | #ifndef OS2 | |
5 | typedef unsigned char UCHAR; | |
6 | #endif | |
7 | typedef long int SDWORD; | |
8 | typedef short int SWORD; | |
9 | typedef unsigned long int UDWORD; | |
10 | typedef unsigned short int UWORD; | |
11 | typedef unsigned int UINT; | |
12 | ||
13 | #ifndef FAR | |
14 | # define FAR | |
15 | #endif | |
16 | #ifndef NEAR | |
17 | # define NEAR | |
18 | #endif | |
19 | #ifndef HANDLE | |
20 | typedef int HANDLE; | |
21 | #endif | |
22 | #ifndef HGLOBAL | |
23 | typedef HANDLE HGLOBAL; | |
24 | #endif | |
25 | #ifndef SQL_INDEX_OTHER | |
26 | #define SQL_INDEX_OTHER 3 | |
27 | #endif | |
28 | ||
29 | # ifndef BOOL | |
30 | # define BOOL int | |
31 | # endif | |
32 | # ifndef CHAR | |
33 | # define CHAR char | |
34 | # endif | |
35 | # ifndef FALSE | |
36 | # define FALSE (0 != 0) | |
37 | # endif | |
38 | # ifndef HWND | |
39 | # define HWND int | |
40 | # endif | |
41 | # ifndef SQLHWND | |
42 | # define SQLHWND int | |
43 | # endif | |
44 | # ifndef LONG | |
45 | # define LONG long | |
46 | # endif | |
47 | # ifndef PASCAL | |
48 | # define PASCAL | |
49 | # endif | |
50 | # ifndef SHORT | |
51 | # define SHORT short | |
52 | # endif | |
53 | # ifndef SQL_API | |
54 | # define SQL_API | |
55 | # endif | |
56 | # ifndef SQL_LOCAL_API | |
57 | # define SQL_LOCAL_API | |
58 | # endif | |
59 | # ifndef TRUE | |
60 | # define TRUE (0 == 0) | |
61 | # endif | |
62 | ||
63 | typedef struct tagDATE_STRUCT | |
64 | { | |
65 | SWORD year; | |
66 | UWORD month; | |
67 | UWORD day; | |
68 | } DATE_STRUCT; | |
69 | ||
70 | typedef struct tagTIME_STRUCT | |
71 | { | |
72 | UWORD hour; | |
73 | UWORD minute; | |
74 | UWORD second; | |
75 | } TIME_STRUCT; | |
76 | ||
77 | typedef struct tagTIMESTAMP_STRUCT | |
78 | { | |
79 | SWORD year; | |
80 | UWORD month; | |
81 | UWORD day; | |
82 | UWORD hour; | |
83 | UWORD minute; | |
84 | UWORD second; | |
85 | UDWORD fraction; | |
86 | } TIMESTAMP_STRUCT; | |
87 | ||
88 | ||
89 | ||
90 | typedef UCHAR FAR* PTR, | |
91 | FAR* SQLPTR; | |
92 | ||
93 | typedef void FAR* HENV, | |
94 | FAR* SQLHENV; | |
95 | typedef void FAR* HDBC, | |
96 | FAR* SQLHDBC; | |
97 | typedef void FAR* HSTMT, | |
98 | FAR* SQLHSTMT; | |
99 | typedef SDWORD SQLINTEGER; | |
100 | typedef signed short RETCODE; | |
101 | typedef UCHAR SQLCHAR; | |
102 | typedef UWORD SQLUSMALLINT; | |
103 | typedef PTR SQLPOINTER; | |
104 | typedef SWORD SQLSMALLINT; | |
105 | typedef UDWORD SQLUINTEGER; | |
106 | ||
107 | # ifdef WIN32 | |
108 | # define SQL_API __stdcall | |
109 | # else | |
110 | # define SQL_API /* giovanni EXPORT CALLBACK */ | |
111 | # endif | |
112 | # ifdef OS2 | |
113 | # ifdef BCPP | |
114 | # define _Optlink | |
115 | # define _System _syscall | |
116 | # endif | |
117 | # undef SQL_API | |
118 | # define SQL_API _System | |
119 | # endif | |
120 | ||
121 | ||
122 | #ifndef ODBCVER | |
123 | # define ODBCVER 0x0200 | |
124 | #endif | |
125 | ||
126 | # define SQL_MAX_MESSAGE_LENGTH 512 | |
127 | # define SQL_MAX_DSN_LENGTH 32 | |
128 | ||
129 | /* return code */ | |
130 | # define SQL_INVALID_HANDLE (-2) | |
131 | # define SQL_ERROR (-1) | |
132 | # define SQL_SUCCESS 0 | |
133 | # define SQL_SUCCESS_WITH_INFO 1 | |
134 | # define SQL_NO_DATA_FOUND 100 | |
135 | ||
136 | /* standard SQL datatypes (agree with ANSI type numbering) */ | |
137 | # define SQL_CHAR 1 | |
138 | # define SQL_NUMERIC 2 | |
139 | # define SQL_DECIMAL 3 | |
140 | # define SQL_INTEGER 4 | |
141 | # define SQL_SMALLINT 5 | |
142 | # define SQL_FLOAT 6 | |
143 | # define SQL_REAL 7 | |
144 | # define SQL_DOUBLE 8 | |
145 | # define SQL_VARCHAR 12 | |
146 | ||
147 | # define SQL_TYPE_MIN SQL_CHAR | |
148 | # define SQL_TYPE_NULL 0 | |
149 | # define SQL_TYPE_MAX SQL_VARCHAR | |
150 | ||
151 | /* C to SQL datatype mapping */ | |
152 | # define SQL_C_CHAR SQL_CHAR | |
153 | # define SQL_C_LONG SQL_INTEGER | |
154 | # define SQL_C_SHORT SQL_SMALLINT | |
155 | # define SQL_C_FLOAT SQL_REAL | |
156 | # define SQL_C_DOUBLE SQL_DOUBLE | |
157 | # define SQL_C_DEFAULT 99 | |
158 | ||
159 | # define SQL_NO_NULLS 0 | |
160 | # define SQL_NULLABLE 1 | |
161 | # define SQL_NULLABLE_UNKNOWN 2 | |
162 | ||
163 | /* some special length values */ | |
164 | # define SQL_NULL_DATA (-1) | |
165 | # define SQL_DATA_AT_EXEC (-2) | |
166 | # define SQL_NTS (-3) | |
167 | ||
168 | /* SQLFreeStmt flag values */ | |
169 | # define SQL_CLOSE 0 | |
170 | # define SQL_DROP 1 | |
171 | # define SQL_UNBIND 2 | |
172 | # define SQL_RESET_PARAMS 3 | |
173 | ||
174 | /* SQLTransact flag values */ | |
175 | # define SQL_COMMIT 0 | |
176 | # define SQL_ROLLBACK 1 | |
177 | ||
178 | /* SQLColAttributes flag values */ | |
179 | # define SQL_COLUMN_COUNT 0 | |
180 | # define SQL_COLUMN_LABEL 18 | |
181 | # define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL | |
182 | # define SQL_COLUMN_DRIVER_START 1000 | |
183 | ||
184 | # define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT | |
185 | ||
186 | /* Null handles */ | |
187 | # define SQL_NULL_HENV 0 | |
188 | # define SQL_NULL_HDBC 0 | |
189 | # define SQL_NULL_HSTMT 0 | |
190 | ||
191 | #endif | |
192 |