| 231 | construct_cursor(PyObject *self, PyObject *args); |
| 232 | |
| 233 | static PyObject * |
| 234 | env_create_db(UpsEnvironment *self, PyObject *args) |
| 235 | { |
| 236 | ups_status_t st; |
| 237 | int name = 0; |
| 238 | uint32_t flags = 0; |
| 239 | PyObject *extargs = 0; |
| 240 | std::vector<ups_parameter_t> params; |
| 241 | |
| 242 | if (!PyArg_ParseTuple(args, "i|iO!:create_db", &name, &flags, |
| 243 | &PyTuple_Type, &extargs)) |
| 244 | return (0); |
| 245 | |
| 246 | if (extargs) { |
| 247 | if (!parse_parameters(extargs, params)) |
| 248 | return (0); |
| 249 | } |
| 250 | |
| 251 | UpsDatabase *db = (UpsDatabase *)construct_db(0, 0); |
| 252 | if (!db) |
| 253 | return (0); |
| 254 | |
| 255 | st = ups_env_create_db(self->env, &db->db, (uint16_t)name, flags, |
| 256 | extargs ? ¶ms[0] : 0); |
| 257 | if (st) { |
| 258 | db_dealloc(db); |
| 259 | THROW(st); |
| 260 | } |
| 261 | |
| 262 | db->flags = flags; |
| 263 | ups_set_context_data(db->db, db); |
| 264 | |
| 265 | /* add the new database to the environment */ |
| 266 | if (!self->dblist) { |
| 267 | self->dblist = PyList_New(10); |
| 268 | if (!self->dblist) |
| 269 | return (0); |
| 270 | } |
| 271 | if (PyList_Append(self->dblist, (PyObject *)db)) |
| 272 | return (0); |
| 273 | Py_INCREF(db); |
| 274 | |
| 275 | return ((PyObject *)db); |
| 276 | } |
| 277 | |
| 278 | static PyObject * |
| 279 | env_open_db(UpsEnvironment *self, PyObject *args) |
nothing calls this directly
no test coverage detected