Commit Graph

489 Commits

Author SHA1 Message Date
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
Derick Rethans
c780a27926 PHPC-1027: Introduce classes for deprecated BSON types (Undefined) 2017-12-13 16:09:49 +00:00
Jeremy Mikola
67c5e8cfb2 PHPC-834: Process readPreference for executeCommand() on PHP 5.x 2017-12-12 15:52:43 -05:00
Derick Rethans
754e8bc1bd PHPC-1043: phongo_execute_query() may leak cursor struct on error 2017-12-12 10:17:12 +00:00
Derick Rethans
a83f7f4f0f PHPC-1048: Rename phongo_execute_write to phongo_execute_bulk_write 2017-12-12 10:16:38 +00:00
Derick Rethans
03da646de1 PHPC-709: Add microseconds to log messages 2017-12-12 10:16:06 +00:00
Derick Rethans
d0fdba4733 PHPC-967: Add support for reading and writing OP_COMPRESSED 2017-12-11 10:30:28 +00:00
Derick Rethans
bb2adacb83 Use stack-based BSON instead of heap-allocated 2017-12-08 16:33:18 +00:00
Derick Rethans
fa851dfd0b PHPC-834: Add Read, ReadWrite and Write command execute methods (fixes crash) 2017-12-08 12:20:18 +00:00
Derick Rethans
f2efe65980 Fixed capitalization of readConcern/writeConcern option 2017-11-29 16:44:00 +00:00
Derick Rethans
91cd821071 Added missing TSRMLS 2017-11-29 13:20:27 +00:00
Derick Rethans
eea07a062e Fixed review comments, use COMMAND_* types instead of *ALLOWED constants, and fixed wrong name in error message 2017-11-29 13:08:08 +00:00
Derick Rethans
b286fefab4 Use bool, check mongoc_*_append return values, and return upon weird unreachable exception 2017-11-28 17:08:29 +00:00
Derick Rethans
c9a2cf8223 Added missing option for PHP 5 2017-11-28 16:54:12 +00:00
Derick Rethans
66f60fb934 Remove collation, and parse writeConcern correctly. 2017-11-28 16:50:55 +00:00
Derick Rethans
fb448fcc76 Reuse do_select_server, and set serverId instead of ReadPreference 2017-11-28 16:39:41 +00:00
Derick Rethans
a939e39de7 PHPC-834: Add Read, ReadWrite, and Write command execute methods 2017-11-28 14:30:12 +00:00
Derick Rethans
87fbd007f0 PHPC-1042: Support options array for BulkWrite, Command, and Query execute methods 2017-11-27 16:21:58 +00:00
Derick Rethans
d225060aef PHPC-1042: Extract server select into its own function 2017-11-27 15:14:57 +00:00
Derick Rethans
4c338082cb PHPC-1029: Support maxTimeMS getMore option for tailable command cursors 2017-11-23 12:44:22 +00:00
Derick Rethans
9c6b6208fc Replace mongoc_client_command with mongoc_client_command_with_opts 2017-11-21 14:47:12 +00:00
Derick Rethans
f609ac7d35 PHPC-1037: Upgrade bundled libmongoc and libbson to 1.9 2017-11-21 14:47:12 +00:00
Jeremy Mikola
94ee50e5ef PHPC-1004: Rename ObjectID to ObjectId 2017-08-30 10:12:22 -04:00
Jeremy Mikola
a5fe81bd06 PHPC-640: Revert TypeWrapper interface 2017-08-28 17:54:55 -04:00
Jeremy Mikola
58324ad627 PHPC-992: Rename extended JSON functions to[Canonical|Relaxed]ExtendedJSON() 2017-08-10 12:56:47 -04:00
Jeremy Mikola
ce328f1a89 PHPC-887: Throw for unexpected types in URI options array
Note: generic boolean options (e.g. "ssl") will continue to accept non-boolean types for BC, since we cast via bson_iter_as_bool(). However, RP and WC-specific boolean options (e.g. "slaveOk", "journal") will throw since they previously silently ignored non-boolean values.

In addition to revising read preference tests, this adds new tests for read concern and write concern options.
2017-08-08 09:41:47 -04:00
hassan
c3310143f3 PHPC-887: Throw for unexpected readPreference URI option type 2017-08-04 10:59:35 -04:00
Jeremy Mikola
3b171c795e PHPC-846: Throw if maxStalenessSeconds URI option is out of range 2017-08-04 10:54:44 -04:00
Jeremy Mikola
36487bc0a9 PHPC-640: Create interfaces for BSON types classes
These interfaces are implemented by the corresponding BSON classes and intended to be used by TypeWrapper implementations.
2017-08-03 11:18:56 -04:00
Jeremy Mikola
65f5091010 PHPC-941: Add MongoDB\BSON\toCanonicalJSON() and toRelaxedJSON()
In CDRIVER-2208, bson_as_json() (used by toJSON()) was reverted to its original output format. Canonical and relaxed extended JSON are now produced by bson_as_canonical_json() and bson_as_relaxed_json(), respectively. This commit removes toExtendedJSON() (added in 980f1fb01a) in favor of the new functions.

Implementations for the BSON functions have been moved to their own file, which is consistent with what we're doing for the APM subscriber functions.
2017-07-28 13:30:06 -04:00
Jeremy Mikola
054af9419f PHPC-983: Add arg info for MongoDB\BSON\toPHP()'s type map parameter 2017-07-28 10:29:50 -04:00
Jeremy Mikola
9cbd82b458 Specify object class in arginfo for APM functions 2017-07-26 14:03:46 -04:00
Jeremy Mikola
c79f57c1de PHPC-981: Move APM functions to MongoDB\Driver\Monitoring namespace 2017-07-26 14:02:10 -04:00
Jeremy Mikola
e089c2bd01 PHPC-950: Skip APM callbacks if subscriber HashTable is uninitialized 2017-07-25 15:32:31 -04:00
Jeremy Mikola
d8541658ad PHPC-839: Support maxAwaitTimeMS Query option for tailable await cursors 2017-05-24 20:29:11 -04:00
Jeremy Mikola
22308a6d1e PHPC-959: mongoc_collection_find_with_opts() always returns a cursor 2017-05-08 12:23:28 -04:00
Jeremy Mikola
ee613c214c PHPC-628: Throw InvalidArgumentException when executing empty BulkWrite 2017-05-08 12:21:03 -04:00
Jeremy Mikola
773d36450e PHPC-772: Parse authMechanism options in URI options array 2017-04-26 11:48:35 -04:00
Jeremy Mikola
8f1da9d343 Extract php_phongo_apply_options_to_uri() from php_phongo_make_uri() 2017-04-26 11:48:35 -04:00
Jeremy Mikola
bc9c266a78 PHPC-953: Do not parse "database" key in URI options array
This option was never documented and is redundant in light of the "authSource" option.
2017-04-26 11:48:35 -04:00