528 Commits

Author SHA1 Message Date
Derick Rethans f645aad242 PHPC-1239: Passing SSL driversOptions to Manager constructor overrides SSL options in URI 2018-07-31 11:04:16 +01:00
Jeremy Mikola 98a7abaa21 PHPC-1216: Always validate and apply wtimeoutMS in URI options array 2018-06-25 16:19:16 -04:00
Jeremy Mikola 9f118a2229 PHPC-1211: Int64 class to wrap 64-bit integers on 32-bit platforms 2018-06-22 13:07:33 -04:00
Derick Rethans 1c19860103 PHPC-1193: Upgrade bundled libbson and libmongoc to 1.11 2018-06-19 20:07:48 +01:00
Derick Rethans b172a20c31 PHPC-1140: Implement Transactions specification 2018-06-19 14:47:29 +01:00
Derick Rethans f12e2005b4 PHPC-850: var_export() support for ReadPreference 2018-06-07 17:08:22 +01:00
Derick Rethans ab1f151e04 PHPC-1193: Bump libmongoc to 1.11 (and add ICU check) 2018-06-07 16:40:22 +01:00
Katherine Walker 814d49cacf PHPC-1076: Expose result document for failed commands via CommandFailedEvent 2018-05-22 08:31:01 -04:00
Katherine Walker 5e219a29b8 PHPC-1149: php_phongo_dispatch_handlers() should break if exception is thrown 2018-04-27 14:06:22 -04:00
Katherine Walker 7b4cb0c30e PHPC-1160: Initialize bson_error_t structs to zero 2018-04-26 15:31:14 -04:00
Jeremy Mikola 9fd2f10dfa Merge branch 'v1.4' 2018-04-24 13:47:29 -04:00
Jeremy Mikola cceeda84c1 PHPC-1163: Prohibit session with unacknowledged write concern
This adds checks to ensure that explicit sessions and unacknowledged write concerns (explicit or inherited) will not be mixed when executing bulk writes or commands. Additionally, we ensure that command execution does not create its own implicit session (per PHPC-1152) if the effective write concern is unacknowledged.

Note: libmongoc still needs to ensure that it does not create implicit sessions for unacknowledged commands (CDRIVER-2615).
2018-04-24 13:18:53 -04:00
Jeremy Mikola 58030116dd Apply code formatting to changes from v1.4 2018-04-18 16:17:45 -04:00
Jeremy Mikola 480bc58cd3 Merge branch 'v1.4' 2018-04-18 16:08:00 -04:00
Jeremy Mikola 427854e092 PHPC-1152: Create implicit session for commands
This ensures that phongo_execute_command creates an implicit session (if supported and not explicit session was provided). In turn, this ensures that any command cursor shares the same session as its originating command.

By creating a Session object, we can ensure that the implicit session is destroyed during garbage collection when the last reference is removed.
2018-04-18 14:36:39 -04:00
Jeremy Mikola aec79b2f12 Refactor command and query execute functions
This corrects the function signatures to return a boolean indicating success instead of an integer (which was cast from a boolean).

Additionally, it restructures phongo_execute_command() to use a cleanup label, in anticipation of implicit session changes.
2018-04-18 13:37:58 -04:00
Jeremy Mikola c154b49444 PHPC-578: phongo_execute_command() should still throw ExecutionTimeoutException
This fixes an inadvertent side effect of 4b70d9b9de.
2018-04-16 17:03:29 -04:00
Jeremy Mikola 230d8d9ab2 Define constant for ExceededTimeLimit server error 2018-04-16 17:03:29 -04:00
Jeremy Mikola 3af46fc79c Merge branch 'v1.4' 2018-04-16 11:32:51 -04:00
Jeremy Mikola 21307dee76 PHPC-1151: Maintain Session reference on Cursor
This ensures that the Session and underlying mongoc_client_session_t will not be freed until after the Cursor's mongoc_cursor_t object is destroyed.
2018-04-16 11:28:21 -04:00
Jeremy Mikola 06f608059e Move up client argument for phongo_parse_session()
Client is required, while the opts and zval arguments are optional.
2018-04-16 11:16:21 -04:00
Katherine Walker 3125be38ca PHPC-1148: Remove PHONGO_ERROR_WRITE_FAILED 2018-04-12 10:20:58 -04:00
Katherine Walker b829ec543f PHPC-1148: Throw InvalidArgumentException if BulkWrite is executed multiple times 2018-04-10 16:19:58 -04:00
Katherine Walker 4b70d9b9de PHPC-578: Expose result document for failed commands 2018-03-27 16:49:44 -04:00
Katherine Walker 110d13e4b3 PHPC-1090: Remove redundant MONGOC_ERROR_COMMAND check 2018-03-22 17:37:32 -04:00
Katherine Walker 8e0e836913 PHPC-1144: Use server-side error code for BulkWriteException 2018-03-22 17:37:32 -04:00
Katherine Walker 5d2f12b988 PHPC-1143: Select ServerException for MONGOC_ERROR_WRITE_CONCERN domain 2018-03-22 14:49:47 -04:00
Jeremy Mikola a5cf9dff16 PHPC-1090: Check libmongoc error domain along with codes 2018-03-21 15:18:23 -04:00
Jeremy Mikola 47c5759c1c PHPC-1090: Do not use CommandException for MONGOC_ERROR_COMMAND domain
In libmongoc error API v2, the command domain no longer used for errors originating from the server. It is relegated to MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION and MONGOC_ERROR_COMMAND_INVALID_ARG, both of which are client-side errors.
2018-03-21 15:18:18 -04:00
Katherine Walker bea837b9c0 Merge pull request #771 2018-03-14 13:31:31 -04:00
Katherine Walker 395719ad47 PHPC-1089: Introduce CommandException class 2018-03-14 13:30:59 -04:00
Katherine Walker 4e648091b0 PHPC-1091: Ensure ExecutionTimeoutException selection only considers server error code 2018-03-13 15:55:57 -04:00
Katherine Walker 1ad6d75b5c PHPC-1090: Clean up switch statements for exception class selection 2018-03-13 13:21:59 -04:00
Katherine Walker 119660902c PHPC-1087: Introduce ServerException class 2018-02-27 13:36:36 -05:00
Jeremy Mikola ce37d86be1 SSL opts are ignored without MONGOC_ENABLE_SSL
While these tests would certainly pass without SSL enabled, the desired code under test would not even be compiled into the extension.

This also removes an inaccurate code comment.
2018-02-27 09:48:25 -05:00
Derick Rethans 0a5fd12e20 PHPC-1118: Implement use of clang-format 2018-02-20 17:06:55 +00:00
Katherine Walker 2cdc10fc79 Append maxAwaitTimeMS as int64 instead of int32 2018-02-06 13:12:58 -05:00
Katherine Walker bc5ce89caf PHPC-1109: Support batchSize getMore option for command cursors 2018-02-06 13:12:58 -05:00
Jeremy Mikola 2802dcee9b PHPC-1097: Report libmongoc compression in phpinfo 2018-01-22 15:37:24 -05:00
Derick Rethans ca78df24ba PHPC-1081: Make driver compile on 32-bit platforms without warning 2018-01-11 14:55:22 +00:00
Jeremy Mikola d8d44f0acf PHPC-1050: Command cursor should not invoke getMore at execution 2018-01-08 10:26:45 -05:00
Jeremy Mikola a6d40fc42a Remove redundant phongo_bulkwrite_init function 2018-01-08 10:24:32 -05:00
Jeremy Mikola c94405a925 Use uint32_t for server_id args and struct fields
Since Manager methods no longer pass -1 to execute functions in php_phongo.c, server_id should always be unsigned.
2017-12-18 12:11:57 -05:00
Jeremy Mikola b29c423fda PHPC-1057: Refactor option parsing for execute methods
Execute options are now parsed via php_array functions, which makes the options case-sensitive.

A helper function is now used to convert legacy options for the original three execute methods into an array. This simplifies option parsing in php_phongo.c.

Additionally, Manager methods now perform their own server selection, which means that execute functions in php_phongo.c can rely on a server_id being provided.

Tests have been updated to expect a serverId option when relevant (e.g. query opts). Additionally, error tests for execute methods have been improved so that invalid values for all known options are tested.
2017-12-18 12:11:57 -05:00
Jeremy Mikola b2d85bfeb2 PHPC-980: Driver session spec tests 2017-12-15 16:25:56 -05:00
Jeremy Mikola d1d9d4a2bd PHPC-980: MongoDB\Driver\Session and "session" option
This introduces a Session class, which wraps libmongoc's client session object. Additionally, we support a "session" option on Manager and Server execute methods to allow operations to be associated with an explicit session (mostly relevant for causal consistency).
2017-12-15 16:25:56 -05:00
Jeremy Mikola 03af904b5d PHPC-1071: Report class name for unexpected object values
This only updates exceptions where object types are entirely unexpected. For instance, options that expect a BSON document (i.e. array or object) need not use this macro, as any object would be accepted.
2017-12-15 11:23:44 -05:00
Jeremy Mikola 4924d8b0de PHPC-1072: mongoc_client_command_with_opts() reply must always be freed
Previously, reply might leak if phongo_execute_command() returned due to an error (result=false).
2017-12-15 10:58:09 -05:00
Derick Rethans d3953f62a2 PHPC-1027: Introduce classes for deprecated BSON types (DBPointer) 2017-12-14 10:49:18 +00:00
Derick Rethans a9f6e3bb09 PHPC-1027: Introduce classes for deprecated BSON types (Symbol) 2017-12-14 10:49:18 +00:00