]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/isql.h
8 * The iODBC driver manager.
10 * Copyright (C) 1995 by Ke Jin <kejin@empress.com>
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.
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.
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.
30 #define SQL_API __stdcall
36 #elif defined(__OS2__)
37 #define SQL_API _Optlink
49 #define SQL_API EXPORT CALLBACK
56 typedef void *SQLHWND
;
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
;
64 typedef void FAR
*PTR
;
65 typedef void FAR
*HENV
;
66 typedef void FAR
*HDBC
;
67 typedef void FAR
*HSTMT
;
69 typedef signed short RETCODE
;
70 #define SQLRETURN RETCODE
73 #define ODBCVER 0x0250
75 #define SQL_MAX_MESSAGE_LENGTH 512
76 #define SQL_MAX_DSN_LENGTH 32
79 * Function return codes
81 #define SQL_INVALID_HANDLE (-2)
82 #define SQL_ERROR (-1)
84 #define SQL_SUCCESS_WITH_INFO 1
85 #define SQL_NO_DATA_FOUND 100
88 * Standard SQL datatypes, using ANSI type numbering
94 #define SQL_SMALLINT 5
98 #define SQL_VARCHAR 12
100 #define SQL_TYPE_MIN SQL_CHAR
101 #define SQL_TYPE_NULL 0
102 #define SQL_TYPE_MAX SQL_VARCHAR
105 * C datatype to SQL datatype mapping
107 #define SQL_C_CHAR SQL_CHAR
108 #define SQL_C_LONG SQL_INTEGER
109 #define SQL_C_SHORT SQL_SMALLINT
110 #define SQL_C_FLOAT SQL_REAL
111 #define SQL_C_DOUBLE SQL_DOUBLE
112 #define SQL_C_DEFAULT 99
115 * NULL status constants.
117 #define SQL_NO_NULLS 0
118 #define SQL_NULLABLE 1
119 #define SQL_NULLABLE_UNKNOWN 2
122 * Special length values
124 #define SQL_NULL_DATA (-1)
125 #define SQL_DATA_AT_EXEC (-2)
134 #define SQL_RESET_PARAMS 3
140 #define SQL_ROLLBACK 1
145 #define SQL_COLUMN_COUNT 0
146 #define SQL_COLUMN_NAME 1
147 #define SQL_COLUMN_TYPE 2
148 #define SQL_COLUMN_LENGTH 3
149 #define SQL_COLUMN_PRECISION 4
150 #define SQL_COLUMN_SCALE 5
151 #define SQL_COLUMN_DISPLAY_SIZE 6
152 #define SQL_COLUMN_NULLABLE 7
153 #define SQL_COLUMN_UNSIGNED 8
154 #define SQL_COLUMN_MONEY 9
155 #define SQL_COLUMN_UPDATABLE 10
156 #define SQL_COLUMN_AUTO_INCREMENT 11
157 #define SQL_COLUMN_CASE_SENSITIVE 12
158 #define SQL_COLUMN_SEARCHABLE 13
159 #define SQL_COLUMN_TYPE_NAME 14
160 #define SQL_COLUMN_TABLE_NAME 15
161 #define SQL_COLUMN_OWNER_NAME 16
162 #define SQL_COLUMN_QUALIFIER_NAME 17
163 #define SQL_COLUMN_LABEL 18
165 #define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL
166 #define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT
167 #define SQL_COLUMN_DRIVER_START 1000
170 * SQLColAttributes : SQL_COLUMN_UPDATABLE
172 #define SQL_ATTR_READONLY 0
173 #define SQL_ATTR_WRITE 1
174 #define SQL_ATTR_READWRITE_UNKNOWN 2
177 * SQLColAttributes : SQL_COLUMN_SEARCHABLE
179 #define SQL_UNSEARCHABLE 0
180 #define SQL_LIKE_ONLY 1
181 #define SQL_ALL_EXCEPT_LIKE 2
182 #define SQL_SEARCHABLE 3
187 #define SQL_NULL_HENV 0
188 #define SQL_NULL_HDBC 0
189 #define SQL_NULL_HSTMT 0
193 * Function Prototypes
200 RETCODE SQL_API
SQLAllocConnect (HENV henv
, HDBC FAR
* phdbc
);
201 RETCODE SQL_API
SQLAllocEnv (HENV FAR
* phenv
);
202 RETCODE SQL_API
SQLAllocStmt (HDBC hdbc
, HSTMT FAR
* phstmt
);
203 RETCODE SQL_API
SQLBindCol (HSTMT hstmt
, UWORD icol
, SWORD fCType
,
204 PTR rgbValue
, SDWORD cbValueMax
, SDWORD FAR
* pcbValue
);
205 RETCODE SQL_API
SQLCancel (HSTMT hstmt
);
206 RETCODE SQL_API
SQLColAttributes (HSTMT hstmt
, UWORD icol
, UWORD fDescType
,
207 PTR rgbDesc
, SWORD cbDescMax
, SWORD FAR
* pcbDesc
, SDWORD FAR
* pfDesc
);
208 RETCODE SQL_API
SQLConnect (HDBC hdbc
, UCHAR FAR
* szDSN
, SWORD cbDSN
,
209 UCHAR FAR
* szUID
, SWORD cbUID
, UCHAR FAR
* szAuthStr
, SWORD cbAuthStr
);
210 RETCODE SQL_API
SQLDescribeCol (HSTMT hstmt
, UWORD icol
,
211 UCHAR FAR
* szColName
, SWORD cbColNameMax
, SWORD FAR
* pcbColName
,
212 SWORD FAR
* pfSqlType
, UDWORD FAR
* pcbColDef
, SWORD FAR
* pibScale
,
213 SWORD FAR
* pfNullable
);
214 RETCODE SQL_API
SQLDisconnect (HDBC hdbc
);
215 RETCODE SQL_API
SQLError (HENV henv
, HDBC hdbc
, HSTMT hstmt
,
216 UCHAR FAR
* szSqlState
, SDWORD FAR
* pfNativeError
, UCHAR FAR
* szErrorMsg
,
217 SWORD cbErrorMsgMax
, SWORD FAR
* pcbErrorMsg
);
218 RETCODE SQL_API
SQLExecDirect (HSTMT hstmt
, UCHAR FAR
* szSqlStr
,
220 RETCODE SQL_API
SQLExecute (HSTMT hstmt
);
221 RETCODE SQL_API
SQLFetch (HSTMT hstmt
);
222 RETCODE SQL_API
SQLFreeConnect (HDBC hdbc
);
223 RETCODE SQL_API
SQLFreeEnv (HENV henv
);
224 RETCODE SQL_API
SQLFreeStmt (HSTMT hstmt
, UWORD fOption
);
225 RETCODE SQL_API
SQLGetCursorName (HSTMT hstmt
, UCHAR FAR
* szCursor
,
226 SWORD cbCursorMax
, SWORD FAR
* pcbCursor
);
227 RETCODE SQL_API
SQLNumResultCols (HSTMT hstmt
, SWORD FAR
* pccol
);
228 RETCODE SQL_API
SQLPrepare (HSTMT hstmt
, UCHAR FAR
* szSqlStr
,
230 RETCODE SQL_API
SQLRowCount (HSTMT hstmt
, SDWORD FAR
* pcrow
);
231 RETCODE SQL_API
SQLSetCursorName (HSTMT hstmt
, UCHAR FAR
* szCursor
,
233 RETCODE SQL_API
SQLTransact (HENV henv
, HDBC hdbc
, UWORD fType
);
236 * Depreciated ODBC 1.0 function - Use SQLBindParameter
238 RETCODE SQL_API
SQLSetParam (HSTMT hstmt
, UWORD ipar
, SWORD fCType
,
239 SWORD fSqlType
, UDWORD cbColDef
, SWORD ibScale
, PTR rgbValue
,
240 SDWORD FAR
* pcbValue
);