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