mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-23 00:18:02 +02:00
PHPC-129: HIPPO can't throw InvalidArgumentException on argument errors
This commit is contained in:
@@ -74,17 +74,13 @@ PHP_METHOD(Binary, __construct)
|
||||
PHP_METHOD(Binary, getSubType)
|
||||
{
|
||||
php_phongo_binary_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_binary_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
RETURN_LONG(intern->subtype);
|
||||
}
|
||||
|
||||
@@ -89,17 +89,13 @@ PHP_METHOD(ObjectID, __construct)
|
||||
PHP_METHOD(ObjectID, __toString)
|
||||
{
|
||||
php_phongo_objectid_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_objectid_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_STRINGL(intern->oid, 24, 1);
|
||||
|
||||
@@ -77,17 +77,13 @@ PHP_METHOD(Regex, __construct)
|
||||
PHP_METHOD(Regex, getPattern)
|
||||
{
|
||||
php_phongo_regex_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_regex_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_STRINGL(intern->pattern, intern->pattern_len, 1);
|
||||
@@ -98,17 +94,13 @@ PHP_METHOD(Regex, getPattern)
|
||||
PHP_METHOD(Regex, getFlags)
|
||||
{
|
||||
php_phongo_regex_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_regex_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_STRINGL(intern->flags, intern->flags_len, 1);
|
||||
@@ -119,19 +111,15 @@ PHP_METHOD(Regex, getFlags)
|
||||
PHP_METHOD(Regex, __toString)
|
||||
{
|
||||
php_phongo_regex_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *regex;
|
||||
int regex_len;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_regex_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
regex_len = spprintf(®ex, 0, "/%s/%s", intern->pattern, intern->flags);
|
||||
|
||||
@@ -72,19 +72,15 @@ PHP_METHOD(Timestamp, __construct)
|
||||
PHP_METHOD(Timestamp, __toString)
|
||||
{
|
||||
php_phongo_timestamp_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *retval;
|
||||
int retval_len;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_timestamp_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
retval_len = spprintf(&retval, 0, "[%d:%d]", intern->increment, intern->timestamp);
|
||||
RETVAL_STRINGL(retval, retval_len, 0);
|
||||
|
||||
@@ -70,17 +70,13 @@ PHP_METHOD(UTCDatetime, __construct)
|
||||
PHP_METHOD(UTCDatetime, __toString)
|
||||
{
|
||||
php_phongo_utcdatetime_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_utcdatetime_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
RETVAL_LONG(intern->milliseconds);
|
||||
convert_to_string(return_value);
|
||||
@@ -91,17 +87,13 @@ PHP_METHOD(UTCDatetime, __toString)
|
||||
PHP_METHOD(UTCDatetime, toDateTime)
|
||||
{
|
||||
php_phongo_utcdatetime_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_utcdatetime_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
php_phongo_new_datetime_from_utcdatetime(return_value, intern->milliseconds TSRMLS_CC);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,6 @@ PHP_METHOD(BulkWrite, __construct)
|
||||
PHP_METHOD(BulkWrite, insert)
|
||||
{
|
||||
php_phongo_bulkwrite_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
zval *document;
|
||||
bson_t *bson;
|
||||
bson_t *bson_out = NULL;
|
||||
@@ -88,14 +87,11 @@ PHP_METHOD(BulkWrite, insert)
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_bulkwrite_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "A", &document) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
if (return_value_used) {
|
||||
@@ -125,7 +121,6 @@ PHP_METHOD(BulkWrite, insert)
|
||||
PHP_METHOD(BulkWrite, update)
|
||||
{
|
||||
php_phongo_bulkwrite_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
zval *query;
|
||||
zval *newObj;
|
||||
zval *updateOptions = NULL;
|
||||
@@ -136,14 +131,11 @@ PHP_METHOD(BulkWrite, update)
|
||||
(void)return_value_ptr; (void)return_value; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_bulkwrite_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "AA|a!", &query, &newObj, &updateOptions) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
bquery = bson_new();
|
||||
@@ -187,21 +179,17 @@ PHP_METHOD(BulkWrite, update)
|
||||
PHP_METHOD(BulkWrite, delete)
|
||||
{
|
||||
php_phongo_bulkwrite_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
zval *query;
|
||||
zval *deleteOptions = NULL;
|
||||
bson_t *bson;
|
||||
(void)return_value_ptr; (void)return_value; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_bulkwrite_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "A|a!", &query, &deleteOptions) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
bson = bson_new();
|
||||
@@ -221,18 +209,14 @@ PHP_METHOD(BulkWrite, delete)
|
||||
PHP_METHOD(BulkWrite, count)
|
||||
{
|
||||
php_phongo_bulkwrite_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_bulkwrite_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
RETURN_LONG(intern->bulk->commands.len);
|
||||
}
|
||||
|
||||
@@ -75,18 +75,14 @@ PHP_METHOD(Cursor, __construct)
|
||||
PHP_METHOD(Cursor, getId)
|
||||
{
|
||||
php_phongo_cursor_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
php_phongo_cursor_id_new_from_id(return_value, mongoc_cursor_get_id(intern->result->cursor) TSRMLS_CC);
|
||||
}
|
||||
@@ -96,18 +92,14 @@ PHP_METHOD(Cursor, getId)
|
||||
PHP_METHOD(Cursor, getServer)
|
||||
{
|
||||
php_phongo_cursor_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
/* FIXME: NOT IMPLEMENTED YET */
|
||||
RETURN_NULL();
|
||||
@@ -118,18 +110,14 @@ PHP_METHOD(Cursor, getServer)
|
||||
PHP_METHOD(Cursor, isDead)
|
||||
{
|
||||
php_phongo_cursor_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
RETURN_BOOL(!mongoc_cursor_is_alive(intern->result->cursor));
|
||||
}
|
||||
@@ -139,19 +127,15 @@ PHP_METHOD(Cursor, isDead)
|
||||
PHP_METHOD(Cursor, kill)
|
||||
{
|
||||
php_phongo_cursor_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
int hint;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
hint = mongoc_cursor_get_hint(intern->result->cursor);
|
||||
mongoc_client_kill_cursor(intern->result->cursor->client, mongoc_cursor_get_id(intern->result->cursor));
|
||||
@@ -164,19 +148,15 @@ PHP_METHOD(Cursor, kill)
|
||||
PHP_METHOD(Cursor, setBatchSize)
|
||||
{
|
||||
php_phongo_cursor_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
long batchSize;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &batchSize) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
RETVAL_LONG(mongoc_cursor_get_batch_size(intern->result->cursor));
|
||||
mongoc_cursor_set_batch_size(intern->result->cursor, batchSize);
|
||||
@@ -187,18 +167,14 @@ PHP_METHOD(Cursor, setBatchSize)
|
||||
PHP_METHOD(Cursor, getBatchSize)
|
||||
{
|
||||
php_phongo_cursor_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
RETURN_LONG(mongoc_cursor_get_batch_size(intern->result->cursor));
|
||||
}
|
||||
@@ -209,19 +185,15 @@ PHP_METHOD(Cursor, getBatchSize)
|
||||
PHP_METHOD(Cursor, current)
|
||||
{
|
||||
php_phongo_cursor_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
zval **data = NULL;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
if (!intern->it) {
|
||||
zend_class_entry *ce;
|
||||
@@ -241,18 +213,14 @@ PHP_METHOD(Cursor, current)
|
||||
PHP_METHOD(Cursor, key)
|
||||
{
|
||||
php_phongo_cursor_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
if (!intern->it) {
|
||||
zend_class_entry *ce;
|
||||
@@ -273,18 +241,14 @@ PHP_METHOD(Cursor, key)
|
||||
PHP_METHOD(Cursor, next)
|
||||
{
|
||||
php_phongo_cursor_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value; (void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
if (!intern->it) {
|
||||
zend_class_entry *ce;
|
||||
@@ -301,18 +265,14 @@ PHP_METHOD(Cursor, next)
|
||||
PHP_METHOD(Cursor, rewind)
|
||||
{
|
||||
php_phongo_cursor_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value; (void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
if (!intern->it) {
|
||||
zend_class_entry *ce;
|
||||
@@ -329,18 +289,14 @@ PHP_METHOD(Cursor, rewind)
|
||||
PHP_METHOD(Cursor, valid)
|
||||
{
|
||||
php_phongo_cursor_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursor_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
if (!intern->it) {
|
||||
zend_class_entry *ce;
|
||||
|
||||
@@ -72,18 +72,14 @@ PHP_METHOD(CursorId, __construct)
|
||||
PHP_METHOD(CursorId, __toString)
|
||||
{
|
||||
php_phongo_cursorid_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_cursorid_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
RETVAL_LONG(intern->id);
|
||||
convert_to_string(return_value);
|
||||
|
||||
@@ -122,7 +122,6 @@ PHP_METHOD(Manager, __construct)
|
||||
PHP_METHOD(Manager, executeCommand)
|
||||
{
|
||||
php_phongo_manager_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *db;
|
||||
int db_len;
|
||||
zval *command;
|
||||
@@ -130,14 +129,11 @@ PHP_METHOD(Manager, executeCommand)
|
||||
php_phongo_command_t *cmd;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_manager_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO|O!", &db, &db_len, &command, php_phongo_command_ce, &readPreference, php_phongo_readpreference_ce) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
cmd = (php_phongo_command_t *)zend_object_store_get_object(command TSRMLS_CC);
|
||||
@@ -149,21 +145,17 @@ PHP_METHOD(Manager, executeCommand)
|
||||
PHP_METHOD(Manager, executeQuery)
|
||||
{
|
||||
php_phongo_manager_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *namespace;
|
||||
int namespace_len;
|
||||
zval *zquery;
|
||||
zval *readPreference = NULL;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_manager_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO|O!", &namespace, &namespace_len, &zquery, php_phongo_query_ce, &readPreference, php_phongo_readpreference_ce) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
phongo_execute_query(intern->client, namespace, phongo_query_from_zval(zquery TSRMLS_CC), phongo_read_preference_from_zval(readPreference TSRMLS_CC), return_value, return_value_used TSRMLS_CC);
|
||||
@@ -174,7 +166,6 @@ PHP_METHOD(Manager, executeQuery)
|
||||
PHP_METHOD(Manager, executeBulkWrite)
|
||||
{
|
||||
php_phongo_manager_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *namespace;
|
||||
int namespace_len;
|
||||
zval *zbulk;
|
||||
@@ -182,14 +173,11 @@ PHP_METHOD(Manager, executeBulkWrite)
|
||||
php_phongo_bulkwrite_t *bulk;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_manager_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO|O!", &namespace, &namespace_len, &zbulk, php_phongo_bulkwrite_ce, &zwrite_concern, php_phongo_writeconcern_ce) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
bulk = (php_phongo_bulkwrite_t *)zend_object_store_get_object(zbulk TSRMLS_CC);
|
||||
@@ -201,7 +189,6 @@ PHP_METHOD(Manager, executeBulkWrite)
|
||||
PHP_METHOD(Manager, executeInsert)
|
||||
{
|
||||
php_phongo_manager_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *namespace;
|
||||
int namespace_len;
|
||||
zval *document;
|
||||
@@ -209,14 +196,11 @@ PHP_METHOD(Manager, executeInsert)
|
||||
bson_t *bson;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_manager_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sA|O!", &namespace, &namespace_len, &document, &zwrite_concern, php_phongo_writeconcern_ce) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
bson = bson_new();
|
||||
@@ -230,7 +214,6 @@ PHP_METHOD(Manager, executeInsert)
|
||||
PHP_METHOD(Manager, executeUpdate)
|
||||
{
|
||||
php_phongo_manager_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *namespace;
|
||||
int namespace_len;
|
||||
zval *zquery;
|
||||
@@ -242,14 +225,11 @@ PHP_METHOD(Manager, executeUpdate)
|
||||
mongoc_update_flags_t flags = MONGOC_UPDATE_NONE;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_manager_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sAA|a!O!", &namespace, &namespace_len, &zquery, &newObj, &updateOptions, &zwrite_concern, php_phongo_writeconcern_ce) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
query = bson_new();
|
||||
@@ -274,7 +254,6 @@ PHP_METHOD(Manager, executeUpdate)
|
||||
PHP_METHOD(Manager, executeDelete)
|
||||
{
|
||||
php_phongo_manager_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *namespace;
|
||||
int namespace_len;
|
||||
zval *query;
|
||||
@@ -284,14 +263,11 @@ PHP_METHOD(Manager, executeDelete)
|
||||
mongoc_delete_flags_t flags = MONGOC_DELETE_NONE;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_manager_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sA|a!O!", &namespace, &namespace_len, &query, &deleteOptions, &zwrite_concern, php_phongo_writeconcern_ce) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
if (deleteOptions && php_array_fetch_bool(deleteOptions, "limit")) {
|
||||
@@ -308,17 +284,13 @@ PHP_METHOD(Manager, executeDelete)
|
||||
PHP_METHOD(Manager, getServers)
|
||||
{
|
||||
php_phongo_manager_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_manager_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -74,19 +74,15 @@ PHP_METHOD(Result, setTypemap)
|
||||
{
|
||||
php_phongo_result_t *intern;
|
||||
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
|
||||
zend_error_handling error_handling;
|
||||
zval *typemap = NULL;
|
||||
(void)return_value; (void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_result_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!", &typemap) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
php_phongo_bson_typemap_to_state(typemap, &state.map TSRMLS_CC);
|
||||
|
||||
@@ -98,18 +94,14 @@ PHP_METHOD(Result, setTypemap)
|
||||
PHP_METHOD(Result, getIterator)
|
||||
{
|
||||
php_phongo_result_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value; (void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_result_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
if (intern->ce_get_iterator) {
|
||||
object_init_ex(return_value, intern->ce_get_iterator);
|
||||
@@ -124,20 +116,16 @@ PHP_METHOD(Result, getIterator)
|
||||
PHP_METHOD(Result, setIteratorClass)
|
||||
{
|
||||
php_phongo_result_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *class;
|
||||
int class_len;
|
||||
(void)return_value; (void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_result_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &class, &class_len) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
@@ -146,19 +134,15 @@ PHP_METHOD(Result, setIteratorClass)
|
||||
PHP_METHOD(Result, setIteratorInitCallback)
|
||||
{
|
||||
php_phongo_result_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
zval *callback;
|
||||
(void)return_value; (void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_result_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &callback) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
@@ -167,18 +151,14 @@ PHP_METHOD(Result, setIteratorInitCallback)
|
||||
PHP_METHOD(Result, toArray)
|
||||
{
|
||||
php_phongo_result_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_result_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
if (intern->firstBatch) {
|
||||
@@ -195,19 +175,15 @@ PHP_METHOD(Result, toArray)
|
||||
PHP_METHOD(Result, getServer)
|
||||
{
|
||||
php_phongo_result_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
mongoc_host_list_t host;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_result_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
mongoc_cursor_get_host(intern->cursor, &host);
|
||||
|
||||
@@ -104,21 +104,17 @@ PHP_METHOD(Server, __construct)
|
||||
PHP_METHOD(Server, executeCommand)
|
||||
{
|
||||
php_phongo_server_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *db;
|
||||
int db_len;
|
||||
zval *command;
|
||||
php_phongo_command_t *cmd;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_server_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO", &db, &db_len, &command, php_phongo_command_ce) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
cmd = (php_phongo_command_t *)zend_object_store_get_object(command TSRMLS_CC);
|
||||
@@ -130,20 +126,16 @@ PHP_METHOD(Server, executeCommand)
|
||||
PHP_METHOD(Server, executeQuery)
|
||||
{
|
||||
php_phongo_server_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *namespace;
|
||||
int namespace_len;
|
||||
zval *zquery;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_server_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO", &namespace, &namespace_len, &zquery, php_phongo_query_ce) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
phongo_execute_query(intern->client, namespace, phongo_query_from_zval(zquery TSRMLS_CC), NULL, return_value, return_value_used TSRMLS_CC);
|
||||
@@ -154,21 +146,17 @@ PHP_METHOD(Server, executeQuery)
|
||||
PHP_METHOD(Server, executeBulkWrite)
|
||||
{
|
||||
php_phongo_server_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
char *namespace;
|
||||
int namespace_len;
|
||||
zval *zbulk;
|
||||
php_phongo_bulkwrite_t *bulk;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_server_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO", &namespace, &namespace_len, &zbulk, php_phongo_bulkwrite_ce) == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
bulk = (php_phongo_bulkwrite_t *)zend_object_store_get_object(zbulk TSRMLS_CC);
|
||||
@@ -180,17 +168,13 @@ PHP_METHOD(Server, executeBulkWrite)
|
||||
PHP_METHOD(Server, getHost)
|
||||
{
|
||||
php_phongo_server_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
const mongoc_host_list_t *hosts;
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_server_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
/* FIXME: Not implemented */
|
||||
if (intern->client) {
|
||||
@@ -207,17 +191,13 @@ PHP_METHOD(Server, getHost)
|
||||
PHP_METHOD(Server, getInfo)
|
||||
{
|
||||
php_phongo_server_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_server_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
@@ -226,17 +206,13 @@ PHP_METHOD(Server, getInfo)
|
||||
PHP_METHOD(Server, getLatency)
|
||||
{
|
||||
php_phongo_server_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_server_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
@@ -245,18 +221,14 @@ PHP_METHOD(Server, getLatency)
|
||||
PHP_METHOD(Server, getPort)
|
||||
{
|
||||
php_phongo_server_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
const mongoc_host_list_t *hosts;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_server_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
/* FIXME: Not implemented */
|
||||
@@ -275,17 +247,13 @@ PHP_METHOD(Server, getPort)
|
||||
PHP_METHOD(Server, getState)
|
||||
{
|
||||
php_phongo_server_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_server_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
@@ -294,17 +262,13 @@ PHP_METHOD(Server, getState)
|
||||
PHP_METHOD(Server, getType)
|
||||
{
|
||||
php_phongo_server_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_server_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
@@ -313,17 +277,13 @@ PHP_METHOD(Server, getType)
|
||||
PHP_METHOD(Server, isDelayed)
|
||||
{
|
||||
php_phongo_server_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_server_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
@@ -332,17 +292,13 @@ PHP_METHOD(Server, isDelayed)
|
||||
PHP_METHOD(Server, isPassive)
|
||||
{
|
||||
php_phongo_server_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_server_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -51,17 +51,13 @@ zend_object_handlers php_phongo_handler_writeconcernerror;
|
||||
PHP_METHOD(WriteConcernError, getCode)
|
||||
{
|
||||
php_phongo_writeconcernerror_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeconcernerror_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_LONG(intern->code);
|
||||
@@ -72,17 +68,13 @@ PHP_METHOD(WriteConcernError, getCode)
|
||||
PHP_METHOD(WriteConcernError, getInfo)
|
||||
{
|
||||
php_phongo_writeconcernerror_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeconcernerror_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
if (intern->info) {
|
||||
@@ -95,17 +87,13 @@ PHP_METHOD(WriteConcernError, getInfo)
|
||||
PHP_METHOD(WriteConcernError, getMessage)
|
||||
{
|
||||
php_phongo_writeconcernerror_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeconcernerror_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
RETURN_STRING(intern->message, 1);
|
||||
}
|
||||
|
||||
@@ -51,17 +51,13 @@ zend_object_handlers php_phongo_handler_writeerror;
|
||||
PHP_METHOD(WriteError, getCode)
|
||||
{
|
||||
php_phongo_writeerror_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeerror_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_LONG(intern->code);
|
||||
@@ -72,17 +68,13 @@ PHP_METHOD(WriteError, getCode)
|
||||
PHP_METHOD(WriteError, getIndex)
|
||||
{
|
||||
php_phongo_writeerror_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeerror_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_LONG(intern->index);
|
||||
@@ -93,17 +85,13 @@ PHP_METHOD(WriteError, getIndex)
|
||||
PHP_METHOD(WriteError, getMessage)
|
||||
{
|
||||
php_phongo_writeerror_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeerror_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_STRING(intern->message, 1);
|
||||
@@ -114,17 +102,13 @@ PHP_METHOD(WriteError, getMessage)
|
||||
PHP_METHOD(WriteError, getInfo)
|
||||
{
|
||||
php_phongo_writeerror_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeerror_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
if (intern->info) {
|
||||
|
||||
@@ -49,17 +49,13 @@ PHONGO_API zend_class_entry *php_phongo_writeexception_ce;
|
||||
Returns the WriteResult from the failed write operation. */
|
||||
PHP_METHOD(WriteException, getWriteResult)
|
||||
{
|
||||
zend_error_handling error_handling;
|
||||
zval *writeresult;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
writeresult = zend_read_property(php_phongo_writeexception_ce, getThis(), ZEND_STRL("writeResult"), 0 TSRMLS_CC);
|
||||
|
||||
@@ -51,18 +51,14 @@ zend_object_handlers php_phongo_handler_writeresult;
|
||||
PHP_METHOD(WriteResult, getInsertedCount)
|
||||
{
|
||||
php_phongo_writeresult_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeresult_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_LONG(intern->write_result.nInserted);
|
||||
@@ -73,18 +69,14 @@ PHP_METHOD(WriteResult, getInsertedCount)
|
||||
PHP_METHOD(WriteResult, getMatchedCount)
|
||||
{
|
||||
php_phongo_writeresult_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeresult_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_LONG(intern->write_result.nMatched);
|
||||
@@ -95,18 +87,14 @@ PHP_METHOD(WriteResult, getMatchedCount)
|
||||
PHP_METHOD(WriteResult, getModifiedCount)
|
||||
{
|
||||
php_phongo_writeresult_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeresult_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_LONG(intern->write_result.nModified);
|
||||
@@ -117,18 +105,14 @@ PHP_METHOD(WriteResult, getModifiedCount)
|
||||
PHP_METHOD(WriteResult, getDeletedCount)
|
||||
{
|
||||
php_phongo_writeresult_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeresult_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_LONG(intern->write_result.nRemoved);
|
||||
@@ -139,18 +123,14 @@ PHP_METHOD(WriteResult, getDeletedCount)
|
||||
PHP_METHOD(WriteResult, getUpsertedCount)
|
||||
{
|
||||
php_phongo_writeresult_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeresult_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
RETURN_LONG(intern->write_result.nUpserted);
|
||||
@@ -162,18 +142,14 @@ PHP_METHOD(WriteResult, getUpsertedCount)
|
||||
PHP_METHOD(WriteResult, getInfo)
|
||||
{
|
||||
php_phongo_writeresult_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeresult_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
@@ -184,18 +160,14 @@ PHP_METHOD(WriteResult, getInfo)
|
||||
PHP_METHOD(WriteResult, getServer)
|
||||
{
|
||||
php_phongo_writeresult_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeresult_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
phongo_server_init(return_value, intern->hint, NULL TSRMLS_CC);
|
||||
@@ -206,18 +178,14 @@ PHP_METHOD(WriteResult, getServer)
|
||||
PHP_METHOD(WriteResult, getUpsertedIds)
|
||||
{
|
||||
php_phongo_writeresult_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeresult_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
@@ -273,18 +241,14 @@ PHP_METHOD(WriteResult, getUpsertedIds)
|
||||
PHP_METHOD(WriteResult, getwriteConcernError)
|
||||
{
|
||||
php_phongo_writeresult_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeresult_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
if (!bson_empty0(&intern->write_result.writeConcernError)) {
|
||||
@@ -300,18 +264,14 @@ PHP_METHOD(WriteResult, getwriteConcernError)
|
||||
PHP_METHOD(WriteResult, getWriteErrors)
|
||||
{
|
||||
php_phongo_writeresult_t *intern;
|
||||
zend_error_handling error_handling;
|
||||
(void)return_value_ptr; (void)return_value_used;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
|
||||
intern = (php_phongo_writeresult_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
zend_restore_error_handling(&error_handling TSRMLS_CC);
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
Reference in New Issue
Block a user