92 Commits

Author SHA1 Message Date
Jeremy Mikola 3ff292cbb8 PHPC-879: Remove dependency on php_date_get_immutable_ce() 2017-01-11 11:14:20 -05:00
Jeremy Mikola 997fe40f9c PHPC-878: Remove dependency on php_json_serializable_ce symbol
Since JsonSerializable is required, this also adds a helpful startup error message if json.so is not already loaded.
2017-01-11 11:14:20 -05:00
Jeremy Mikola 2efc183b38 PHPC-890: Add license header copypasta 2017-01-06 15:41:58 -05:00
Derick Rethans 24b65ca159 PHPC-619: Implement Decimal128 type (again) 2016-08-31 17:13:17 +01:00
Jeremy Mikola ff79f64177 PHPC-758: Disable Decimal128 for bundled libbson and libmongoc 1.4.0 2016-07-29 18:11:41 -04:00
Jeremy Mikola 4e26b503bd Declare __wakeup as lowercase for consistency 2016-07-15 11:11:48 -04:00
Jeremy Mikola 85309157b7 Consolidate PHP 5 and 7 struct definitions into one file 2016-07-11 12:25:16 -04:00
Jeremy Mikola 52266fbd51 Remove unused int32, int64, and log class entries 2016-07-11 12:25:16 -04:00
Jeremy Mikola 5ce569719c PHPC-619: Implement Decimal BSON type 2016-06-21 08:35:21 -04:00
Jeremy Mikola a327a22cb8 Merge branch 'v1.1' 2016-06-02 11:20:03 -04:00
Jeremy Mikola 1978caad20 Revise object macros for use within expressions 2016-05-28 19:32:49 -04:00
Jeremy Mikola 78839bde83 PHPC-688: Change Cursor debug handler to use libmongoc public API
This significantly alters the structure of the Cursor's debug output, since we not longer have access to private fields within mongoc_cursor_t.
2016-05-06 11:48:31 -04:00
Derick Rethans c0d4f60a1d Fixed issues with PHP 7 and the new ReadConcern 2015-12-18 16:15:40 +00:00
Hannes Magnusson 00c66b9670 PHPC-380: PHP7 create/free object changes 2015-12-16 10:20:04 +00:00
Patrick Boyd 9135dbf723 PHPC-380: create/free object handlers for PHP7 2015-12-16 10:19:30 +00:00
Hannes Magnusson 20a3044dd1 PHPC-369: Split PHP5 and PHP7 style custom object struct declrations 2015-12-16 10:13:02 +00:00
Jeremy Mikola 12e6907e41 PHPC-448: Support readConcern option on Query 2015-12-11 15:22:55 -05:00
Jeremy Mikola 92348caffc PHPC-448: Implement ReadConcern class 2015-12-11 14:44:59 -05:00
Jeremy Mikola 70c092f379 PHPC-465: Remove WriteConcernException and WriteErrorException
These exceptions were only used by the single write methods.
2015-10-21 23:42:40 -04:00
Jeremy Mikola 011c0c264c PHPC-440: WriteErrorException extends abstract WriteException
This makes WriteException a common base class of WriteConcernException and WriteErrorException. BulkWriteException, which may contain multiple write and/or write concern errors, will continue to inherit WriteException.
2015-10-21 19:32:42 -04:00
Jeremy Mikola 15a9f709d2 PHPC-462: Remove unused DuplicateKeyException
This class was not being used, since executeBulkWrite() uses BulkWriteException and the single write methods use WriteException and WriteConcernException exclusively.
2015-10-20 12:23:38 -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 803f4317f1 PHPC-321: UTCDatetime -> UTCDateTime 2015-06-30 10:29:57 -07:00
Hannes Magnusson 5688dd17cf PHPC-284: Fix LogicException declaration 2015-05-13 12:50:07 -07: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
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
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 c162c29215 PHPC-248: Allow ->setTypeMap() to set 'array' and 'stdclass' 2015-04-16 13:21:58 -07:00
Hannes Magnusson cd2660bc1a PHPC-233: Mark the ctor as private for internally created value objects 2015-04-09 09:16:42 -07:00
Jeremy Mikola c454d27d95 PHPC-215: Fix Cursor iteration through IteratorIterator
This removes the invalidate_current handler. Due to SPL's implementation, our handler was being invoked between rewinding and checking if the current position was valid. Given that our validity check depends on inspecting a pointer to the current element (like MySQLi's result iterator), we cannot use invalidate_current.

The current element must still be freed during iteration, so we will instead call a php_phongo_cursor_free_current() function as needed. Additionally, we should track a reference to the Cursor object zval on the iterator itself, which will ensure it is not garbage-collected during iteration (demonstrated in the segfault backtrace in PHPC-215).

Lastly, this commit renames the Cursor object and iterator structs and related functions to be more consistent with implementions in PHP core.
2015-04-06 15:45:19 -04:00
Jeremy Mikola 66193e83bc PHPC-224: Consolidate Result and Cursor classes into one
This class is now simply Traversable (no longer IteratorAggregate) and adds isDead() and getId() methods from the original Cursor class.
2015-04-06 15:45:19 -04:00
Hannes Magnusson 69bc19724d PHPC-190: Provide __wakeUp() to disable unserialize() 2015-04-03 13:02:19 -07:00
Jeremy Mikola 1f9f7716d9 PHPC-214: Result does not need custom iterator classes
Wrapping a cursor can already be accomplished with IteratorIterator.
2015-03-31 15:29:19 -04:00
Hannes Magnusson 5f8d990b53 PHPC-24 PHPC-77 PHPC-69 Provide a functioning Server object 2015-03-20 11:33:46 -07:00
Jeremy Mikola ae0219d69e PHPC-168: Implement WriteResult::isAcknowledged()
We copy the write concern struct rather than store an is_acknowledged boolean, which allows us to include the write concern in the debug output. Down the line, we may decide to implement a getWriteConcern() method to help users in handling/logging write concern errors.
2015-03-13 02:26:51 -04:00
Hannes Magnusson 5a4778f928 PHPC-163: Throw BulkWriteException on BulkWrite failure
For execute[Insert|Update|Delete]() we unroll the BulkWrite exception
and throw the inner errors.

Note: WriteConcern failure now throws WriteConcernException!
2015-03-03 10:21:37 -08:00
Hannes Magnusson 457b6452fa PHPC-165: Rename WriteBatch to BulkWrite 2015-02-20 15:05:29 -08:00
Hannes Magnusson 4cf9536f96 PHPC-164: Throw MongoDB\Driver\ConnectionTimeoutException 2015-02-19 15:02:49 -08:00
Hannes Magnusson dad5d51b12 PHPC-107: Throw ExecutionTimeoutException for maxTimeMs 2015-02-19 13:15:04 -08:00
Hannes Magnusson 481600d990 PHPC-157: Consolidate CommandResult and QueryResult classes 2015-02-18 11:09:36 -08:00
Hannes Magnusson d8506faa31 PHPC-154: WriteError can have info field 2015-02-18 09:52:47 -08:00
Hannes Magnusson 30aa95b66c PHPC-152: Throw MongoDB\Driver\InvalidArgumentException on argument errors 2015-02-06 16:31:06 -08:00
Hannes Magnusson 8e3bd3d8c7 PHPC-116: Cursor methods should call their respective iterator function handlers 2015-01-06 16:45:55 -08:00
Hannes Magnusson 865297f79a Smiplify cursor/results to prep for PHPC-116 2015-01-06 16:45:55 -08:00
Hannes Magnusson 148e726e26 PHPC-42: BSON Serialization for classes
This is a basic ODM.
When a class implements the BSON\Persistable interface gets bson
encoded we will embed a __ binary(type=0x80) value into the document.
Upon bson decoding a document, if we find that binary type convert that
document/array into the php class
2015-01-02 11:08:40 -08:00
Hannes Magnusson 0744895e16 PHPC-96 & PHPC-119 call the new bsonUnserialize method and optimize things a little 2014-12-31 18:55:41 -08:00
Hannes Magnusson 2691047570 PHPC-120: BSON\toArray should support classmap to unserialize as 2014-12-31 18:55:41 -08:00
Hannes Magnusson 3fa8cc8159 PHPC-119 && PHPC-49: Create PHP interfaces for BSON (un-)serialization 2014-12-31 18:55:08 -08:00