]> git.saurik.com Git - wxWidgets.git/blob - src/iodbc/henv.h
iODBC v2.5
[wxWidgets.git] / src / iodbc / henv.h
1 /*
2 * henv.h
3 *
4 * $Id$
5 *
6 * Environment object management functions
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 _HENV_H
27 #define _HENV_H
28
29 #include <config.h>
30 #include <dlproc.h>
31
32 #include <isql.h>
33 #include <isqlext.h>
34
35 enum
36 {
37
38 #if (ODBCVER >= 0x0300)
39 en_AllocHandle = SQL_API_SQLALLOCHANDLE,
40 en_FreeHandle = SQL_API_SQLFREEHANDLE,
41 #endif
42
43 en_AllocEnv = SQL_API_SQLALLOCENV,
44 en_AllocConnect = SQL_API_SQLALLOCCONNECT,
45 en_Connect = SQL_API_SQLCONNECT,
46 en_DriverConnect = SQL_API_SQLDRIVERCONNECT,
47 en_BrowseConnect = SQL_API_SQLBROWSECONNECT,
48
49 en_DataSources = SQL_API_SQLDATASOURCES,
50 en_Drivers = SQL_API_SQLDRIVERS,
51 en_GetInfo = SQL_API_SQLGETINFO,
52 en_GetFunctions = SQL_API_SQLGETFUNCTIONS,
53 en_GetTypeInfo = SQL_API_SQLGETTYPEINFO,
54
55 en_SetConnectOption = SQL_API_SQLSETCONNECTOPTION,
56 en_GetConnectOption = SQL_API_SQLGETCONNECTOPTION,
57 en_SetStmtOption = SQL_API_SQLSETSTMTOPTION,
58 en_GetStmtOption = SQL_API_SQLGETSTMTOPTION,
59
60 en_AllocStmt = SQL_API_SQLALLOCSTMT,
61 en_Prepare = SQL_API_SQLPREPARE,
62 en_BindParameter = SQL_API_SQLBINDPARAMETER,
63 en_ParamOptions = SQL_API_SQLPARAMOPTIONS,
64 en_GetCursorName = SQL_API_SQLGETCURSORNAME,
65 en_SetCursorName = SQL_API_SQLSETCURSORNAME,
66 en_SetScrollOptions = SQL_API_SQLSETSCROLLOPTIONS,
67 en_SetParam = SQL_API_SQLSETPARAM,
68
69 en_Execute = SQL_API_SQLEXECUTE,
70 en_ExecDirect = SQL_API_SQLEXECDIRECT,
71 en_NativeSql = SQL_API_SQLNATIVESQL,
72 en_DescribeParam = SQL_API_SQLDESCRIBEPARAM,
73 en_NumParams = SQL_API_SQLNUMPARAMS,
74 en_ParamData = SQL_API_SQLPARAMDATA,
75 en_PutData = SQL_API_SQLPUTDATA,
76
77 en_RowCount = SQL_API_SQLROWCOUNT,
78 en_NumResultCols = SQL_API_SQLNUMRESULTCOLS,
79 en_DescribeCol = SQL_API_SQLDESCRIBECOL,
80 en_ColAttributes = SQL_API_SQLCOLATTRIBUTES,
81 en_BindCol = SQL_API_SQLBINDCOL,
82 en_Fetch = SQL_API_SQLFETCH,
83 en_ExtendedFetch = SQL_API_SQLEXTENDEDFETCH,
84 en_GetData = SQL_API_SQLGETDATA,
85 en_SetPos = SQL_API_SQLSETPOS,
86 en_MoreResults = SQL_API_SQLMORERESULTS,
87 en_Error = SQL_API_SQLERROR,
88
89 en_ColumnPrivileges = SQL_API_SQLCOLUMNPRIVILEGES,
90 en_Columns = SQL_API_SQLCOLUMNS,
91 en_ForeignKeys = SQL_API_SQLFOREIGNKEYS,
92 en_PrimaryKeys = SQL_API_SQLPRIMARYKEYS,
93 en_ProcedureColumns = SQL_API_SQLPROCEDURECOLUMNS,
94 en_Procedures = SQL_API_SQLPROCEDURES,
95 en_SpecialColumns = SQL_API_SQLSPECIALCOLUMNS,
96 en_Statistics = SQL_API_SQLSTATISTICS,
97 en_TablePrivileges = SQL_API_SQLTABLEPRIVILEGES,
98 en_Tables = SQL_API_SQLTABLES,
99
100 en_FreeStmt = SQL_API_SQLFREESTMT,
101 en_Cancel = SQL_API_SQLCANCEL,
102 en_Transact = SQL_API_SQLTRANSACT,
103
104 en_Disconnect = SQL_API_SQLDISCONNECT,
105 en_FreeConnect = SQL_API_SQLFREECONNECT,
106 en_FreeEnv = SQL_API_SQLFREEENV,
107
108 en_NullProc = SYSERR
109 };
110
111 typedef struct
112 {
113 int type; /* must be 1st field */
114
115 HENV henv; /* driver's env list */
116 HDBC hdbc; /* driver's dbc list */
117 HERR herr; /* err list */
118 int state;
119 }
120 GENV_t;
121
122 typedef struct
123 {
124 HENV next; /* next attached env handle */
125 int refcount; /* Driver's bookkeeping reference count */
126 HPROC dllproc_tab[SQL_EXT_API_LAST + 1]; /* driver api calls */
127
128 HENV dhenv; /* driver env handle */
129 HDLL hdll; /* drvier share library handle */
130 }
131 ENV_t;
132
133 /* Note:
134
135 * - ODBC applications only know about global environment handle,
136 * a void pointer points to a GENV_t object. There is only one
137 * this object per process(however, to make the library reentrant,
138 * we still keep this object on heap). Applications only know
139 * address of this object and needn't care about its detail.
140 *
141 * - ODBC driver manager knows about instance environment handles,
142 * void pointers point to ENV_t objects. There are maybe more
143 * than one this kind of objects per process. However, multiple
144 * connections to a same data source(i.e. call same share library)
145 * will share one instance environment object.
146 *
147 * - ODBC drvier manager knows about their own environemnt handle,
148 * a void pointer point to a driver defined object. Every driver
149 * keeps one of its own environment object and driver manager
150 * keeps address of it by the 'dhenv' field in the instance
151 * environment object without care about its detail.
152 *
153 * - Applications can get driver's environment object handle by
154 * SQLGetInfo() with fInfoType equals to SQL_DRIVER_HENV
155 */
156 #endif