Changeset 388 for python/vendor/current/Modules/bsddb.h
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Modules/bsddb.h
r2 r388 62 62 * http://www.python.org/peps/pep-0291.html 63 63 * 64 * This module contains 6types:64 * This module contains 7 types: 65 65 * 66 66 * DB (Database) … … 70 70 * DBLock (A lock handle) 71 71 * DBSequence (Sequence) 72 * DBSite (Site) 73 * 74 * New datatypes: 75 * 76 * DBLogCursor (Log Cursor) 72 77 * 73 78 */ … … 106 111 #endif 107 112 108 #define PY_BSDDB_VERSION " 4.7.3"113 #define PY_BSDDB_VERSION "5.3.0" 109 114 110 115 /* Python object definitions */ … … 123 128 struct DBObject; /* Forward declaration */ 124 129 struct DBCursorObject; /* Forward declaration */ 130 struct DBLogCursorObject; /* Forward declaration */ 125 131 struct DBTxnObject; /* Forward declaration */ 126 132 struct DBSequenceObject; /* Forward declaration */ 133 #if (DBVER >= 52) 134 struct DBSiteObject; /* Forward declaration */ 135 #endif 127 136 128 137 typedef struct { … … 135 144 struct DBObject *children_dbs; 136 145 struct DBTxnObject *children_txns; 146 struct DBLogCursorObject *children_logcursors; 147 #if (DBVER >= 52) 148 struct DBSiteObject *children_sites; 149 #endif 137 150 PyObject *private_obj; 138 151 PyObject *rep_transport; … … 146 159 u_int32_t flags; /* saved flags from open() */ 147 160 u_int32_t setflags; /* saved flags from set_flags() */ 148 int haveStat;149 161 struct behaviourFlags moduleFlags; 150 162 struct DBTxnObject *txn; 151 163 struct DBCursorObject *children_cursors; 152 #if (DBVER >=43)153 164 struct DBSequenceObject *children_sequences; 154 #endif155 165 struct DBObject **sibling_prev_p; 156 166 struct DBObject *sibling_next; … … 159 169 PyObject* associateCallback; 160 170 PyObject* btCompareCallback; 171 PyObject* dupCompareCallback; 161 172 int primaryDBType; 162 173 PyObject *private_obj; … … 194 205 195 206 207 typedef struct DBLogCursorObject { 208 PyObject_HEAD 209 DB_LOGC* logc; 210 DBEnvObject* env; 211 struct DBLogCursorObject **sibling_prev_p; 212 struct DBLogCursorObject *sibling_next; 213 PyObject *in_weakreflist; /* List of weak references */ 214 } DBLogCursorObject; 215 216 #if (DBVER >= 52) 217 typedef struct DBSiteObject { 218 PyObject_HEAD 219 DB_SITE *site; 220 DBEnvObject *env; 221 struct DBSiteObject **sibling_prev_p; 222 struct DBSiteObject *sibling_next; 223 PyObject *in_weakreflist; /* List of weak references */ 224 } DBSiteObject; 225 #endif 226 196 227 typedef struct { 197 228 PyObject_HEAD 198 229 DB_LOCK lock; 230 int lock_initialized; /* Signal if we actually have a lock */ 199 231 PyObject *in_weakreflist; /* List of weak references */ 200 232 } DBLockObject; 201 233 202 234 203 #if (DBVER >= 43)204 235 typedef struct DBSequenceObject { 205 236 PyObject_HEAD … … 213 244 PyObject *in_weakreflist; /* List of weak references */ 214 245 } DBSequenceObject; 215 #endif216 246 217 247 … … 221 251 following (error checking missed out for clarity): 222 252 253 // If you are using Python before 2.7: 223 254 BSDDB_api* bsddb_api; 224 255 PyObject* mod; … … 232 263 Py_DECREF(mod); 233 264 265 266 // If you are using Python 2.7 or up: (except Python 3.0, unsupported) 267 BSDDB_api* bsddb_api; 268 269 // Use "bsddb3._pybsddb.api" if you're using 270 // the standalone pybsddb add-on. 271 bsddb_api = (void **)PyCapsule_Import("bsddb._bsddb.api", 1); 272 273 274 Check "api_version" number before trying to use the API. 275 234 276 The structure's members must not be changed. 235 277 */ 236 278 279 #define PYBSDDB_API_VERSION 1 237 280 typedef struct { 281 unsigned int api_version; 238 282 /* Type objects */ 239 283 PyTypeObject* db_type; 240 284 PyTypeObject* dbcursor_type; 285 PyTypeObject* dblogcursor_type; 241 286 PyTypeObject* dbenv_type; 242 287 PyTypeObject* dbtxn_type; 243 288 PyTypeObject* dblock_type; 244 #if (DBVER >= 43)245 289 PyTypeObject* dbsequence_type; 246 #endif247 290 248 291 /* Functions */ 249 292 int (*makeDBError)(int err); 250 251 293 } BSDDB_api; 252 294 … … 264 306 #define DBTxnObject_Check(v) ((v)->ob_type == bsddb_api->dbtxn_type) 265 307 #define DBLockObject_Check(v) ((v)->ob_type == bsddb_api->dblock_type) 266 # if (DBVER >= 43)267 #define DBSequenceObject_Check(v) ((v)->ob_type == bsddb_api->dbsequence_type) 268 #endif 308 #define DBSequenceObject_Check(v) \ 309 ((bsddb_api->dbsequence_type) && \ 310 ((v)->ob_type == bsddb_api->dbsequence_type)) 269 311 270 312 #endif /* COMPILING_BSDDB_C */
Note:
See TracChangeset
for help on using the changeset viewer.