fix for trie index
[csql.git] / src / odbc / odbcDbc.h
blob1046e756d48d7309d05c212eb7ba2ad46ab67ec5
1 // Class CSqlOdbcDbc
2 // Description: Database Connection Handle manager.
4 #ifndef _ODBC_DBC_H_
5 #define _ODBC_DBC_H_
6 #include<SqlFactory.h>
7 // State's of Connection Handle.
8 typedef enum
9 {
10 C0, // henv not allocated,hdbc not allocated
11 C1, // henv allocated,hdbc not allocated
12 C2, // henv allocated,hdbc allocated
13 C3, // Connection function needs data
14 C4, // Connected hdbc
15 C5, // Connected hdbc, allocated statement
16 C6 // Connected hdbc, Transaction in progress
17 } DbcState_t ;
19 class CSqlOdbcDbc
21 CSqlOdbcDbc(void); // Should not create obj without using SQLAllocHandle
23 public:
24 // Top 2 variable declaration should not be moved down.
25 int handleType_; // Handle type.
26 CSqlOdbcError err_; // Last error info.
28 DbcState_t state_; // Environment State.
29 CSqlOdbcEnv *parentEnv_; // Parent Environment Handle.
30 List stmtList_; // Statement handle list.
31 List descList_; // Descriptor handle list.
32 AbsSqlConnection *fsqlConn_; // CSQL connection object
33 int mode_; //1->csql , 2->gateway
34 SQLUINTEGER curAccessMode_;
35 IsolationLevel curIsolationLevel_;
36 List stmtHdlList_;
37 // Connection Attributes
38 SQLUINTEGER accessMode_; // Transaction access mode
39 // SQL_MODE_READ_ONLY OR
40 // SQL_MODE_READ_WRITE
42 IsolationLevel isolationLevel_;// Transaction Isolation Level.
43 // SQL_TXN_READ_UNCOMMITTED
44 // SQL_TXN_READ_COMMITTED
45 // SQL_TXN_REPEATABLE_READ
46 // SQL_TXN_SERIALIZABLE
48 SQLUINTEGER autoCommit_; // Automatically Commit after execution.
49 // SQL_AUTOCOMMIT_ON
50 // SQL_AUTOCOMMIT_OFF
52 // METHODS
53 // State Transition
54 SQLRETURN chkStateForSQLFreeHandle( void );
55 SQLRETURN chkStateForSQLConnect( void );
56 SQLRETURN chkStateForSQLDisconnect( void );
57 SQLRETURN chkStateForSQLEndTran( void );
58 SQLRETURN chkStateForSQLSetConnectAttr( void );
60 // ODBC API's
61 static SQLRETURN SQLAllocHandle(
62 SQLHANDLE inputHandle, // IN
63 SQLHANDLE *outputHandle );// OUT
65 static SQLRETURN SQLFreeHandle(
66 SQLHANDLE inputHandle); // IN
68 SQLRETURN SQLConnect( // All param's are IN
69 SQLCHAR *serverName,
70 SQLSMALLINT len1,
71 SQLCHAR *user,
72 SQLSMALLINT len2,
73 SQLCHAR *pass,
74 SQLSMALLINT len3);
76 SQLRETURN SQLDisconnect();
78 SQLRETURN SQLEndTran(
79 SQLSMALLINT completionType);// IN
81 SQLRETURN SQLSetConnectAttr(
82 SQLINTEGER attribute, // IN
83 SQLPOINTER value, // IN
84 SQLINTEGER stringLength); // IN
86 SQLRETURN SQLGetConnectAttr(
87 SQLINTEGER attribute, // IN
88 SQLPOINTER value, // OUT
89 SQLINTEGER bufferLength, // IN
90 SQLINTEGER *stringLength); // OUT
92 SQLRETURN SQLGetFunctions(
93 SQLUSMALLINT FunctionId,
94 SQLUSMALLINT * SupportedPtr
95 );
98 SQLRETURN SQLGetInfo(
99 SQLUSMALLINT InfoType,
100 SQLPOINTER InfoValuePtr,
101 SQLSMALLINT BufferLength,
102 SQLSMALLINT * StringLengthPtr);
106 // Others
107 char *getFromUrl(char *url,char *name);
110 #endif // _ODBC_DBC_H_