/ OpenTableFile: Open a MongoDB table. */ /
| 218 | /* OpenTableFile: Open a MongoDB table. */ |
| 219 | /***********************************************************************/ |
| 220 | bool JMGFAM::OpenTableFile(PGLOBAL g) |
| 221 | { |
| 222 | Mode = Tdbp->GetMode(); |
| 223 | |
| 224 | if (Pipe && Mode != MODE_READ) { |
| 225 | strcpy(g->Message, "Pipeline tables are read only"); |
| 226 | return true; |
| 227 | } // endif Pipe |
| 228 | |
| 229 | if (Init(g)) |
| 230 | return true; |
| 231 | |
| 232 | if (Jcp->GetMethodId(g, Mode)) |
| 233 | return true; |
| 234 | |
| 235 | if (Mode == MODE_DELETE && !Tdbp->GetNext()) { |
| 236 | // Delete all documents |
| 237 | if (!Jcp->MakeCursor(g, Tdbp, "all", Filter, false)) |
| 238 | if (Jcp->DocDelete(g, true) == RC_OK) |
| 239 | return false; |
| 240 | |
| 241 | return true; |
| 242 | } // endif Mode |
| 243 | |
| 244 | //if (Mode == MODE_INSERT) |
| 245 | // Jcp->MakeColumnGroups(g, Tdbp); |
| 246 | |
| 247 | if (Mode != MODE_UPDATE) |
| 248 | return Jcp->MakeCursor(g, Tdbp, Options, Filter, Pipe); |
| 249 | |
| 250 | return false; |
| 251 | } // end of OpenTableFile |
| 252 | |
| 253 | /***********************************************************************/ |
| 254 | /* GetRowID: return the RowID of last read record. */ |
nothing calls this directly
no test coverage detected