Refactor error handling and query running.
PHP-1063: Refactor out MongoCursor:__construct() and used it with find() and findOne()

A new API is needed for cursor instantiation still.
MONGO_METHOD -= 5
Put back the options so that MongoCommandCursor gets a 64bit int object.
So next() and getNext() behave differently if the query hadn't been run yet.

*Theoretically* next() and getNext() should always advance to the next element
first. But the MongoDB driver originally did something different if the query
hadn't been executed yet. It would then run the query, and return the *first*
element.

This commit "fixes" that old behaviour again.
Don't continue iterating after limit has been reached.
Remove MONGO_METHOD in do_gle_op.
Keep await_data and get_more without a limit set working.
Fixed memory leak and error detection with findOne.
Removed superfluous code.
Fixed checking for dead-ness.
Make sure to handle cursor errors with getmore.
We need to check the error after having obtained the result.

In some cases (maxtimems) the server puts the error information in a returned
document, which we of course need to parse before checking for.
Fixed the gridfs functionality

MONGO_METHOD--
Fixed memory errors after running valgrind.
ZTS fixes.
Implement Jeremy's review points.
Implement Hannes' review comments.
PHP-1241: Change MongoCursor::info()['at'] to zero-based indexing.

MongoCursor::info()['at'] indexing currently starts at 1. This appears to be an
arbitrary legacy quirk and should be changed to 0, which will make it
consistent with MongoCommandCursor.
Aliased MongoCursor::getNext() to MongoCursor::next()

The code for MongoCursor::getNext() and MongoCursor::next() was exactly the
same, and it made little sense to keep both of them around. I had to change the
MONGO_METHOD calls around the code as well, as you can't MONGO_METHOD an
aliased function.
PHP-820: Extract MongoCollection::__construct, MongoDB::__construct, MongoClient::selectDB and MongoClient::selectCollection into C functions