rpm  5.4.15
rpmodbc.h
Go to the documentation of this file.
1 #ifndef H_RPMODBC
2 #define H_RPMODBC
3 
10 /*@unchecked@*/
11 extern int _odbc_debug;
12 
15 typedef /*@refcounted@*/ struct ODBC_s * ODBC_t;
16 typedef struct HNDL_s * HNDL_t;
17 
18 typedef struct _STMT_s * _STMT_t;
19 typedef struct _PARAM_s * _PARAM_t;
20 
21 #if defined(_RPMODBC_INTERNAL)
22 #if !defined(SQL_HANDLE_STMT) /* XXX retrofit <sql.h> constants. */
23 #define SQL_HANDLE_ENV 1
24 #define SQL_HANDLE_DBC 2
25 #define SQL_HANDLE_STMT 3
26 #define SQL_HANDLE_DESC 4
27 #define SQLHANDLE void
28 #endif
29 
30 struct HNDL_s {
31  int ht;
32  void * hp;
33 };
34 
37 struct ODBC_s {
38  struct rpmioItem_s _item;
39  const char * fn;
40  int flags;
41 
42  void * u;
43  const char * db;
44 
45  HNDL_t env;
46  HNDL_t dbc;
47  HNDL_t stmt;
48  HNDL_t desc;
49 
50  int ncols;
51  int nrows;
52  int cx;
53  int rx;
54 
55 #if defined(__LCLINT__)
56 /*@refs@*/
57  int nrefs;
58 #endif
59 };
60 
61 struct _PARAM_s { /* XXX remapped from <sqltypes.h> */
62  unsigned short ParameterNumber;
63  short InputOutputType;
64  short ValueType;
65  short ParameterType;
66  unsigned long ColumnSize;
67  short DecimalDigits;
68  void * ParameterValuePtr;
69  long BufferLength;
70  long * StrLen_or_IndPtr;
71 };
72 
73 struct _STMT_s {
74  const char * sql;
75  _PARAM_t * params;
76 };
77 #endif /* _RPMODBC_INTERNAL */
78 
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82 
88 /*@unused@*/ /*@null@*/
89 ODBC_t odbcUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ ODBC_t odbc)
90  /*@modifies odbc @*/;
91 #define odbcUnlink(_odbc) \
92  ((ODBC_t)rpmioUnlinkPoolItem((rpmioItem)(_odbc), __FUNCTION__, __FILE__, __LINE__))
93 
99 /*@unused@*/ /*@newref@*/ /*@null@*/
100 ODBC_t odbcLink (/*@null@*/ ODBC_t odbc)
101  /*@modifies odbc @*/;
102 #define odbcLink(_odbc) \
103  ((ODBC_t)rpmioLinkPoolItem((rpmioItem)(_odbc), __FUNCTION__, __FILE__, __LINE__))
104 
110 /*@null@*/
111 ODBC_t odbcFree(/*@killref@*/ /*@null@*/ODBC_t odbc)
112  /*@globals fileSystem @*/
113  /*@modifies odbc, fileSystem @*/;
114 #define odbcFree(_odbc) \
115  ((ODBC_t)rpmioFreePoolItem((rpmioItem)(_odbc), __FUNCTION__, __FILE__, __LINE__))
116 
123 /*@newref@*/ /*@null@*/
124 ODBC_t odbcNew(const char * fn, int flags)
125  /*@globals fileSystem, internalState @*/
126  /*@modifies fileSystem, internalState @*/;
127 
128 int odbcGetEnvAttr(ODBC_t odbc, int _type, void * _bp, int _nb, int * nsp)
129  /*@*/;
130 int odbcSetEnvAttr(ODBC_t odbc, int _type, void * _bp, int ns)
131  /*@*/;
132 int odbcGetInfo(ODBC_t odbc, int _type, void * _bp, int _nb, short * nsp)
133  /*@*/;
134 int odbcGetStmtAttr(ODBC_t odbc, int _attr, void * _bp, int _nb, int * nsp)
135  /*@*/;
136 int odbcSetStmtAttr(ODBC_t odbc, int _attr, void * _bp, int ns)
137  /*@*/;
138 
139 int odbcConnect(ODBC_t odbc, /*@null@*/ const char * uri)
140  /*@*/;
141 int odbcDisconnect(ODBC_t odbc)
142  /*@*/;
143 
144 int odbcListDataSources(ODBC_t odbc, void *_fp)
145  /*@*/;
146 int odbcListDrivers(ODBC_t odbc, void *_fp)
147  /*@*/;
148 
149 int odbcTables(ODBC_t odbc, const char * tblname)
150  /*@*/;
151 int odbcColumns(ODBC_t odbc, const char * tblname, const char * colname)
152  /*@*/;
153 int odbcStatistics(ODBC_t odbc, const char * tblname)
154  /*@*/;
155 
156 int odbcCloseCursor(ODBC_t odbc)
157  /*@*/;
158 const char * odbcGetCursorName(ODBC_t odbc)
159  /*@*/;
160 int odbcSetCursorName(ODBC_t odbc, const char * s, size_t ns)
161  /*@*/;
162 
163 int odbcEndTran(ODBC_t odbc, int _rollback)
164  /*@*/;
165 int odbcCommit(ODBC_t odbc)
166  /*@*/;
167 int odbcRollback(ODBC_t odbc)
168  /*@*/;
169 
170 int odbcNRows(ODBC_t odbc)
171  /*@*/;
172 int odbcNCols(ODBC_t odbc)
173  /*@*/;
174 int odbcCancel(ODBC_t odbc)
175  /*@*/;
176 int odbcFetch(ODBC_t odbc)
177  /*@*/;
178 int odbcFetchScroll(ODBC_t odbc, short FetchOrientation, long FetchOffset)
179  /*@*/;
180 int odbcGetData(ODBC_t odbc,
181  unsigned short Col_or_Param_Num,
182  short TargetType,
183  void * TargetValuePtr,
184  long BufferLength,
185  long * StrLen_or_IndPtr)
186  /*@*/;
187 int odbcColAttribute(ODBC_t odbc,
188  unsigned short ColumnNumber,
189  unsigned short FieldIdentifier,
190  void * CharacterAttributePtr,
191  short BufferLength,
192  short * StringLengthPtr,
193  long * NumericAttributePtr)
194  /*@*/;
195 
196 int odbcPrint(ODBC_t odbc, void * _fp)
197  /*@*/;
198 
199 int odbcExecDirect(ODBC_t odbc, const char * s, size_t ns)
200  /*@*/;
201 
202 int odbcPrepare(ODBC_t odbc, const char * s, size_t ns)
203  /*@*/;
204 
205 int odbcBindCol(ODBC_t odbc, unsigned short ColumnNumber, short TargetType,
206  void * TargetValuePtr, long BufferLength, long * StrLen_or_Ind)
207  /*@*/;
208 int odbcBindParameter(ODBC_t odbc, _PARAM_t param)
209  /*@*/;
210 
211 int odbcExecute(ODBC_t odbc)
212  /*@*/;
213 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 #endif /* H_RPMODBC */
int odbcColumns(ODBC_t odbc, const char *tblname, const char *colname)
Definition: rpmodbc.c:1074
int odbcGetEnvAttr(ODBC_t odbc, int _type, void *_bp, int _nb, int *nsp)
Definition: rpmodbc.c:569
int odbcFetchScroll(ODBC_t odbc, short FetchOrientation, long FetchOffset)
Definition: rpmodbc.c:954
int odbcGetStmtAttr(ODBC_t odbc, int _attr, void *_bp, int _nb, int *nsp)
Definition: rpmodbc.c:258
int odbcCloseCursor(ODBC_t odbc)
Definition: rpmodbc.c:687
int odbcSetEnvAttr(ODBC_t odbc, int _type, void *_bp, int ns)
Definition: rpmodbc.c:579
int odbcTables(ODBC_t odbc, const char *tblname)
Definition: rpmodbc.c:1054
#define odbcUnlink(_odbc)
Definition: rpmodbc.h:91
int odbcExecute(ODBC_t odbc)
Definition: rpmodbc.c:1196
struct ODBC_s * ODBC_t
Definition: rpmodbc.h:15
int odbcGetData(ODBC_t odbc, unsigned short Col_or_Param_Num, short TargetType, void *TargetValuePtr, long BufferLength, long *StrLen_or_IndPtr)
Definition: rpmodbc.c:967
int odbcCancel(ODBC_t odbc)
Definition: rpmodbc.c:927
int odbcPrepare(ODBC_t odbc, const char *s, size_t ns)
Definition: rpmodbc.c:1135
int odbcSetStmtAttr(ODBC_t odbc, int _attr, void *_bp, int ns)
Definition: rpmodbc.c:269
int odbcNRows(ODBC_t odbc)
Definition: rpmodbc.c:897
struct HNDL_s * HNDL_t
Definition: rpmodbc.h:16
int odbcExecDirect(ODBC_t odbc, const char *s, size_t ns)
Definition: rpmodbc.c:1114
int odbcPrint(ODBC_t odbc, void *_fp)
Definition: rpmodbc.c:990
int odbcRollback(ODBC_t odbc)
Definition: rpmodbc.c:757
int odbcSetCursorName(ODBC_t odbc, const char *s, size_t ns)
Definition: rpmodbc.c:721
int odbcFetch(ODBC_t odbc)
Definition: rpmodbc.c:941
int odbcEndTran(ODBC_t odbc, int _rollback)
Definition: rpmodbc.c:738
struct _STMT_s * _STMT_t
Definition: rpmodbc.h:18
int odbcBindCol(ODBC_t odbc, unsigned short ColumnNumber, short TargetType, void *TargetValuePtr, long BufferLength, long *StrLen_or_Ind)
Definition: rpmodbc.c:1159
const char const bson int mongo_write_concern int flags
Definition: mongo.h:485
int odbcStatistics(ODBC_t odbc, const char *tblname)
Definition: rpmodbc.c:1094
int odbcNCols(ODBC_t odbc)
Definition: rpmodbc.c:912
int odbcGetInfo(ODBC_t odbc, int _type, void *_bp, int _nb, short *nsp)
Definition: rpmodbc.c:513
int odbcConnect(ODBC_t odbc, const char *uri)
Definition: rpmodbc.c:764
const char * db
Definition: mongo.h:697
ODBC_t odbcNew(const char *fn, int flags)
Create and load a odbc wrapper.
Definition: rpmodbc.c:1246
int _odbc_debug
Definition: rpmodbc.c:24
#define odbcFree(_odbc)
Definition: rpmodbc.h:114
int odbcBindParameter(ODBC_t odbc, _PARAM_t param)
Definition: rpmodbc.c:1176
int odbcCommit(ODBC_t odbc)
Definition: rpmodbc.c:752
int odbcListDrivers(ODBC_t odbc, void *_fp)
Definition: rpmodbc.c:864
int odbcColAttribute(ODBC_t odbc, unsigned short ColumnNumber, unsigned short FieldIdentifier, void *CharacterAttributePtr, short BufferLength, short *StringLengthPtr, long *NumericAttributePtr)
Definition: rpmodbc.c:660
int odbcListDataSources(ODBC_t odbc, void *_fp)
Definition: rpmodbc.c:831
#define odbcLink(_odbc)
Definition: rpmodbc.h:102
const char * odbcGetCursorName(ODBC_t odbc)
Definition: rpmodbc.c:700
int odbcDisconnect(ODBC_t odbc)
Definition: rpmodbc.c:814
const char * ns
Definition: mongo.h:326
struct _PARAM_s * _PARAM_t
Definition: rpmodbc.h:19