/ OpenDB: Data Base open routine for MONGO access method. */ /
| 302 | /* OpenDB: Data Base open routine for MONGO access method. */ |
| 303 | /***********************************************************************/ |
| 304 | bool TDBJMG::OpenDB(PGLOBAL g) |
| 305 | { |
| 306 | if (Use == USE_OPEN) { |
| 307 | /*******************************************************************/ |
| 308 | /* Table already open replace it at its beginning. */ |
| 309 | /*******************************************************************/ |
| 310 | if (Jcp->Rewind()) |
| 311 | return true; |
| 312 | |
| 313 | Fpos = -1; |
| 314 | return false; |
| 315 | } // endif Use |
| 316 | |
| 317 | /*********************************************************************/ |
| 318 | /* First opening. */ |
| 319 | /*********************************************************************/ |
| 320 | if (Pipe && Mode != MODE_READ) { |
| 321 | snprintf(g->Message, sizeof(g->Message), "Pipeline tables are read only"); |
| 322 | return true; |
| 323 | } // endif Pipe |
| 324 | |
| 325 | Use = USE_OPEN; // Do it now in case we are recursively called |
| 326 | |
| 327 | if (Init(g)) |
| 328 | return true; |
| 329 | |
| 330 | if (Jcp->GetMethodId(g, Mode)) |
| 331 | return true; |
| 332 | |
| 333 | if (Mode == MODE_DELETE && !Next) { |
| 334 | // Delete all documents |
| 335 | if (!Jcp->MakeCursor(g, this, "all", Filter, false)) |
| 336 | if (Jcp->DocDelete(g, true) == RC_OK) |
| 337 | return false; |
| 338 | |
| 339 | return true; |
| 340 | } // endif Mode |
| 341 | |
| 342 | if (Mode == MODE_INSERT) |
| 343 | Jcp->MakeColumnGroups(g, this); |
| 344 | |
| 345 | if (Mode != MODE_UPDATE) |
| 346 | return Jcp->MakeCursor(g, this, Options, Filter, Pipe); |
| 347 | |
| 348 | return false; |
| 349 | } // end of OpenDB |
| 350 | |
| 351 | /***********************************************************************/ |
| 352 | /* Data Base indexed read routine for ODBC access method. */ |
nothing calls this directly
no test coverage detected