Commit Graph

249 Commits

Author SHA1 Message Date
Jeremy Mikola 145ddda493 PHPC-353: Return early when there are no options to apply
This avoids copying the client's existing RP or WC struct for no reason.
2015-08-13 16:12:33 -04:00
Jeremy Mikola 01564891f9 PHPC-353: Support RP and WC in Manager options array
The read preference and write concern are complex structures, so we can't simply set their options on the URI as we do for other things (e.g. auth credentials).
2015-08-13 16:12:33 -04:00
Jeremy Mikola 490e5653bf Manager constructor should check if URI or client creation fails
If the URI cannot be parsed, we should throw an InvalidArgumentException. Failing to initialize the client from a valid URI can remain a RuntimeException.
2015-08-13 16:12:33 -04:00
Jeremy Mikola 47619dbffb Fix memory leak in _phongo_debug_bson()
The string returned by bson_as_json() must be freed.
2015-08-13 16:12:33 -04:00
Jeremy Mikola a3f4b2427f Trim #includes, since src/contrib is already an include path 2015-08-13 15:40:39 -04:00
Derick Rethans dead06a80b PHPC-357: "invalid namespace" exception should report the namespace 2015-08-05 21:47:08 -04:00
Derick Rethans 89caf72c6a Rename BSON\Binary's subType field and getSubType() method to type and getType() 2015-08-04 10:42:45 +01:00
Hannes Magnusson d017a80ea0 PHPC-229: Support options array in second parameter of Manager ctor 2015-07-22 13:47:43 -04:00
Hannes Magnusson 810ac48dcb Move the php_array to contrib/ and rename to _api
The current name conflicted with PHP own php_array.h :]
2015-07-15 15:00:18 -07:00
Jeremy Mikola 194bbbd164 PHPC-311: Rename from/toArray() functions to from/toPHP() 2015-07-14 19:52:24 -04:00
Jeremy Mikola 965f8c3db4 PHPC-315: Support "root" type mapping for top-level documents 2015-07-14 19:52:24 -04:00
Jeremy Mikola 6eb0944565 PHPC-319: Convert top-level documents to stdClass by default
Update tests to expect stdClass for documents. Debug handlers and the Server getter methods will still decode documents as native arrays.
2015-07-11 00:38:05 -04:00
Jeremy Mikola adbb54c87c Remove redundant array conversions in phongo_query_init()
The modifiers and selector zvals are both arrays or objects by this point and zval_to_bson() will handle either. Each will be serialized as a BSON document since zval_to_bson() merely appends fields to the structure we initialize with bson_new().
2015-07-06 15:46:50 -04:00
Jeremy Mikola 8cd6db686f PHPC-317: Ensure "sort" query option serializes as BSON object 2015-07-06 15:46:06 -04:00
Hannes Magnusson 803f4317f1 PHPC-321: UTCDatetime -> UTCDateTime 2015-06-30 10:29:57 -07:00
Hannes Magnusson 61c4432921 PHPC-309: Move the BSON namespace under MongoDB\ namespace
Having seperate MongoDB\Driver\ and BSON\ namespace was overruled :(

However, when you install pecl/bson seperately, it can be in the BSON
namespace, as it is a standalone package just wrapping libbson.

Since pecl/bson will be maintained in the same source as phongo, and I'd
like to share the testcases etc, we introduce a compile flag to detect
if we are compiling phongo or just bson, and set the namespace
appropriately
2015-06-30 09:54:21 -07:00
Hannes Magnusson 02dab9b130 Fix build after some SDAM changes 2015-06-09 16:13:34 -07:00
Hannes Magnusson f41dc80601 PHPC-308: Failed getmore should throw exception 2015-06-09 16:12:43 -07:00
Hannes Magnusson 6c31911854 Use the defines 2015-05-13 20:32:09 -07:00
Hannes Magnusson e26a2580bf PHPC-75: Improve coverage 2015-05-13 20:31:46 -07:00
Hannes Magnusson c09dc2ff4d PHPC-300: Add var_dump() debug info for Server 2015-05-13 18:38:03 -07:00
Hannes Magnusson 49c0567a57 PHPC-277: Ensure Query always serializes $query as a BSON object 2015-05-13 15:27:23 -07:00
Hannes Magnusson 986230190d PHPC-299: Annoying compiler warning 2015-05-13 13:44:39 -07:00
Hannes Magnusson 2558b5437d PHPC-298: Coalesce small writes 2015-05-13 13:00:01 -07:00
Hannes Magnusson fb0f3fc62b PHPC-296: phongo.debug created for empty values
Also set the default value to "off" for clarity
2015-05-06 10:51:08 -07:00
Jeremy Mikola 04d589b5b6 PHPC-255: Cursors cannot rewind after starting iteration 2015-05-04 17:05:25 -04:00
Jeremy Mikola 4e7df722dd PHPC-282: Cursor should not yield multiple iterators
Successive get_iterator handler invocations should throw a LogicException. This avoids situations that might allow the user to iterate over the same cursor multiple times.
2015-05-04 16:15:17 -04:00
Jeremy Mikola 5bf6e2ccfd PHPC-284: Create MongoDB\Driver\Exception\LogicException class 2015-05-04 16:15:17 -04:00
Jeremy Mikola 998c85bfba PHPC-179: Show unset journal/fsync as null in WriteConcern debug handler 2015-05-04 14:24:37 -04:00
Hannes Magnusson 2fd81c0ed2 PHPC-241: Don't try to use local timezone
The user would be forced to get the date.timezone warning
2015-04-24 14:44:35 -07:00
Hannes Magnusson 60fdf52e1d PHPC-241: mongodb.debug improvements 2015-04-24 11:51:09 -07:00
Hannes Magnusson 6cbacda4ac Fix unused result warning - and use the localtime in logs 2015-04-24 10:09:49 -07:00
Hannes Magnusson ebc15aefea PHPC-266: Add MongoDB\Driver\UnexpectedValueException 2015-04-23 16:13:35 -07:00
Hannes Magnusson 8d5e5d87c9 Bump copyright -- happy 2015 2015-04-23 10:16:20 -07:00
Hannes Magnusson c286209cae PHPC-241: Include lib versions and uri in the logs 2015-04-21 12:44:21 -07:00
Hannes Magnusson bcf3d9b96b Use the pretty MONGOC macros 2015-04-21 12:44:21 -07:00
Hannes Magnusson 6d7193d2c1 Move the init function to where all the others are and add folding markers 2015-04-21 12:44:20 -07:00
Jeremy Mikola 70b711000f Current element is already freed in php_phongo_cursor_free()
php_phongo_cursor_iterator_dtor() should not need to free the current element, which is stored on our cursor struct. If the cursor is only used by one iterator, zval_ptr_dtor() on the iterator's intern.data property (i.e. our Cursor zval) will implicitly call the free_object handler, which will invoke php_phongo_cursor_free() and clear the current element.
2015-04-21 14:23:16 -04:00
Jeremy Mikola f176cb7d91 Test Cursor iteration handlers and ensure rewind doesn't reset position 2015-04-21 14:23:16 -04:00
Jeremy Mikola c7b7891697 PHPC-240: Rely on libmongoc for command cursor iteration
libmongoc already provides a mechanism to upgrade a cursor with a single command result document into a command cursor, which will seamlessly iterate through the first batch and documents returned by successive getmore ops.

This allows us to remove our own "first batch" handling and simplify the move_forward and rewind iteration handlers.
2015-04-21 14:23:16 -04:00
Hannes Magnusson f40aa95670 PHPC-254: Remove unused RINIT and RSHUTDOWN handlers 2015-04-21 10:30:25 -07:00
Hannes Magnusson f4de8a4249 PHPC-243: Manager->executeUpdate() option is supposed to be 'multi' 2015-04-14 15:15:35 -07:00
Hannes Magnusson 251ed3ef39 PHPC-239: Cursor refcount issues
This also fixes re-iterating over a cursor where we would not free the
firstBatch properly, so the last result was still there.
2015-04-14 11:45:33 -07:00
Hannes Magnusson 930ff02098 PHPC-236: 5.3-zts build broken 2015-04-10 15:51:48 -07:00
Hannes Magnusson 0562092ef1 Simplify hash and fix windows build 2015-04-09 15:17:35 -07:00
Hannes Magnusson d1e937794d Rename the compat header - its much more then PHP5.3 issues now 2015-04-09 15:11:59 -07:00
Hannes Magnusson c6d29b3220 Fix warning, return in noreturn function 2015-04-09 15:09:30 -07:00
Hannes Magnusson 68caa686ba Fix zts build 2015-04-09 15:09:19 -07:00
Hannes Magnusson 5494b86255 Apparently there is a function for this! 2015-04-08 14:40:45 -07:00
Hannes Magnusson 6d8f7e9ed2 Fix zts build.. TSRMLS_FETCH_FROM_CTX declares variables and therefore must come first 2015-04-08 12:59:38 -07:00