/ Fetch next document. */ /
| 519 | /* Fetch next document. */ |
| 520 | /***********************************************************************/ |
| 521 | int CMgoConn::ReadNext(PGLOBAL g) |
| 522 | { |
| 523 | int rc = RC_OK; |
| 524 | |
| 525 | if (!Cursor && MakeCursor(g)) { |
| 526 | rc = RC_FX; |
| 527 | } else if (mongoc_cursor_next(Cursor, &Document)) { |
| 528 | if (trace(512)) { |
| 529 | bson_iter_t iter; |
| 530 | ShowDocument(&iter, Document, ""); |
| 531 | } else if (trace(1)) |
| 532 | htrc("%s\n", GetDocument(g)); |
| 533 | |
| 534 | } else if (mongoc_cursor_error(Cursor, &Error)) { |
| 535 | snprintf(g->Message, sizeof(g->Message), "Mongo Cursor Failure: %s", Error.message); |
| 536 | rc = RC_FX; |
| 537 | } else |
| 538 | rc = RC_EF; |
| 539 | |
| 540 | return rc; |
| 541 | } // end of Fetch |
| 542 | |
| 543 | /***********************************************************************/ |
| 544 | /* Get the Json string of the current document. */ |