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