• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MAKE_STD_ZVAL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MAKE_STD_ZVAL函数的典型用法代码示例。如果您正苦于以下问题:C++ MAKE_STD_ZVAL函数的具体用法?C++ MAKE_STD_ZVAL怎么用?C++ MAKE_STD_ZVAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MAKE_STD_ZVAL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: php_mongo_io_stream_read

/* Returns the bytes read on success
 * Returns -31 on unknown failure
 * Returns -80 on timeout
 * Returns -32 when remote server closes the connection
 */
int php_mongo_io_stream_read(mongo_connection *con, mongo_server_options *options, int timeout, void *data, int size, char **error_message)
{
	int num = 1, received = 0;
	TSRMLS_FETCH();

	if (timeout > 0 && options->socketTimeoutMS != timeout) {
		struct timeval rtimeout = {0};
		rtimeout.tv_sec = timeout / 1000;
		rtimeout.tv_usec = (timeout % 1000) * 1000;

		php_stream_set_option(con->socket, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &rtimeout);
	}

	/* this can return FAILED if there is just no more data from db */
	while (received < size && num > 0) {
		int len = 4096 < (size - received) ? 4096 : size - received;

		num = php_stream_read(con->socket, (char *) data, len);

		if (num < 0) {
			/* Doesn't look like this can happen, php_sockop_read overwrites
			 * the failure from recv() to return 0 */
			*error_message = strdup("Read from socket failed");
			return -31;
		}

		/* It *may* have failed. It also may simply have no data */
		if (num == 0) {
			zval *metadata;

			MAKE_STD_ZVAL(metadata);
			array_init(metadata);
			if (php_stream_populate_meta_data(con->socket, metadata)) {
				zval **tmp;

				if (zend_hash_find(Z_ARRVAL_P(metadata), "timed_out", sizeof("timed_out"), (void**)&tmp) == SUCCESS) {
					convert_to_boolean_ex(tmp);
					if (Z_BVAL_PP(tmp)) {
						struct timeval rtimeout = {0};

						if (timeout > 0 && options->socketTimeoutMS != timeout) {
							rtimeout.tv_sec = timeout / 1000;
							rtimeout.tv_usec = (timeout % 1000) * 1000;
						} else {
							rtimeout.tv_sec = options->socketTimeoutMS / 1000;
							rtimeout.tv_usec = (options->socketTimeoutMS % 1000) * 1000;
						}
						*error_message = malloc(256);
						snprintf(*error_message, 256, "Read timed out after reading %d bytes, waited for %d.%06d seconds", num, rtimeout.tv_sec, rtimeout.tv_usec);
						zval_ptr_dtor(&metadata);
						return -80;
					}
				}
				if (zend_hash_find(Z_ARRVAL_P(metadata), "eof", sizeof("eof"), (void**)&tmp) == SUCCESS) {
					convert_to_boolean_ex(tmp);
					if (Z_BVAL_PP(tmp)) {
						*error_message = strdup("Remote server has closed the connection");
						zval_ptr_dtor(&metadata);
						return -32;
					}
				}
			}
			zval_ptr_dtor(&metadata);
		}

		data = (char*)data + num;
		received += num;
	}

	if (options && options->ctx) {
		php_stream_notify_progress_increment((php_stream_context *)options->ctx, received, size);
	}
	if (timeout > 0 && options->socketTimeoutMS != timeout) {
		struct timeval rtimeout = {0};
		rtimeout.tv_sec = options->socketTimeoutMS / 1000;
		rtimeout.tv_usec = (options->socketTimeoutMS % 1000) * 1000;

		php_stream_set_option(con->socket, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &rtimeout);
	}

	return received;
}
开发者ID:Jensen2k,项目名称:mongo-php-driver,代码行数:87,代码来源:io_stream.c


示例2: PHP_METHOD


//.........这里部分代码省略.........
						zend_hash_quick_del(Z_ARRVAL_PP(ppzval), "args", sizeof("args"), zend_inline_hash_func(SS("args")));
						zend_hash_quick_del(Z_ARRVAL_PP(ppzval), "object", sizeof("object"), zend_inline_hash_func(SS("object")));
						found = 1;
					}
				}
			}

			/*
			 * Now we need to renumber the hash table because we removed several
			 * heading elements. If we don't do this, json_encode() will convert
			 * this array to a JavaScript object which is an unwanted side effect
			 */
			p = ht->pListHead;
			i = 0;
			while (p != NULL) {
				p->nKeyLength = 0;
				p->h = i++;
				p = p->pListNext;
			}

			ht->nNextFreeElement = i;
			zend_hash_rehash(ht);
		}
	}

	/*
	 * The result will looks like this:
	 *
	 * array(
	 *     array('Type' => 'message type', 'Label' => 'message'),
	 *     array('backtrace' => array(backtrace goes here)
	 * )
	 */
	MAKE_STD_ZVAL(payload);
	array_init_size(payload, 2);

	MAKE_STD_ZVAL(meta);
	array_init_size(meta, 4);
	add_assoc_zval_ex(meta, SS("Type"), type_str);

	if (i_show_backtrace && Z_TYPE_P(backtrace) == IS_ARRAY) {
		zval **ppzval;

		if (likely(SUCCESS == zend_hash_index_find(Z_ARRVAL_P(backtrace), 0, (void**)&ppzval)) && likely(Z_TYPE_PP(ppzval) == IS_ARRAY)) {
			zval **file = NULL, **line = NULL;

			zend_hash_quick_find(Z_ARRVAL_PP(ppzval), SS("file"), zend_inline_hash_func(SS("file")), (void**)&file);
			zend_hash_quick_find(Z_ARRVAL_PP(ppzval), SS("line"), zend_inline_hash_func(SS("line")), (void**)&line);

			if (likely(file != NULL)) {
				Z_ADDREF_PP(file);
				add_assoc_zval_ex(meta, SS("File"), *file);
			}

			if (likely(line != NULL)) {
				Z_ADDREF_PP(line);
				add_assoc_zval_ex(meta, SS("Line"), *line);
			}
		}
	}

	if (i_enable_labels) {
		add_assoc_zval_ex(meta, SS("Label"), interpolated);
	}

	if (!i_enable_labels && !i_show_backtrace) {
开发者ID:9466,项目名称:cphalcon,代码行数:67,代码来源:firephp.c


示例3: php_swoole_aio_onComplete

static void php_swoole_aio_onComplete(struct io_event *events, int n)
{
	int i, argc;
	int64_t ret;
	struct iocb *iocb;

	zval *retval;
	zval *zcontent;
	zval **args[2];
	swoole_async_request *req;
	MAKE_STD_ZVAL(zcontent);

	TSRMLS_FETCH_FROM_CTX(sw_thread_ctx ? sw_thread_ctx : NULL);

	for (i = 0; i < n; i++)
	{
		iocb = (struct iocb *) events[i].obj;
		if(zend_hash_find(&php_sw_aio_callback, (char *)&(iocb->aio_fildes), sizeof(iocb->aio_fildes), (void**)&req) != SUCCESS)
		{
			zend_error(E_WARNING, "swoole_async: onAsyncComplete callback not found[1]");
			return;
		}

		if (req->callback == NULL && req->type == IOCB_CMD_PREAD)
		{
			zend_error(E_WARNING, "swoole_async: onAsyncComplete callback not found[2]");
			return;
		}
		ret = (int64_t) events[i].res;
		if (ret < 0)
		{
			zend_error(E_WARNING, "swoole_async: Aio Error: %s[%d]", strerror((-ret)), (int) ret);
			return;
		}
		if (ret < req->content_length)
		{
			zend_error(E_WARNING, "swoole_async: return length < req->length.");
		}

		args[0] = &req->filename;
		if (req->type == IOCB_CMD_PREAD)
		{
			ZVAL_STRINGL(zcontent, req->file_content, ret, 0);
			args[1] = &zcontent;
			argc = 2;
		}
		else
		{
			argc = 1;
		}

		if (call_user_function_ex(EG(function_table), NULL, req->callback, &retval, argc, args, 0, NULL TSRMLS_CC) == FAILURE)
		{
			zend_error(E_WARNING, "swoole_async: onAsyncComplete handler error");
			return;
		}

		//readfile/writefile 只操作一次,完成后释放缓存区并关闭文件
		if (req->once == 1)
		{
			free(req->file_content);
			close(iocb->aio_fildes);
		}
		//free(iocb);
	}
	zval_ptr_dtor(&zcontent);
}
开发者ID:ZheYuan,项目名称:swoole,代码行数:67,代码来源:swoole_async.c


示例4: ZEND_METHOD

ZEND_METHOD( alinq_class , GroupBy )
{
    zend_fcall_info fci;
    zend_fcall_info_cache fci_cache;
    zend_class_entry *ce;
    ce = Z_OBJCE_P(getThis());
    zval * reVal;
    zval * resultArray;
    MAKE_STD_ZVAL(resultArray);
    array_init(resultArray);
    zval *retval_ptr = NULL;
    zval *returnObj;  
    zval *dataSource, **tmpns;


    char aReturnType;
    int aReturnTypeLen; 

    // aReturnType = 'bool';
     //取得数组
    dataSource = zend_read_property(ce, getThis(), "dataSource", sizeof("dataSource")-1, 0 TSRMLS_DC);

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &fci, &fci_cache) == FAILURE) {
        return;
    }     

    while (zend_hash_get_current_data(Z_ARRVAL_P(dataSource), (void **)&tmpns) == SUCCESS) {
        char *key;
        uint keylen;
        ulong idx;
        int type;
        zval **ppzval, tmpcopy;
        zval **item,*item1;
        MAKE_STD_ZVAL(item1);
        array_init(item1);
        item = &item1;
        // php_printf("step-\n");
        // if(count>0 && i>=count){        //只循环count次
        //     break;
        // }

        type = zend_hash_get_current_key_ex(Z_ARRVAL_P(dataSource), &key, &keylen,&idx, 0, NULL);

        //重新copy一个zval,防止破坏原数据
        tmpcopy = **tmpns;
        zval_copy_ctor(&tmpcopy);
        INIT_PZVAL(&tmpcopy);
         // convert_to_string(&tmpcopy);
        

        walu_call_anony_function(&retval_ptr, NULL, fci, "sz", key, keylen,&tmpcopy); 

        if(zend_hash_find(Z_ARRVAL_P(resultArray), Z_STRVAL_P(retval_ptr),sizeof(Z_STRVAL_P(retval_ptr)), (void **)&item) == FAILURE && IS_STRING==Z_TYPE_P(retval_ptr)) {
            // php_printf("step0\n");
            // zend_error(E_ERROR, "element not found");
            // MAKE_STD_ZVAL(item);
            // array_init(item);
            add_assoc_zval(resultArray, Z_STRVAL_P(retval_ptr), *item); 
        }
        // PHPWRITE(Z_STRVAL_P(retval_ptr),strlen(Z_STRVAL_P(retval_ptr)));  
        // php_printf("step1\n");
        if( IS_ARRAY!=Z_TYPE_PP(item)){
            php_printf("not array\n");
            continue;
        }

        // add_assoc_zval(resultArray, retval_ptr, *tmpns);  
        add_next_index_zval(*item,*tmpns);
        // /* Toss out old copy */
        zval_dtor(&tmpcopy);



        zend_hash_move_forward(Z_ARRVAL_P(dataSource));
    }
    
    walu_call_user_function(&returnObj, getThis(), "Instance", "z", resultArray);
    RETURN_ZVAL(returnObj,1,1);    

    return; 

}
开发者ID:wosiwo,项目名称:clinq,代码行数:82,代码来源:alinq.c


示例5: PHP_METHOD

PHP_METHOD(Edge_Controller, model)
{
    char *model_name = NULL;
    char *model_dir = NULL;
    int mnlen=0;
    int mdlen=0;
    if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &model_name, &mnlen, &model_dir, &mdlen) == FAILURE)
    {
        RETURN_FALSE;
    }
    
    char *model_class_name;
    int class_name_len;
    class_name_len = spprintf(&model_class_name, 0, "%s%s", model_name, "Model");

    zval **z_obj;
    if(zend_hash_find(Z_ARRVAL_P(EDGE_G(regs)), model_class_name, class_name_len+1, (void **)&z_obj) == SUCCESS)
    {
        efree(model_class_name);
        RETURN_ZVAL(*z_obj, 1, 0);
    }
    
    zval *config;
    zval *config_data;
    config = zend_read_static_property(edge_core_ce, ZEND_STRL("config"), 1 TSRMLS_DC);
    config_data = zend_read_property(edge_config_ce, config, ZEND_STRL("_data"), 1 TSRMLS_DC);

    zval **models_home_pp;
    if(zend_hash_find(Z_ARRVAL_P(config_data), "_models_home", strlen("_models_home")+1, (void **)&models_home_pp) == FAILURE)
    {
        RETURN_FALSE;
    }
    
    zval *z_model_name;
    MAKE_STD_ZVAL(z_model_name);
    ZVAL_STRING(z_model_name, model_class_name, 1);

    zval *loader;
    zval *ret;
    loader = zend_read_static_property(edge_core_ce, ZEND_STRL("loader"), 1 TSRMLS_DC);
    zend_call_method_with_2_params(&loader, Z_OBJCE_P(loader), NULL, "autoload", &ret, z_model_name, *models_home_pp);
    zval_ptr_dtor(&z_model_name);
    if(!Z_BVAL_P(ret))
    {
        php_error_docref(NULL TSRMLS_CC, E_WARNING, "model %s%s load fail", Z_STRVAL_PP(models_home_pp), model_class_name);
        zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "model %s%s load fail", Z_STRVAL_PP(models_home_pp), model_class_name);
        zval_ptr_dtor(&ret);
        efree(model_class_name);
        RETURN_FALSE;
    }
    zval_ptr_dtor(&ret);

    zend_class_entry **model_ce;
    if(zend_lookup_class(model_class_name, class_name_len, &model_ce TSRMLS_CC) == FAILURE)
    {
        php_error_docref(NULL TSRMLS_CC, E_WARNING, "model class %s not exist", model_class_name);
        zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "model class %s%s  not exist", model_class_name);
        efree(model_class_name);
        RETURN_FALSE;
    }

    zval *model_obj;
    MAKE_STD_ZVAL(model_obj);
    object_init_ex(model_obj, *model_ce);

    zval **cfptr;
    if(zend_hash_find(&((*model_ce)->function_table), "__construct", strlen("__construct")+1, (void **)&cfptr) == SUCCESS)
    {
        zval *cretval;
        zend_call_method(&model_obj, *model_ce, NULL, "__construct", strlen("__construct"), &cretval, 0, NULL, NULL TSRMLS_CC);
        zval_ptr_dtor(&cretval);
    }

    zend_hash_update(Z_ARRVAL_P(EDGE_G(regs)), model_class_name, class_name_len+1, (void **)&model_obj, sizeof(zval *), NULL);

    efree(model_class_name);
    RETURN_ZVAL(model_obj, 1, 0);
}
开发者ID:linkaisheng,项目名称:edge,代码行数:78,代码来源:edge_controller.c


示例6: php_mongo_io_stream_read

/* Returns the bytes read on success
 * Returns -31 on unknown failure
 * Returns -80 on timeout
 * Returns -32 when remote server closes the connection
 */
int php_mongo_io_stream_read(mongo_connection *con, mongo_server_options *options, int timeout, void *data, int size, char **error_message)
{
	int num = 1, received = 0;
	TSRMLS_FETCH();

	int socketTimeoutMS = options->socketTimeoutMS ? options->socketTimeoutMS : FG(default_socket_timeout) * 1000;

	/* Convert negative values to -1 second, which implies no timeout */
	socketTimeoutMS = socketTimeoutMS < 0 ? -1000 : socketTimeoutMS;
	timeout = timeout < 0 ? -1000 : timeout;

	/* Socket timeout behavior varies based on the following:
	 * - Negative => no timeout (i.e. block indefinitely)
	 * - Zero => not specified (no changes to existing configuration)
	 * - Positive => used specified timeout (revert to previous value later) */
	if (timeout && timeout != socketTimeoutMS) {
		struct timeval rtimeout = {0, 0};

		rtimeout.tv_sec = timeout / 1000;
		rtimeout.tv_usec = (timeout % 1000) * 1000;

		php_stream_set_option(con->socket, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &rtimeout);
		mongo_manager_log(MonGlo(manager), MLOG_CON, MLOG_FINE, "Setting the stream timeout to %d.%06d", rtimeout.tv_sec, rtimeout.tv_usec);
	} else {
		mongo_manager_log(MonGlo(manager), MLOG_CON, MLOG_FINE, "No timeout changes for %s", con->hash);
	}

	php_mongo_stream_notify_io(options, MONGO_STREAM_NOTIFY_IO_READ, 0, size TSRMLS_CC);

	/* this can return FAILED if there is just no more data from db */
	while (received < size && num > 0) {
		int len = 4096 < (size - received) ? 4096 : size - received;
		ERROR_HANDLER_DECLARATION(error_handler)

		ERROR_HANDLER_REPLACE(error_handler, mongo_ce_ConnectionException);
		num = php_stream_read(con->socket, (char *) data, len);
		ERROR_HANDLER_RESTORE(error_handler);

		if (num < 0) {
			/* Doesn't look like this can happen, php_sockop_read overwrites
			 * the failure from recv() to return 0 */
			*error_message = strdup("Read from socket failed");
			return -31;
		}

		/* It *may* have failed. It also may simply have no data */
		if (num == 0) {
			zval *metadata;

			MAKE_STD_ZVAL(metadata);
			array_init(metadata);
			if (php_stream_populate_meta_data(con->socket, metadata)) {
				zval **tmp;

				if (zend_hash_find(Z_ARRVAL_P(metadata), "timed_out", sizeof("timed_out"), (void**)&tmp) == SUCCESS) {
					convert_to_boolean_ex(tmp);
					if (Z_BVAL_PP(tmp)) {
						struct timeval rtimeout = {0, 0};

						if (timeout > 0 && options->socketTimeoutMS != timeout) {
							rtimeout.tv_sec = timeout / 1000;
							rtimeout.tv_usec = (timeout % 1000) * 1000;
						} else {
							/* Convert timeout=-1 to -1second, which PHP interprets as no timeout */
							int socketTimeoutMS = options->socketTimeoutMS == -1 ? -1000 : options->socketTimeoutMS;
							rtimeout.tv_sec = socketTimeoutMS / 1000;
							rtimeout.tv_usec = (socketTimeoutMS % 1000) * 1000;
						}
						*error_message = malloc(256);
						snprintf(*error_message, 256, "Read timed out after reading %d bytes, waited for %d.%06d seconds", num, rtimeout.tv_sec, rtimeout.tv_usec);
						zval_ptr_dtor(&metadata);
						return -80;
					}
				}
				if (zend_hash_find(Z_ARRVAL_P(metadata), "eof", sizeof("eof"), (void**)&tmp) == SUCCESS) {
					convert_to_boolean_ex(tmp);
					if (Z_BVAL_PP(tmp)) {
						*error_message = strdup("Remote server has closed the connection");
						zval_ptr_dtor(&metadata);
						return -32;
					}
				}
			}
			zval_ptr_dtor(&metadata);
		}

		data = (char*)data + num;
		received += num;
	}
	/* PHP may have sent notify-progress of *more then* 'received' in some
	 * cases.
	 * PHP will read 8192 byte chunks at a time, but if we request less data
	 * then that PHP will just buffer the rest, which is fine.  It could
	 * confuse users a little, why their progress update was higher then the
	 * max-bytes-expected though... */
//.........这里部分代码省略.........
开发者ID:LTD-Beget,项目名称:mongo-php-driver,代码行数:101,代码来源:io_stream.c


示例7: apply_to_cursor

static int apply_to_cursor(zval *cursor, apply_copy_func_t apply_copy_func, void *to, int max TSRMLS_DC)
{
	int total = 0;
	zval *next;

	MAKE_STD_ZVAL(next);
	MONGO_METHOD(MongoCursor, getNext, next, cursor);

	if (EG(exception)) {
		return FAILURE;
	}
    
	if (Z_TYPE_P(next) != IS_ARRAY) {
		zval_ptr_dtor(&next);
		return FAILURE;
	}

	while (Z_TYPE_P(next) == IS_ARRAY) {
		zval **zdata;

		/* Check if data field exists. If it doesn't, we've probably got an
		 * error message from the db, so return that */
		if (zend_hash_find(HASH_P(next), "data", 5, (void**)&zdata) == FAILURE) {
			if (zend_hash_exists(HASH_P(next), "$err", 5)) {
				zval_ptr_dtor(&next);
				return FAILURE;
			}
			continue;
		}

		/* This copies the next chunk -> *to
		 * Due to a talent I have for not reading directions, older versions of
		 * the driver store files as raw bytes, not MongoBinData. So, we'll
		 * check for and handle both cases. */
		if (Z_TYPE_PP(zdata) == IS_STRING) {
			/* raw bytes */
			if (total + Z_STRLEN_PP(zdata) > max) {
				zend_throw_exception_ex(mongo_ce_GridFSException, 1 TSRMLS_CC, "There is more data associated with this file than the metadata specifies");
				return FAILURE;
			}
			total += apply_copy_func(to, Z_STRVAL_PP(zdata), Z_STRLEN_PP(zdata));

		} else if (Z_TYPE_PP(zdata) == IS_OBJECT && Z_OBJCE_PP(zdata) == mongo_ce_BinData) {
			/* MongoBinData */
			zval *bin = zend_read_property(mongo_ce_BinData, *zdata, "bin", strlen("bin"), NOISY TSRMLS_CC);

			if (total + Z_STRLEN_P(bin) > max) {
				zval **n;

				if (zend_hash_find(HASH_P(next), "n", strlen("n") + 1, (void**)&n) == SUCCESS) {
					convert_to_long_ex(n);
					zend_throw_exception_ex(mongo_ce_GridFSException, 1 TSRMLS_CC, "There is more data associated with this file than the metadata specifies (reading chunk %d)", Z_LVAL_PP(n));
				} else {
					zend_throw_exception_ex(mongo_ce_GridFSException, 1 TSRMLS_CC, "There is more data associated with this file than the metadata specifies");
				}
				zval_ptr_dtor(&next);

				return FAILURE;
			}
			total += apply_copy_func(to, Z_STRVAL_P(bin), Z_STRLEN_P(bin));

		} else {
			/* If it's not a string or a MongoBinData, give up */
			zval_ptr_dtor(&next);
			return FAILURE;
		}

		/* get ready for the next iteration */
		zval_ptr_dtor(&next);
		MAKE_STD_ZVAL(next);
		MONGO_METHOD(MongoCursor, getNext, next, cursor);
	}
	zval_ptr_dtor(&next);

	/* return the number of bytes copied */
	return total;
}
开发者ID:CheowTong,项目名称:mongo-php-driver,代码行数:77,代码来源:gridfs_file.c


示例8: php_mongo_io_stream_read

/* Returns the bytes read on success
 * Returns -31 on unknown failure
 * Returns -80 on timeout
 * Returns -32 when remote server closes the connection
 */
int php_mongo_io_stream_read(mongo_connection *con, mongo_server_options *options, int timeout, void *data, int size, char **error_message)
{
	int num = 1, received = 0;
	TSRMLS_FETCH();

	if (timeout > 0 && options->socketTimeoutMS != timeout) {
		struct timeval rtimeout = {0, 0};
		rtimeout.tv_sec = timeout / 1000;
		rtimeout.tv_usec = (timeout % 1000) * 1000;

		php_stream_set_option(con->socket, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &rtimeout);
	}

	php_mongo_stream_notify_io(options, MONGO_STREAM_NOTIFY_IO_READ, 0, size TSRMLS_CC);

	/* this can return FAILED if there is just no more data from db */
	while (received < size && num > 0) {
		int len = 4096 < (size - received) ? 4096 : size - received;
		ERROR_HANDLER_DECLARATION(error_handler)

		ERROR_HANDLER_REPLACE(error_handler, mongo_ce_ConnectionException);
		num = php_stream_read(con->socket, (char *) data, len);
		ERROR_HANDLER_RESTORE(error_handler);

		if (num < 0) {
			/* Doesn't look like this can happen, php_sockop_read overwrites
			 * the failure from recv() to return 0 */
			*error_message = strdup("Read from socket failed");
			return -31;
		}

		/* It *may* have failed. It also may simply have no data */
		if (num == 0) {
			zval *metadata;

			MAKE_STD_ZVAL(metadata);
			array_init(metadata);
			if (php_stream_populate_meta_data(con->socket, metadata)) {
				zval **tmp;

				if (zend_hash_find(Z_ARRVAL_P(metadata), "timed_out", sizeof("timed_out"), (void**)&tmp) == SUCCESS) {
					convert_to_boolean_ex(tmp);
					if (Z_BVAL_PP(tmp)) {
						struct timeval rtimeout = {0, 0};

						if (timeout > 0 && options->socketTimeoutMS != timeout) {
							rtimeout.tv_sec = timeout / 1000;
							rtimeout.tv_usec = (timeout % 1000) * 1000;
						} else {
							rtimeout.tv_sec = options->socketTimeoutMS / 1000;
							rtimeout.tv_usec = (options->socketTimeoutMS % 1000) * 1000;
						}
						*error_message = malloc(256);
						snprintf(*error_message, 256, "Read timed out after reading %d bytes, waited for %d.%06d seconds", num, rtimeout.tv_sec, rtimeout.tv_usec);
						zval_ptr_dtor(&metadata);
						return -80;
					}
				}
				if (zend_hash_find(Z_ARRVAL_P(metadata), "eof", sizeof("eof"), (void**)&tmp) == SUCCESS) {
					convert_to_boolean_ex(tmp);
					if (Z_BVAL_PP(tmp)) {
						*error_message = strdup("Remote server has closed the connection");
						zval_ptr_dtor(&metadata);
						return -32;
					}
				}
			}
			zval_ptr_dtor(&metadata);
		}

		data = (char*)data + num;
		received += num;
	}
	/* PHP may have sent notify-progress of *more then* 'received' in some
	 * cases.
	 * PHP will read 8192 byte chunks at a time, but if we request less data
	 * then that PHP will just buffer the rest, which is fine.  It could
	 * confuse users a little, why their progress update was higher then the
	 * max-bytes-expected though... */
	php_mongo_stream_notify_io(options, MONGO_STREAM_NOTIFY_IO_COMPLETED, received, size TSRMLS_CC);

	if (timeout > 0 && options->socketTimeoutMS != timeout) {
		struct timeval rtimeout = {0, 0};
		rtimeout.tv_sec = options->socketTimeoutMS / 1000;
		rtimeout.tv_usec = (options->socketTimeoutMS % 1000) * 1000;

		php_stream_set_option(con->socket, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &rtimeout);
	}

	return received;
}
开发者ID:caoge,项目名称:mongo-php-driver,代码行数:96,代码来源:io_stream.c


示例9: ZEND_FUNCTION

/* {{{ proto array accelerator_get_status([bool fetch_scripts])
   Obtain statistics information regarding code acceleration */
static ZEND_FUNCTION(opcache_get_status)
{
	long reqs;
	zval *memory_usage,*statistics,*scripts;
	zend_bool fetch_scripts = 1;

	/* keep the compiler happy */
	(void)ht; (void)return_value_ptr; (void)this_ptr; (void)return_value_used;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &fetch_scripts) == FAILURE) {
		return;
	}
	
	if (!validate_api_restriction(TSRMLS_C)) {
		RETURN_FALSE;
	}

	if (!accel_startup_ok) {
		RETURN_FALSE;
	}

	array_init(return_value);

	/* Trivia */
	add_assoc_bool(return_value, "opcache_enabled", ZCG(enabled) && (ZCG(counted) || ZCSG(accelerator_enabled)));
	add_assoc_bool(return_value, "cache_full", ZSMMG(memory_exhausted));
	add_assoc_bool(return_value, "restart_pending", ZCSG(restart_pending));
	add_assoc_bool(return_value, "restart_in_progress", ZCSG(restart_in_progress));

	/* Memory usage statistics */
	MAKE_STD_ZVAL(memory_usage);
	array_init(memory_usage);
	add_assoc_long(memory_usage, "used_memory", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory));
	add_assoc_long(memory_usage, "free_memory", zend_shared_alloc_get_free_memory());
	add_assoc_long(memory_usage, "wasted_memory", ZSMMG(wasted_shared_memory));
	add_assoc_double(memory_usage, "current_wasted_percentage", (((double) ZSMMG(wasted_shared_memory))/ZCG(accel_directives).memory_consumption)*100.0);
	add_assoc_zval(return_value, "memory_usage", memory_usage);

#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
	if (ZCSG(interned_strings_start) && ZCSG(interned_strings_end) && ZCSG(interned_strings_top)) {
		zval *interned_strings_usage;

		MAKE_STD_ZVAL(interned_strings_usage);
		array_init(interned_strings_usage);
		add_assoc_long(interned_strings_usage, "buffer_size", ZCSG(interned_strings_end) - ZCSG(interned_strings_start));
		add_assoc_long(interned_strings_usage, "used_memory", ZCSG(interned_strings_top) - ZCSG(interned_strings_start));
		add_assoc_long(interned_strings_usage, "free_memory", ZCSG(interned_strings_end) - ZCSG(interned_strings_top));
		add_assoc_long(interned_strings_usage, "number_of_strings", ZCSG(interned_strings).nNumOfElements);
		add_assoc_zval(return_value, "interned_strings_usage", interned_strings_usage);
	}
#endif
	
	/* Accelerator statistics */
	MAKE_STD_ZVAL(statistics);
	array_init(statistics);
	add_assoc_long(statistics, "num_cached_scripts", ZCSG(hash).num_direct_entries);
	add_assoc_long(statistics, "num_cached_keys",    ZCSG(hash).num_entries);
	add_assoc_long(statistics, "max_cached_keys",    ZCSG(hash).max_num_entries);
	add_assoc_long(statistics, "hits", ZCSG(hits));
	add_assoc_long(statistics, "start_time", ZCSG(start_time));
	add_assoc_long(statistics, "last_restart_time", ZCSG(last_restart_time));
	add_assoc_long(statistics, "oom_restarts", ZCSG(oom_restarts));
	add_assoc_long(statistics, "hash_restarts", ZCSG(hash_restarts));
	add_assoc_long(statistics, "manual_restarts", ZCSG(manual_restarts));
	add_assoc_long(statistics, "misses", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses));
	add_assoc_long(statistics, "blacklist_misses", ZCSG(blacklist_misses));
	reqs = ZCSG(hits)+ZCSG(misses);
	add_assoc_double(statistics, "blacklist_miss_ratio", reqs?(((double) ZCSG(blacklist_misses))/reqs)*100.0:0);
	add_assoc_double(statistics, "opcache_hit_rate", reqs?(((double) ZCSG(hits))/reqs)*100.0:0);
	add_assoc_zval(return_value, "opcache_statistics", statistics);

	if (fetch_scripts) {
		/* accelerated scripts */
		scripts = accelerator_get_scripts(TSRMLS_C);
		if (scripts) {
			add_assoc_zval(return_value, "scripts", scripts);
		}
	}
}
开发者ID:LTD-Beget,项目名称:ZendOptimizerPlus,代码行数:81,代码来源:zend_accelerator_module.c


示例10: php_facedetect

static void php_facedetect(INTERNAL_FUNCTION_PARAMETERS, int return_type)
{
	char *file, *casc;
	long flen, clen;

	zval *array;

	CvHaarClassifierCascade* cascade;
	IplImage *img, *gray;
	CvMemStorage *storage;
	CvSeq *faces;
	CvRect *rect;

	if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &file, &flen, &casc, &clen) == FAILURE) {
		RETURN_NULL();
	}

	img = cvLoadImage(file, 1);
	if(!img) {
		RETURN_FALSE;
	}

	cascade = (CvHaarClassifierCascade*)cvLoad(casc, 0, 0, 0);
	if(!cascade) {
		RETURN_FALSE;
	}

	gray = cvCreateImage(cvSize(img->width, img->height), 8, 1);
	cvCvtColor(img, gray, CV_BGR2GRAY);
	cvEqualizeHist(gray, gray);

	storage = cvCreateMemStorage(0);

	faces = cvHaarDetectObjects(gray, cascade, storage, 1.1, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(0, 0), cvSize(0, 0));

	if(return_type) {

		array_init(return_value);

		if(faces && faces->total > 0) {
			int i;
			for(i = 0; i < faces->total; i++) {
				MAKE_STD_ZVAL(array);
				array_init(array);

				rect = (CvRect *)cvGetSeqElem(faces, i);

				add_assoc_long(array, "x", rect->x);
				add_assoc_long(array, "y", rect->y);
				add_assoc_long(array, "w", rect->width);
				add_assoc_long(array, "h", rect->height);

				add_next_index_zval(return_value, array);
			}
		}
	} else {
		RETVAL_LONG(faces ? faces->total : 0);
	}

	cvReleaseMemStorage(&storage);
	cvReleaseImage(&gray);
	cvReleaseImage(&img);
}
开发者ID:2bj,项目名称:PHP-Facedetect,代码行数:63,代码来源:facedetect.c


示例11: PHP_METHOD

PHP_METHOD(Rows, nextPage)
{
  zval* timeout = NULL;
  cassandra_session* session = NULL;
  CassFuture* future = NULL;
  const CassResult* result = NULL;
  cassandra_rows* rows = NULL;
  cassandra_future_rows* future_rows = NULL;

  cassandra_rows* self = (cassandra_rows*) zend_object_store_get_object(getThis() TSRMLS_CC);

  if (self->next_page) {
    RETURN_ZVAL(self->next_page, 1, 0);
  }

  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &timeout) == FAILURE) {
    return;
  }

  if (self->future_next_page) {
    if (!instanceof_function(Z_OBJCE_P(self->future_next_page),
                             cassandra_future_rows_ce TSRMLS_CC)) {
      zend_throw_exception_ex(cassandra_runtime_exception_ce, 0 TSRMLS_CC,
                              "Unexpected future instance.");
      return;
    }

    future_rows = (cassandra_future_rows*) zend_object_store_get_object(self->future_next_page TSRMLS_CC);

    if (php_cassandra_future_wait_timed(future_rows->future, timeout TSRMLS_CC) == FAILURE) {
      return;
    }

    if (php_cassandra_future_is_error(future_rows->future TSRMLS_CC) == FAILURE) {
      return;
    }

    result = cass_future_get_result(future_rows->future);
  } else {
    if (self->result == NULL) {
      return;
    }

    ASSERT_SUCCESS(cass_statement_set_paging_state((CassStatement*) self->statement->data, self->result));

    session = (cassandra_session*) zend_object_store_get_object(self->session TSRMLS_CC);
    future = cass_session_execute(session->session, (CassStatement*) self->statement->data);

    if (php_cassandra_future_wait_timed(future, timeout TSRMLS_CC) == FAILURE) {
      return;
    }

    if (php_cassandra_future_is_error(future TSRMLS_CC) == FAILURE) {
      return;
    }

    result = cass_future_get_result(future);
    cass_future_free(future);
  }

  if (!result) {
    zend_throw_exception_ex(cassandra_runtime_exception_ce, 0 TSRMLS_CC,
                            "Future doesn't contain a result.");
    return;
  }

  MAKE_STD_ZVAL(self->next_page);
  object_init_ex(self->next_page, cassandra_rows_ce);
  rows = (cassandra_rows*) zend_object_store_get_object(self->next_page TSRMLS_CC);

  if (php_cassandra_get_result(result, &rows->rows TSRMLS_CC) == FAILURE) {
    cass_result_free(result);
    zval_dtor(self->next_page);
    self->next_page = NULL;
    return;
  }

  if (self->future_next_page) {
    zval_ptr_dtor(&self->future_next_page);
    self->future_next_page = NULL;
  }

  if (cass_result_has_more_pages(result)) {
    Z_ADDREF_P(self->session);
    rows->statement = php_cassandra_add_ref(self->statement);
    rows->session   = self->session;
    rows->result    = result;
  } else {
    cass_result_free(result);
  }

  php_cassandra_rows_clear(self);
  RETURN_ZVAL(self->next_page, 1, 0);
}
开发者ID:NSRagu,项目名称:php-driver,代码行数:94,代码来源:Rows.c


示例12: MAKE_STD_ZVAL

php_ret samphp::parse_args(zval **params, zend_uint *count, char *argspec, va_list ap)
{
    int i = 0;
    for(char *trav = argspec; *trav; trav++)
    {
        MAKE_STD_ZVAL(params[i]);
        switch(*trav)
        {
        case 'b':
        {
            // va promotes bools to ints
            int arg = va_arg(ap, int);
            ZVAL_BOOL(params[i], arg);
        }
        break;

        case 'i':
        {
            int arg = va_arg(ap, int);
            ZVAL_LONG(params[i], arg);
        }
        break;

        case 'l':
        {
            long arg = va_arg(ap, long);
            ZVAL_LONG(params[i], arg);
        }
        break;

        case 'd':
        {
            double arg = va_arg(ap, double);
            ZVAL_DOUBLE(params[i], arg);
        }
        break;

        case 's':
        {
            char *arg = va_arg(ap, char *);
            ZVAL_STRING(params[i], arg, 1);
        }
        break;

        case 'S':
        {
            char *arg = va_arg(ap, char *);
            unsigned int binStrLen = va_arg(ap, unsigned int);
            ZVAL_STRINGL(params[i], arg, binStrLen, 1);
        }
        break;

        default:
            status = FAIL;
            return status;
        }

        i++;
    }

    *count = i;

    return SUCCESS;
}
开发者ID:WhiteaglePT,项目名称:SAMPHP,代码行数:64,代码来源:samphp.cpp


示例13: php_swoole_aio_onComplete

static void php_swoole_aio_onComplete(swAio_event *event)
{
	int isEOF = SW_FALSE;
	int64_t ret;

	zval *retval = NULL, *zcallback = NULL, *zwriten = NULL;
	zval *zcontent = NULL;
	zval **args[2];
	swoole_async_file_request *file_req = NULL;
	swoole_async_dns_request *dns_req = NULL;

	TSRMLS_FETCH_FROM_CTX(sw_thread_ctx ? sw_thread_ctx : NULL);

	if (event->type == SW_AIO_DNS_LOOKUP)
	{
		dns_req = (swoole_async_dns_request *) event->req;
		if (dns_req->callback == NULL)
		{
			php_error_docref(NULL TSRMLS_CC, E_WARNING, "swoole_async: onAsyncComplete callback not found[2]");
			return;
		}
		zcallback = dns_req->callback;
	}
	else
	{
		if (zend_hash_find(&php_sw_aio_callback, (char *)&(event->fd), sizeof(event->fd), (void**) &file_req) != SUCCESS)
		{
			php_error_docref(NULL TSRMLS_CC, E_WARNING, "swoole_async: onAsyncComplete callback not found[1]");
			return;
		}
		if (file_req->callback == NULL && file_req->type == SW_AIO_READ)
		{
			php_error_docref(NULL TSRMLS_CC, E_WARNING, "swoole_async: onAsyncComplete callback not found[2]");
			return;
		}
		zcallback = file_req->callback;
	}

	ret = event->ret;
	if (ret < 0)
	{
		php_error_docref(NULL TSRMLS_CC, E_WARNING, "swoole_async: Aio Error: %s[%d]", strerror(event->error), event->error);
	}
    else if (file_req != NULL)
    {
        if (ret == 0)
        {
            bzero(event->buf, event->nbytes);
            isEOF = SW_TRUE;
        }
        else if (file_req->once == 1 && ret < file_req->content_length)
        {
            php_error_docref(NULL TSRMLS_CC, E_WARNING, "swoole_async: ret_length[%d] < req->length[%d].", (int) ret, file_req->content_length);
        }
        else if (event->type == SW_AIO_READ)
        {
            file_req->offset += event->ret;
        }
    }

    if (event->type == SW_AIO_READ)
    {
        MAKE_STD_ZVAL(zcontent);
        args[0] = &file_req->filename;
        args[1] = &zcontent;
        ZVAL_STRINGL(zcontent, event->buf, ret, 0);
    }
    else if (event->type == SW_AIO_WRITE)
    {
        MAKE_STD_ZVAL(zwriten);
        args[0] = &file_req->filename;
        args[1] = &zwriten;
        ZVAL_LONG(zwriten, ret);

        if (file_req->once != 1)
        {
            if (SwooleAIO.mode == SW_AIO_LINUX)
            {
                free(event->buf);
            }
            else
            {
                efree(event->buf);
            }
        }
    }
	else if(event->type == SW_AIO_DNS_LOOKUP)
	{
		MAKE_STD_ZVAL(zcontent);
		args[0] = &dns_req->domain;
		if (ret < 0)
		{
			ZVAL_STRING(zcontent, "", 0);
		}
		else
		{
			ZVAL_STRING(zcontent, event->buf, 0);
		}
		args[1] = &zcontent;
	}
//.........这里部分代码省略.........
开发者ID:Jackpakistan,项目名称:swoole-src,代码行数:101,代码来源:swoole_async.c


示例14: PHP_METHOD

PHP_METHOD(MongoGridFS, __construct) {
  zval *zdb, *files = 0, *chunks = 0, *zchunks;
  zval *z_w = NULL;

  // chunks is deprecated
  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|zz", &zdb, mongo_ce_DB, &files, &chunks) == FAILURE) {
    zval *object = getThis();
    ZVAL_NULL(object);
    return;
  }

  if (!files && !chunks) {
    MAKE_STD_ZVAL(files);
    ZVAL_STRING(files, "fs.files", 1);
    MAKE_STD_ZVAL(chunks);
    ZVAL_STRING(chunks, "fs.chunks", 1);
  }
  else {
    zval *temp_file;
    char *temp;

    if (Z_TYPE_P(files) != IS_STRING || Z_STRLEN_P(files) == 0 ) {
#if ZEND_MODULE_API_NO >= 20060613
        zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0
                                TSRMLS_CC,
                                "MongoGridFS::__construct(): invalid prefix");
#else
        zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC,
                                "MongoGridFS::__construct(): invalid prefix");
#endif /* ZEND_MODULE_API_NO >= 20060613 */
        return;
    }

    MAKE_STD_ZVAL(chunks);
    spprintf(&temp, 0, "%s.chunks", Z_STRVAL_P(files));
    ZVAL_STRING(chunks, temp, 0);

    MAKE_STD_ZVAL(temp_file);
    spprintf(&temp, 0, "%s.files", Z_STRVAL_P(files));
    ZVAL_STRING(temp_file, temp, 0);
    files = temp_file;
  }

  // create files collection
  MONGO_METHOD2(MongoCollection, __construct, return_value, getThis(), zdb, files);

  // create chunks collection
  MAKE_STD_ZVAL(zchunks);
  object_init_ex(zchunks, mongo_ce_Collection);
  MONGO_METHOD2(MongoCollection, __construct, return_value, zchunks, zdb, chunks);

  // add chunks collection as a property
  zend_update_property(mongo_ce_GridFS, getThis(), "chunks", strlen("chunks"), zchunks TSRMLS_CC);
  zend_update_property(mongo_ce_GridFS, getThis(), "filesName", strlen("filesName"), files TSRMLS_CC);
  zend_update_property(mongo_ce_GridFS, getThis(), "chunksName", strlen("chunksName"), chunks TSRMLS_CC);

	/* GridFS is forced in our codebase to be w=1 so this property doesn't actually mean
	 * anything, but we can't lie to the user so we have to overwrite it if the MongoDB
	 * object that created this object was w=0.
	 * This property is initialized in the MongoCollection (which we extend) ctor */
	z_w = zend_read_property(mongo_ce_GridFS, getThis(), "w", strlen("w"), NOISY TSRMLS_CC);
	if (Z_TYPE_P(z_w) != IS_STRING) {
		convert_to_long(z_w);
		if (Z_LVAL_P(z_w) < 2) {
			zend_update_property_long(mongo_ce_GridFS, getThis(), "w", strlen("w"), 1 TSRMLS_CC);
		}
	}

  // cleanup
  zval_ptr_dtor(&zchunks);

  zval_ptr_dtor(&files);
  zval_ptr_dtor(&chunks);
}
开发者ID:guanle,项目名称:mongo-php-driver,代码行数:74,代码来源:gridfs.c


示例15: PHP_METHOD

/* {{{ proto array Riak\Bucket->indexQuery(IndexQuery $query[, IndexInput $input])
Apply given properties to this bucket */
PHP_METHOD(RiakBucket, indexQuery)
{
    riak_connection *connection;
    riack_2i_query_req req;
    riack_string_list *result_keys;
    riack_string *continuation, *type;
    zval *zquery, *zinput, *zname, *zisrange, *zcontinuation, *zresult;
    int riackstatus;

    zinput = zquery = 0;
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|O", &zquery, riak_index_query_ce, &zinput, riak_index_input_ce) == FAILURE) {
        zend_throw_exception(riak_badarguments_exception_ce, "Bad or missing argument", 500 TSRMLS_CC);
        return;
    }
    // TODO Validate query have exact or ranged values
    connection = get_riak_connection(getThis() TSRMLS_CC);
    THROW_EXCEPTION_IF_CONNECTION_IS_NULL(connection);

    memset(&req, 0, sizeof(req));
    type = riack_get_bucket_type_from_bucket(connection->client, getThis() TSRMLS_CC);
    if (type != NULL) {
        req.bucket_type.len = type->len;
        req.bucket_type.value = type->value;
    }
    req.bucket = riack_name_from_bucket(getThis() TSRMLS_CC);

    MAKE_STD_ZVAL(zname);
    RIAK_CALL_METHOD(Riak_Query_IndexQuery, getName, zname, zquery);
    req.index.len = Z_STRLEN_P(zname);
    req.index.value = Z_STRVAL_P(zname);

    continuation = NULL;
    zcontinuation = NULL;
    if (zinput) {
        zval *zmaxresults;
        MAKE_STD_ZVAL(zmaxresults);
        RIAK_CALL_METHOD(Riak_Input_IndexInput, getMaxResults, zmaxresults, zinput);
        if (Z_TYPE_P(zmaxresults) == IS_LONG) {
            req.max_results = Z_LVAL_P(zmaxresults);
        }
        zval_ptr_dtor(&zmaxresults);

        MAKE_STD_ZVAL(zcontinuation);
        RIAK_CALL_METHOD(Riak_Input_IndexInput, getContinuation, zcontinuation, zinput);
        if (Z_TYPE_P(zcontinuation) == IS_STRING) {
            req.continuation_token.len = Z_STRLEN_P(zcontinuation);
            req.continuation_token.value = Z_STRVAL_P(zcontinuation);
        }
    }
    MAKE_STD_ZVAL(zisrange);
    RIAK_CALL_METHOD(Riak_Query_IndexQuery, isRangeQuery, zisrange, zquery);
    if (Z_BVAL_P(zisrange)) {
        zval *zmin, *zmax;
        // TODO Call getter instead, this is cheat
        zmin = zend_read_property(riak_index_query_ce, zquery, "minValue", sizeof("minValue")-1, 1 TSRMLS_CC);
        zmax = zend_read_property(riak_index_query_ce, zquery, "maxValue", sizeof("maxValue")-1, 1 TSRMLS_CC);
        req.search_min.len = Z_STRLEN_P(zmin);
        req.search_min.value = Z_STRVAL_P(zmin);
        req.search_max.len = Z_STRLEN_P(zmax);
        req.search_max.value = Z_STRVAL_P(zmax);
        RIACK_RETRY_OP(riackstatus, connection, riack_2i_query(connection->client, &req, &result_keys, &continuation));
    } else {
        zval *zexact;
        zexact = zend_read_property(riak_index_query_ce, zquery, "exactValue", sizeof("exactValue")-1, 1 TSRMLS_CC);
        req.search_exact.len = Z_STRLEN_P(zexact);
        req.search_exact.value = Z_STRVAL_P(zexact);
        RIACK_RETRY_OP(riackstatus, connection, riack_2i_query(connection->client, &req, &result_keys, &continuation));
    }
    zval_ptr_dtor(&zname);
    zval_ptr_dtor(&zisrange);
    if (zcontinuation) {
        zval_ptr_dtor(&zcontinuation);
    }
    RFREE(connection->client, type);
    CHECK_RIACK_STATUS_THROW_AND_RETURN_ON_ERROR(connection, riackstatus);
    zresult = riak_index_output_from_string_list_and_continuation(result_keys, continuation TSRMLS_CC);
    riack_free_string_p(connection->client, &continuation);
    riack_free_string_list_p(connection->client, &result_keys);
    RETURN_ZVAL(zresult, 0, 1);
}
开发者ID:pavelsmolka,项目名称:php_riak,代码行数:82,代码来源:bucket.c


示例16: suhosin_log

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MAKE_STRING函数代码示例发布时间:2022-05-30
下一篇:
C++ MAKE_SBDFO函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap