Files
mongo-php-driver/docs/api/MongoDB/WriteResult.php
Hannes Magnusson c9155e397b Add the actual implementation into the PHP API docs
This is used to generate the actual c classes.
- The CIMPL (Simple) section is the C Implementation
- The CEF (Chef) section is the C Definition
2014-07-16 17:59:26 +00:00

184 lines
4.4 KiB
PHP

<?php
namespace MongoDB;
/**
* Result returned by Server and Manager executeWrite() methods.
*
* This class may be constructed internally if it will encapsulate a libmongoc
* data structure.
*/
final class WriteResult
{
/**
* Returns the GeneratedIds for any inserted documents
*
* @return GeneratedId[]
*/
public function getGeneratedIdsForInsert()
{
/* Return an array of identifiers generated by the driver for insert
* operations. Each GeneratedId has a batch index and the ID value.
*
* This supersedes the identifier-setting hack in the 1.x driver.
*/
}
/**
* 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 ***/
/*
writeresult_populate(intern, intern->result.firstBatch);
RETURN_LONG(intern->nInserted);
*/
/*** CIMPL ***/
}
/**
* Returns the number of documents that matched the update criteria
*
* @return integer
*/
public function getNumMatched() {
/*** CIMPL ***/
/*
writeresult_populate(intern, intern->result.firstBatch);
RETURN_LONG(intern->nMatched);
*/
/*** CIMPL ***/
}
/**
* Returns the number of documents that were actually modified by an update
*
* @return integer
*/
public function getNumModified() {
/*** CIMPL ***/
/*
writeresult_populate(intern, intern->result.firstBatch);
RETURN_LONG(intern->nModified);
*/
/*** CIMPL ***/
}
/**
* Returns the number of documents that were deleted
*
* @return integer
*/
public function getNumRemoved() {
/*** CIMPL ***/
/*
writeresult_populate(intern, intern->result.firstBatch);
RETURN_LONG(intern->nRemoved);
*/
/*** CIMPL ***/
}
/**
* Returns the number of documents that were upserted
*
* @return integer
*/
public function getNumUpserted() {
/*** CIMPL ***/
/*
writeresult_populate(intern, intern->result.firstBatch);
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.";
$WriteResult["forward_declarations"] = <<< EOF
inline int writeresult_populate(php_phongo_writeresult_t *result, bson_t *document);
EOF;
$WriteResult["funcs"] = <<< EOF
inline int writeresult_populate(php_phongo_writeresult_t *result, bson_t *document) /* {{{ */
{
bson_iter_t iter;
if (result->initialized) {
return false;
}
if (bson_iter_init_find(&iter, document, "nUpserted") && BSON_ITER_HOLDS_INT32(&iter)) {
result->nUpserted = bson_iter_int32(&iter);
}
if (bson_iter_init_find(&iter, document, "nMatched") && BSON_ITER_HOLDS_INT32(&iter)) {
result->nMatched = bson_iter_int32(&iter);
}
if (bson_iter_init_find(&iter, document, "nRemoved") && BSON_ITER_HOLDS_INT32(&iter)) {
result->nRemoved = bson_iter_int32(&iter);
}
if (bson_iter_init_find(&iter, document, "nInserted") && BSON_ITER_HOLDS_INT32(&iter)) {
result->nInserted = bson_iter_int32(&iter);
}
if (bson_iter_init_find(&iter, document, "nModified") && BSON_ITER_HOLDS_INT32(&iter)) {
result->nModified = bson_iter_int32(&iter);
}
result->initialized = true;
return true;
} /* }}} */
EOF;