Commit Graph

80 Commits

Author SHA1 Message Date
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
Hannes Magnusson
0d5b449616 PHPC-96: Retrieve arrays as custom objects 2014-12-30 14:36:17 -08:00
Hannes Magnusson
36113dc30a PHPC-115: Remove now-useless GeneratedId
The point of it was to bactract to which batch index it belonged to.
We now return correctly indexed array for this, a long with the actual id
for the upsert
2014-12-23 11:18:29 -08:00
Hannes Magnusson
0d303e63bf PHPC-113: WriteConcernError is just one error, not multiple
This allows to actually retrieve - and know about - the error
2014-12-23 11:01:32 -08:00
Hannes Magnusson
6abfa11ea1 PHPC-104: Throw MongoDB\AuthenticationException on auth failure 2014-12-19 10:01:11 -08:00
Hannes Magnusson
95774b10d2 PHPC-101: throw MongoDB\DuplicateKeyException 2014-12-18 17:39:23 -08:00
Hannes Magnusson
ffa8006bce PHON-99: Add & Implement SSLConnectionException 2014-12-17 11:52:39 -08:00
Hannes Magnusson
2aa41c0eaa PHON-98: Implement and properly throw MongoDB\ConnectionException 2014-12-17 11:47:41 -08:00
Hannes Magnusson
1606f518d4 PHON-97: Add MongoDB\RuntimeException
This exception extends SPL RuntimeException - and implements
MongoDB\Exception

This makes it easy to catch "all MongoDB exceptions" and/or
RuntimeExceptions
2014-12-17 11:22:40 -08:00
Hannes Magnusson
f1031fe246 PHON-96: Create MongoDB\Exception interface 2014-12-17 11:20:58 -08:00
Hannes Magnusson
b2f29d887d PHP-1338: There is actually no DBRef BSON type, its a convention 2014-12-12 15:51:56 -08:00
Hannes Magnusson
518e2b4664 I have no idea what made me make BSON\Pool 2014-12-09 16:39:43 -08:00
Hannes Magnusson
ba8378e1fd PHP-1319: Implement command cursors 2014-12-08 10:17:17 -08:00