mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-03 06:42:23 +02:00
The functions in each class file are not exported (since we don't have headers), and this ultimately needs to be called by the WriteResult initialization function. Therefore, it's best placed in php_phongo.c for now, as we did with WriteError's function.
65 lines
1.1 KiB
PHP
65 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace MongoDB;
|
|
|
|
/**
|
|
* Value object for a write concern error.
|
|
*/
|
|
final class WriteConcernError
|
|
{
|
|
/**
|
|
* Returns the MongoDB error code
|
|
*
|
|
* @return integer Server error code
|
|
*/
|
|
public function getCode()
|
|
{
|
|
/*** CIMPL ***/
|
|
/*
|
|
RETURN_LONG(intern->code);
|
|
*/
|
|
/*** CIMPL ***/
|
|
}
|
|
|
|
/**
|
|
* Returns additional metadata for the error
|
|
*
|
|
* @return array Additional metadata for the error (e.g. {"wtimeout": true})
|
|
*/
|
|
public function getInfo()
|
|
{
|
|
/*** CIMPL ***/
|
|
/*
|
|
if (intern->info && Z_TYPE_P(intern->info) == IS_ARRAY) {
|
|
RETURN_ZVAL(intern->info, 1, 0);
|
|
}
|
|
|
|
array_init(return_value);
|
|
*/
|
|
/*** CIMPL ***/
|
|
}
|
|
|
|
/**
|
|
* Returns the actual error message from the server
|
|
*
|
|
* @return string Server error message
|
|
*/
|
|
public function getMessage()
|
|
{
|
|
/*
|
|
RETURN_STRING(intern->message, 1);
|
|
*/
|
|
}
|
|
}
|
|
|
|
$WriteConcernError["free"] = <<< EOF
|
|
if (intern->message) {
|
|
efree(intern->message);
|
|
}
|
|
|
|
if (intern->info) {
|
|
zval_ptr_dtor(&intern->info);
|
|
}
|
|
|
|
EOF;
|