1/*
2 *  hdbc.h
3 *
4 *  $Id: hdbc.h 1446 1999-01-22 10:52:42Z RR $
5 *
6 *  Data source connect 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	_HDBC_H
27#define	_HDBC_H
28
29typedef struct DBC
30  {
31    int type;			/* must be 1st field */
32    struct DBC FAR *
33     next;
34
35    HENV genv;			/* back point to global env object */
36
37    HDBC dhdbc;			/* driver's private dbc */
38    HENV henv;			/* back point to instant env object */
39    HSTMT hstmt;		/* list of statement object handle(s) */
40    HERR herr;
41
42    int state;
43
44    /* options */
45    UDWORD access_mode;
46    UDWORD autocommit;
47
48    UDWORD login_timeout;
49    UDWORD odbc_cursors;
50    UDWORD packet_size;
51    UDWORD quiet_mode;
52    UDWORD txn_isolation;
53    SWORD cb_commit;
54    SWORD cb_rollback;
55
56    char FAR *
57     current_qualifier;
58
59    int trace;			/* trace flag */
60    char FAR *
61     tfile;
62    void FAR *
63     tstm;			/* trace stream */
64  }
65DBC_t;
66
67/*
68 * Note:
69 *  - ODBC applications can see address of driver manager's
70 *    connection object, i.e connection handle -- a void pointer,
71 *    but not detail of it. ODBC applications can neither see
72 *    detail driver's connection object nor its address.
73 *
74 *  - ODBC driver manager knows its own connection objects and
75 *    exposes their address to an ODBC application. Driver manager
76 *    also knows address of driver's connection objects and keeps
77 *    it via dhdbc field in driver manager's connection object.
78 *
79 *  - ODBC driver exposes address of its own connection object to
80 *    driver manager without detail.
81 *
82 *  - Applications can get driver's connection object handle by
83 *    SQLGetInfo() with fInfoType equals to SQL_DRIVER_HDBC.
84 */
85
86enum
87  {
88    en_dbc_allocated,
89    en_dbc_needdata,
90    en_dbc_connected,
91    en_dbc_hstmt
92  };
93#endif
94