Commit Graph

38 Commits

Author SHA1 Message Date
Jeremy Mikola a5fe81bd06 PHPC-640: Revert TypeWrapper interface 2017-08-28 17:54:55 -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 92904af430 Return boolean instead of int from php_phongo_bson_to_zval_ex() 2017-05-08 12:22:20 -04:00
Jeremy Mikola f4040f0fdf PHPC-640: Specify TypeWrapper class entries in PHONGO_BSON_STATE_INITIALIZER 2017-05-05 16:28:43 -04:00
Jeremy Mikola b41f6f0e30 Revert "Simplify PHONGO_BSON_STATE_INITIALIZER macro"
This reverts commit a869c9746a.
2017-05-05 16:24:31 -04:00
Jeremy Mikola 122d7a86fd PHPC-640: Parse TypeWrapper classes in type maps 2017-04-26 11:23:26 -04:00
Jeremy Mikola 81b8d505d8 PHPC-937: Cursor::setTypeMap() and toPHP() should abort for invalid type map
This changes php_phongo_bson_typemap_to_state() to return a success boolean and also extracts class fetching into a separate php_phongo_bson_state_fetch_class() function to assist with supporting type wrappers in PHPC-640.
2017-04-26 11:23:26 -04:00
Jeremy Mikola a869c9746a Simplify PHONGO_BSON_STATE_INITIALIZER macro
This replaces the work-around for gcc's missing-braces warning in 321c577f98.
2017-04-26 11:22:11 -04:00
Derick Rethans 980f1fb01a PHPC-941: Add MongoDB\BSON\toExtendedJSON() to wrap bson_as_extended_json() 2017-04-07 14:54:54 -04:00
Jeremy Mikola bdb75791ab PHPC-911: Prefix Zend_FN names for MongoDB\BSON functions 2017-02-10 15:56:12 -05:00
Jeremy Mikola b75c5ffb66 PHPC-910: Split BSON encoding/decoding and prefix symbols 2017-02-10 15:56:12 -05:00
Jeremy Mikola 3a4da1c74c PHPC-883: BSON array keys should be disregarded during visitation 2017-01-09 11:15:39 -05:00
Jeremy Mikola 7fbef008fe Remove $Id$ SVN keyword instances 2017-01-06 15:43:18 -05:00
Jeremy Mikola 2efc183b38 PHPC-890: Add license header copypasta 2017-01-06 15:41:58 -05:00
Derick Rethans c50d63d74f PHPC-533: Remove PHONGO_API macro for exported functions 2016-11-28 11:47:13 +00:00
Jeremy Mikola a6e7202498 PHPC-761: Remove BSON_NAMESPACE constant 2016-08-05 14:06:58 -04:00
Jeremy Mikola b6c9b45add PHPC-550: Always encode ODS field when serializing Persistable documents
The modified ODS tests return atomic modifiers through bsonSerialize(), which conflicts with __pclass injection (the resulting newObj is neither an update nor a replacement document). Rather than delete these tests, we'll mark them as expecting failure until we allow such functionality in another interface down the line.
2016-02-15 12:49:00 -05:00
Jeremy Mikola 24ed8326b9 PHPC-529: Prefix BSON functions to avoid symbol conflicts 2016-01-06 13:57:42 -05:00
Jeremy Mikola 321c577f98 PHPC-285: Fix syntax for empty struct initializer
While "{ 0 }" should be sufficient, gcc's missing-braces warning requires that an extra pair of braces be used.

See: http://stackoverflow.com/q/11551986 and http://stackoverflow.com/a/20405554
2015-12-21 19:57:27 -05:00
Hannes Magnusson 6f6900fee9 PHPC-405: zval drop a level; zval*->zval, zval**->zval* 2015-12-16 10:22:58 +00:00
Hannes Magnusson 342c62747c PHPC-373: Remove MAKE_STD_ZVAL() usage
This simplifies calling bson_to_zval() quite a bit.

bson_to_zval() now takes empty zval*
bson_to_zval_ex() now takes php_phongo_bson_state (with empty zval*)

bson_to_zval() will always alloc and init state.zchild
2015-12-16 10:15:28 +00: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
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 fa1a263cc4 PHPC-260: Allow/use "object" in setTypeMap() as alias/preferred for "stdclass" 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 c162c29215 PHPC-248: Allow ->setTypeMap() to set 'array' and 'stdclass' 2015-04-16 13:21:58 -07:00
Hannes Magnusson 3c57497760 PHPC-245: Allow embedding objects in updates 2015-04-15 13:54:07 -07:00
Hannes Magnusson e147fd3f7f PHPC-245: executeUpdate() converts objects to arrays
Multiple things here -- we shouldn't be injecting __pclass every time
we serialize an object -- only when we are preparing it to be inserted.
Otherwise, for example when executing an update, it will be injected
into the update document too -- which b0rks the update statement.

We also need to bail out when we don't get an array from the serialize
callback -- and rather then pretend the return array from the callback
is the data we got passed in in the get-go, keep the original zval
intact so we don't accidentally convert it to array
2015-04-15 11:27:19 -07:00
Hannes Magnusson e82b1d0639 PHPC-96: Add QueryResult->setTypemap() to overwrite array/object mapping 2014-12-31 21:31:56 -08:00
Hannes Magnusson 0d5b449616 PHPC-96: Retrieve arrays as custom objects 2014-12-30 14:36:17 -08:00
Hannes Magnusson a3ce178fae Move BSON encode/decode stuff into BSON namespace
BSON\toArray()
BSON\toJSON()
BSON\fromArray()
BSON\fromJSON()
2014-08-13 21:31:50 +00:00
Hannes Magnusson 84a215df30 Make BSON types implement BSON\Type interface 2014-07-30 01:49:09 +00:00
Hannes Magnusson e619946d8c Returned generate _id when adding objects to batches 2014-07-19 02:58:53 +00:00
Hannes Magnusson 18dac2fee7 Add the ability to automatically generate _id 2014-07-18 23:43:30 +00:00
Jeremy Mikola 080053c7f7 Fix warning for bson_uint32_to_string() string pointer arg 2014-07-17 14:49:18 -04:00
Hannes Magnusson ac80d67b9d Added logging to files and command executing 2014-06-26 13:16:03 -07:00
Hannes Magnusson a36149a218 Initial BSON implementation 2014-06-20 14:55:03 -07:00