mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-01 22:02:23 +02:00
When initializing a WriteResult, we should initialize the corresponding WriteError and WriteConcernError classes, too. This moves all of the initialization code into php_phongoc, as was done with the error classes. Additionally, phongo_execute_write() has been changed to not construct a bson_t reply unnecessarily (i.e. return value will not be used).
128 lines
2.6 KiB
PHP
128 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace MongoDB;
|
|
|
|
/**
|
|
* Result returned by Server and Manager executeWriteBatch() methods.
|
|
*
|
|
* This class may be constructed internally if it will encapsulate a libmongoc
|
|
* data structure.
|
|
*/
|
|
final class WriteResult
|
|
{
|
|
/**
|
|
* Returns the GeneratedIds for any upserted documents
|
|
*
|
|
* @return GeneratedId[]
|
|
*/
|
|
public function getGeneratedIdsForUpsert()
|
|
{
|
|
/* Return an array of identifiers generated by the server for upsert
|
|
* operations. Each GeneratedId has a batch index and the ID value.
|
|
*/
|
|
}
|
|
|
|
/**
|
|
* Returns the number of documents that were inserted
|
|
*
|
|
* @return integer
|
|
*/
|
|
public function getNumInserted() {
|
|
/*** CIMPL ***/
|
|
/*
|
|
RETURN_LONG(intern->nInserted);
|
|
*/
|
|
/*** CIMPL ***/
|
|
}
|
|
|
|
/**
|
|
* Returns the number of documents that matched the update criteria
|
|
*
|
|
* @return integer
|
|
*/
|
|
public function getNumMatched() {
|
|
/*** CIMPL ***/
|
|
/*
|
|
RETURN_LONG(intern->nMatched);
|
|
*/
|
|
/*** CIMPL ***/
|
|
}
|
|
|
|
/**
|
|
* Returns the number of documents that were actually modified by an update
|
|
*
|
|
* @return integer
|
|
*/
|
|
public function getNumModified() {
|
|
/*** CIMPL ***/
|
|
/*
|
|
RETURN_LONG(intern->nModified);
|
|
*/
|
|
/*** CIMPL ***/
|
|
}
|
|
|
|
/**
|
|
* Returns the number of documents that were deleted
|
|
*
|
|
* @return integer
|
|
*/
|
|
public function getNumRemoved() {
|
|
/*** CIMPL ***/
|
|
/*
|
|
RETURN_LONG(intern->nRemoved);
|
|
*/
|
|
/*** CIMPL ***/
|
|
}
|
|
|
|
/**
|
|
* Returns the number of documents that were upserted
|
|
*
|
|
* @return integer
|
|
*/
|
|
public function getNumUpserted() {
|
|
/*** CIMPL ***/
|
|
/*
|
|
RETURN_LONG(intern->nUpserted);
|
|
*/
|
|
/*** CIMPL ***/
|
|
}
|
|
|
|
/**
|
|
* Returns metadata about the operation.
|
|
*
|
|
* @see https://github.com/mongodb/specifications/blob/master/source/server_write_commands.rst#situational-fields
|
|
* @return array Additional metadata for the operation(s) (e.g. lastOp)
|
|
*/
|
|
public function getInfo() {}
|
|
|
|
/**
|
|
* Returns the Server from which the result originated
|
|
*
|
|
* @return Server
|
|
*/
|
|
public function getServer() {
|
|
/*** CIMPL ***/
|
|
/*
|
|
phongo_server_init(return_value, intern->result.hint, NULL TSRMLS_CC);
|
|
*/
|
|
/*** CIMPL ***/
|
|
}
|
|
|
|
/**
|
|
* Return any write concern errors that occurred
|
|
*
|
|
* @return WriteConcernError[]
|
|
*/
|
|
public function getWriteConcernErrors() {}
|
|
|
|
/**
|
|
* Returns any write errors that occurred
|
|
*
|
|
* @return WriteError[]
|
|
*/
|
|
public function getWriteErrors() {}
|
|
}
|
|
|
|
|
|
$WriteResult["internwrapper"] = "result.";
|