本文整理汇总了C++中HASH_OF函数的典型用法代码示例。如果您正苦于以下问题:C++ HASH_OF函数的具体用法?C++ HASH_OF怎么用?C++ HASH_OF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HASH_OF函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: geojson_linestring_to_array
int geojson_linestring_to_array(zval *line, geo_array **array)
{
geo_array *tmp;
zval **type, **coordinates;
if (Z_TYPE_P(line) != IS_ARRAY) {
return 0;
}
if (zend_hash_find(HASH_OF(line), "type", sizeof("type"), (void**) &type) != SUCCESS) {
return 0;
}
if (Z_TYPE_PP(type) != IS_STRING || strcmp(Z_STRVAL_PP(type), "Linestring") != 0) {
return 0;
}
if (zend_hash_find(HASH_OF(line), "coordinates", sizeof("coordinates"), (void**) &coordinates) != SUCCESS) {
return 0;
}
if (Z_TYPE_PP(coordinates) != IS_ARRAY) {
return 0;
}
tmp = geo_hashtable_to_array(*coordinates);
if (tmp && array) {
*array = tmp;
return 1;
}
return 0;
}
开发者ID:rickogden,项目名称:geospatial,代码行数:30,代码来源:geospatial.c
示例2: zend_is_auto_global_str
static char *oauth_provider_get_http_verb() /* {{{ */
{
zval *tmp;
zend_is_auto_global_str("_SERVER", sizeof("_SERVER")-1);
if(Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) != IS_UNDEF) {
if((tmp = zend_hash_str_find(HASH_OF(&PG(http_globals)[TRACK_VARS_SERVER]), "REQUEST_METHOD", sizeof("REQUEST_METHOD") - 1)) != NULL ||
(tmp = zend_hash_str_find(HASH_OF(&PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_METHOD", sizeof("HTTP_METHOD") - 1)) != NULL
) {
return Z_STRVAL_P(tmp);
}
}
return NULL;
}
开发者ID:keyurdg,项目名称:pecl-web_services-oauth,代码行数:15,代码来源:provider.c
示例3: PHP_METHOD
static PHP_METHOD(midgard_workspace_storage, list_children)
{
if (zend_parse_parameters_none() == FAILURE)
return;
guint n_objects;
MidgardWorkspaceStorage *self = MIDGARD_WORKSPACE_STORAGE(__php_gobject_ptr(getThis()));
MidgardWorkspaceStorage **children = midgard_workspace_storage_list_children(self, &n_objects);
array_init(return_value);
if (!children)
return;
const char *g_class_name = G_OBJECT_TYPE_NAME(children[0]);
zend_class_entry *ce = zend_fetch_class((char *) g_class_name, strlen(g_class_name), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
int i;
for (i = 0; i < n_objects; i++) {
zval *zobject;
MAKE_STD_ZVAL(zobject);
php_midgard_gobject_new_with_gobject(zobject, ce, G_OBJECT(children[i]), TRUE TSRMLS_CC);
zend_hash_next_index_insert(HASH_OF(return_value), &zobject, sizeof(zval *), NULL);
}
}
开发者ID:William-Wai,项目名称:midgard-php5,代码行数:26,代码来源:php_midgard_workspace_storage.c
示例4: real_php_log_buffer
static int real_php_log_buffer(zval *msg_buffer, char *opt, int opt_len TSRMLS_DC)
{
php_stream *stream = NULL;
HashTable *ht;
#if PHP_VERSION_ID >= 70000
zend_ulong num_key;
zend_string *str_key;
zval *entry;
#else
zval **log;
#endif
stream = process_stream(opt,opt_len TSRMLS_CC);
if (stream == NULL)
{
return FAILURE;
}
#if PHP_VERSION_ID >= 70000
ht = HASH_OF(msg_buffer);
ZEND_HASH_FOREACH_KEY_VAL(ht, num_key, str_key, entry)
{
zend_string *s = zval_get_string(entry);
php_stream_write(stream, ZSTR_VAL(s), ZSTR_LEN(s));
zend_string_release(s);
}
开发者ID:SeasX,项目名称:SeasLog,代码行数:29,代码来源:Buffer.c
示例5: append_multiple_key_values
/* {{{ append_multiple_key_values
* Internal function which is called from locale_compose
* gets the multiple values for the key_name and appends to the loc_name
* used for 'variant','extlang','private'
* returns 1 if successful , -1 if not found ,
* 0 if array element is not a string , -2 if buffer-overflow
*/
static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, char* key_name)
{
zval *ele_value;
int i = 0;
int isFirstSubtag = 0;
int max_value = 0;
/* Variant/ Extlang/Private etc. */
if ((ele_value = zend_hash_str_find( hash_arr , key_name , strlen(key_name))) != NULL) {
if( Z_TYPE_P(ele_value) == IS_STRING ){
add_prefix( loc_name , key_name);
smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1);
smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value));
return SUCCESS;
} else if(Z_TYPE_P(ele_value) == IS_ARRAY ) {
HashTable *arr = HASH_OF(ele_value);
zval *data;
ZEND_HASH_FOREACH_VAL(arr, data) {
if(Z_TYPE_P(data) != IS_STRING) {
return FAILURE;
}
if (isFirstSubtag++ == 0){
add_prefix(loc_name , key_name);
}
smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1);
smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRLEN_P(data));
} ZEND_HASH_FOREACH_END();
return SUCCESS;
} else {
return FAILURE;
开发者ID:0xhacking,项目名称:php-src,代码行数:39,代码来源:locale_methods.c
示例6: pip_sequence_to_hash
/* {{{ pip_sequence_to_hash(PyObject *seq)
* Convert a Python sequence to a PHP hash */
zval *
pip_sequence_to_hash(PyObject *seq)
{
zval *hash, *val;
PyObject *item;
int i = 0;
/* Make sure this object implements the sequence protocol */
if (!PySequence_Check(seq)) {
return NULL;
}
/* Initialize our PHP array */
MAKE_STD_ZVAL(hash);
if (array_init(hash) != SUCCESS) {
return NULL;
}
/* Iterate over the items in the sequence */
while (item = PySequence_GetItem(seq, i++)) {
val = pip_pyobject_to_zval(item);
if (zend_hash_next_index_insert(HASH_OF(hash), (void *)&val,
sizeof(zval *), NULL) == FAILURE) {
php_error(E_ERROR, "Python: Array conversion error");
}
Py_DECREF(item);
}
return hash;
}
开发者ID:demos,项目名称:Motif,代码行数:33,代码来源:pip_convert.c
示例7: geojson_point_to_lon_lat
int geojson_point_to_lon_lat(zval *point, double *lon, double *lat)
{
zval **type, **coordinates;
if (zend_hash_find(HASH_OF(point), "type", sizeof("type"), (void**) &type) != SUCCESS) {
return 0;
}
if (Z_TYPE_PP(type) != IS_STRING || strcmp(Z_STRVAL_PP(type), "Point") != 0) {
return 0;
}
if (zend_hash_find(HASH_OF(point), "coordinates", sizeof("coordinates"), (void**) &coordinates) != SUCCESS) {
return 0;
}
if (Z_TYPE_PP(coordinates) != IS_ARRAY) {
return 0;
}
return parse_point_pair(*coordinates, lon, lat);
}
开发者ID:rickogden,项目名称:geospatial,代码行数:19,代码来源:geospatial.c
示例8: pip_mapping_to_hash
/* {{{ pip_mapping_to_hash(PyObject *map)
Convert a Python mapping to a PHP hash */
zval *
pip_mapping_to_hash(PyObject *map)
{
zval *hash, *val;
PyObject *keys, *key, *item;
char *key_name;
int i, key_len;
if (!PyMapping_Check(map)) {
return NULL;
}
/* Initialize our PHP array */
MAKE_STD_ZVAL(hash);
if (array_init(hash) != SUCCESS) {
return NULL;
}
/* Retrieve the list of keys for this mapping */
keys = PyMapping_Keys(map);
if (keys == NULL) {
return hash;
}
/* Iterate over the list of keys */
for (i = 0; i < PySequence_Size(keys); i++) {
key = PySequence_GetItem(keys, i);
if (key) {
/* Get the string representation of the key */
if (pip_str(key, &key_name, &key_len) != -1) {
/* Extract the item for this key */
item = PyMapping_GetItemString(map, key_name);
if (item) {
val = pip_pyobject_to_zval(item);
/* Add the new item to the associative array */
if (zend_hash_update(HASH_OF(hash), key_name, key_len,
(void *)&val, sizeof(zval *),
NULL) == FAILURE) {
php_error(E_ERROR, "Python: Array conversion error");
}
Py_DECREF(item);
} else {
php_error(E_ERROR, "Python: Could not get item for key");
}
} else {
php_error(E_ERROR, "Python: Mapping key conversion error");
}
Py_DECREF(key);
}
}
Py_DECREF(keys);
return hash;
}
开发者ID:demos,项目名称:Motif,代码行数:57,代码来源:pip_convert.c
示例9: _php_array_to_envp
/* {{{ _php_array_to_envp */
static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent TSRMLS_DC)
{
zval *element;
php_process_env_t env;
zend_string *string_key;
#ifndef PHP_WIN32
char **ep;
#endif
char *p;
uint cnt, l, sizeenv=0;
HashTable *target_hash;
memset(&env, 0, sizeof(env));
if (!environment) {
return env;
}
cnt = zend_hash_num_elements(Z_ARRVAL_P(environment));
if (cnt < 1) {
#ifndef PHP_WIN32
env.envarray = (char **) pecalloc(1, sizeof(char *), is_persistent);
#endif
env.envp = (char *) pecalloc(4, 1, is_persistent);
return env;
}
target_hash = HASH_OF(environment);
if (!target_hash) {
return env;
}
/* first, we have to get the size of all the elements in the hash */
ZEND_HASH_FOREACH_STR_KEY_VAL(target_hash, string_key, element) {
zend_string *str = zval_get_string(element);
uint el_len = str->len;
STR_RELEASE(str);
if (el_len == 0) {
continue;
}
sizeenv += el_len + 1;
if (string_key) {
if (string_key->len == 0) {
continue;
}
sizeenv += string_key->len + 1;
}
} ZEND_HASH_FOREACH_END();
开发者ID:SiebelsTim,项目名称:php-src,代码行数:53,代码来源:proc_open.c
示例10: SWIG_ZTS_SetPointerZval
static void
SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject TSRMLS_DC) {
swig_object_wrapper *value=NULL;
/*
* First test for Null pointers. Return those as PHP native NULL
*/
if (!ptr ) {
ZVAL_NULL(z);
return;
}
if (type->clientdata) {
if (! (*(int *)(type->clientdata)))
zend_error(E_ERROR, "Type: %s failed to register with zend",type->name);
value=(swig_object_wrapper *)emalloc(sizeof(swig_object_wrapper));
value->ptr=ptr;
value->newobject=newobject;
if (newobject <= 1) {
/* Just register the pointer as a resource. */
ZEND_REGISTER_RESOURCE(z, value, *(int *)(type->clientdata));
} else {
/*
* Wrap the resource in an object, the resource will be accessible
* via the "_cPtr" member. This is currently only used by
* directorin typemaps.
*/
value->newobject = 0;
zval *resource;
MAKE_STD_ZVAL(resource);
ZEND_REGISTER_RESOURCE(resource, value, *(int *)(type->clientdata));
zend_class_entry **ce = NULL;
zval *classname;
MAKE_STD_ZVAL(classname);
/* _p_Foo -> Foo */
ZVAL_STRING(classname, (char*)type->name+3, 1);
/* class names are stored in lowercase */
php_strtolower(Z_STRVAL_PP(&classname), Z_STRLEN_PP(&classname));
if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &ce TSRMLS_CC) != SUCCESS) {
/* class does not exist */
object_init(z);
} else {
object_init_ex(z, *ce);
}
Z_SET_REFCOUNT_P(z, 1);
Z_SET_ISREF_P(z);
zend_hash_update(HASH_OF(z), (char*)"_cPtr", sizeof("_cPtr"), (void*)&resource, sizeof(zval), NULL);
FREE_ZVAL(classname);
}
return;
}
zend_error(E_ERROR, "Type: %s not registered with zend",type->name);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:51,代码来源:gdalconst_wrap.c
示例11: PHP_METHOD
/**
* Construct an instance of the Channel class. If the $args array contains a
* "credentials" key mapping to a ChannelCredentials object, a secure channel
* will be created with those credentials.
* @param string $target The hostname to associate with this channel
* @param array $args The arguments to pass to the Channel (optional)
*/
PHP_METHOD(Channel, __construct) {
wrapped_grpc_channel *channel = Z_WRAPPED_GRPC_CHANNEL_P(getThis());
zend_string *target;
zval *args_array = NULL;
grpc_channel_args args;
HashTable *array_hash;
zval *creds_obj = NULL;
wrapped_grpc_channel_credentials *creds = NULL;
/* "Sa" == 1 string, 1 array */
#ifndef FAST_ZPP
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sa", &target, &args_array)
== FAILURE) {
zend_throw_exception(spl_ce_InvalidArgumentException,
"Channel expects a string and an array", 1);
return;
}
#else
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STR(target)
Z_PARAM_ARRAY(args_array)
ZEND_PARSE_PARAMETERS_END();
#endif
array_hash = HASH_OF(args_array);
if ((creds_obj = zend_hash_str_find(array_hash, "credentials",
sizeof("credentials") - 1)) != NULL) {
if (Z_TYPE_P(creds_obj) == IS_NULL) {
creds = NULL;
zend_hash_str_del(array_hash, "credentials", sizeof("credentials") - 1);
} else if (Z_OBJ_P(creds_obj)->ce != grpc_ce_channel_credentials) {
zend_throw_exception(spl_ce_InvalidArgumentException,
"credentials must be a ChannelCredentials object",
1);
return;
} else {
creds = Z_WRAPPED_GRPC_CHANNEL_CREDS_P(creds_obj);
zend_hash_str_del(array_hash, "credentials", sizeof("credentials") - 1);
}
}
php_grpc_read_args_array(args_array, &args);
if (creds == NULL) {
channel->wrapped = grpc_insecure_channel_create(ZSTR_VAL(target),
&args, NULL);
} else {
channel->wrapped =
grpc_secure_channel_create(creds->wrapped, ZSTR_VAL(target),
&args, NULL);
}
efree(args.args);
}
开发者ID:stanley-cheung,项目名称:grpc-php7,代码行数:58,代码来源:channel.c
示例12: php_grpc_read_args_array
void php_grpc_read_args_array(zval *args_array, grpc_channel_args *args) {
HashTable *array_hash;
//HashPosition array_pointer;
int args_index;
zval *data;
zend_string *key;
//zend_ulong index;
array_hash = HASH_OF(args_array);
if (!array_hash) {
zend_throw_exception(spl_ce_InvalidArgumentException,
"array_hash is NULL", 1);
return;
}
args->num_args = zend_hash_num_elements(array_hash);
args->args = ecalloc(args->num_args, sizeof(grpc_arg));
args_index = 0;
ZEND_HASH_FOREACH_STR_KEY_VAL(array_hash, key, data) {
/*for (zend_hash_internal_pointer_reset_ex(array_hash, &array_pointer);
(data = zend_hash_get_current_data_ex(array_hash,
&array_pointer)) != NULL;
zend_hash_move_forward_ex(array_hash, &array_pointer)) {
if (zend_hash_get_current_key_ex(array_hash, &key, &index,
&array_pointer) != HASH_KEY_IS_STRING) {
zend_throw_exception(spl_ce_InvalidArgumentException,
"args keys must be strings", 1);
return;
}*/
if (key == NULL) {
zend_throw_exception(spl_ce_InvalidArgumentException,
"args keys must be strings", 1);
}
args->args[args_index].key = ZSTR_VAL(key);
switch (Z_TYPE_P(data)) {
case IS_LONG:
args->args[args_index].value.integer = (int)Z_LVAL_P(data);
args->args[args_index].type = GRPC_ARG_INTEGER;
break;
case IS_STRING:
args->args[args_index].value.string = Z_STRVAL_P(data);
args->args[args_index].type = GRPC_ARG_STRING;
break;
default:
zend_throw_exception(spl_ce_InvalidArgumentException,
"args values must be int or string", 1);
return;
}
args_index++;
} ZEND_HASH_FOREACH_END();
}
开发者ID:stanley-cheung,项目名称:grpc-php7,代码行数:49,代码来源:channel.c
示例13: dom_nodelist_length_read
/* {{{ length int
readonly=yes
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-203510337
Since:
*/
int dom_nodelist_length_read(dom_object *obj, zval *retval)
{
dom_nnodemap_object *objmap;
xmlNodePtr nodep, curnode;
int count = 0;
HashTable *nodeht;
objmap = (dom_nnodemap_object *)obj->ptr;
if (objmap != NULL) {
if (objmap->ht) {
count = xmlHashSize(objmap->ht);
} else {
if (objmap->nodetype == DOM_NODESET) {
nodeht = HASH_OF(&objmap->baseobj_zv);
count = zend_hash_num_elements(nodeht);
} else {
nodep = dom_object_get_node(objmap->baseobj);
if (nodep) {
if (objmap->nodetype == XML_ATTRIBUTE_NODE || objmap->nodetype == XML_ELEMENT_NODE) {
curnode = nodep->children;
if (curnode) {
count++;
while (curnode->next != NULL) {
count++;
curnode = curnode->next;
}
}
} else {
if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) {
nodep = xmlDocGetRootElement((xmlDoc *) nodep);
} else {
nodep = nodep->children;
}
curnode = dom_get_elements_by_tag_name_ns_raw(
nodep, (char *) objmap->ns, (char *) objmap->local, &count, -1);
}
}
}
}
}
ZVAL_LONG(retval, count);
return SUCCESS;
}
开发者ID:0xhacking,项目名称:php-src,代码行数:49,代码来源:nodelist.c
示例14: switch
php_http_url_t *php_http_url_from_zval(zval *value, unsigned flags TSRMLS_DC)
{
zval *zcpy;
php_http_url_t *purl;
switch (Z_TYPE_P(value)) {
case IS_ARRAY:
case IS_OBJECT:
purl = php_http_url_from_struct(HASH_OF(value));
break;
default:
zcpy = php_http_ztyp(IS_STRING, value);
purl = php_http_url_parse(Z_STRVAL_P(zcpy), Z_STRLEN_P(zcpy), flags TSRMLS_CC);
zval_ptr_dtor(&zcpy);
}
return purl;
}
开发者ID:datasift,项目名称:ext-http,代码行数:19,代码来源:php_http_url.c
示例15: php_mail_build_headers_elems
static void php_mail_build_headers_elems(smart_str *s, zend_string *key, zval *val)
{
zend_ulong idx;
zend_string *tmp_key;
zval *tmp_val;
(void)(idx);
ZEND_HASH_FOREACH_KEY_VAL(HASH_OF(val), idx, tmp_key, tmp_val) {
if (tmp_key) {
php_error_docref(NULL, E_WARNING, "Multiple header key must be numeric index (%s)", ZSTR_VAL(tmp_key));
continue;
}
if (Z_TYPE_P(tmp_val) != IS_STRING) {
php_error_docref(NULL, E_WARNING, "Multiple header values must be string (%s)", ZSTR_VAL(key));
continue;
}
php_mail_build_headers_elem(s, key, tmp_val);
} ZEND_HASH_FOREACH_END();
}
开发者ID:LTD-Beget,项目名称:php-src,代码行数:19,代码来源:mail.c
示例16: ZEND_METHOD
ZEND_METHOD( alinq_class , getArrayItem )
{
zval *data_array;
zval *copy_array;
char *name;
int name_len;
zval **fooval;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "as",&data_array, &name, &name_len) == FAILURE) {
RETURN_NULL();
}
if(zend_hash_find(HASH_OF(data_array),name,name_len,(void**)&fooval) == SUCCESS ){
RETVAL_ZVAL(*fooval, 1, 0);
}else{
RETVAL_STRING("index_not_found", 1);
}
return;
}
开发者ID:wosiwo,项目名称:clinq,代码行数:19,代码来源:alinq.c
示例17: PHP_METHOD
static PHP_METHOD(midgard_query_builder, execute)
{
RETVAL_FALSE;
MidgardConnection *mgd = mgd_handle(TSRMLS_C);
CHECK_MGD(mgd);
if (zend_parse_parameters_none() == FAILURE)
return;
_GET_BUILDER_OBJECT;
zend_class_entry *ce = php_gobject->user_ce;
if (ce == NULL) {
php_error(E_WARNING, "Query Builder instance not associated with any class");
return;
}
guint i, n_objects;
GObject **objects = midgard_query_builder_execute(builder, &n_objects);
array_init(return_value);
if (!objects)
return;
/* TODO: Should use iterator, instead, and create objects lazily */
/* Initialize zend objects for the same class which was used to initialize Query Builder */
for (i = 0; i < n_objects; i++) {
GObject *gobject = objects[i];
zval *zobject;
/* TODO: Simplify code below. If possible. */
MAKE_STD_ZVAL(zobject);
object_init_ex(zobject, ce); /* Initialize new object for which QB has been created for */
MGD_PHP_SET_GOBJECT(zobject, gobject); // inject our gobject
zend_call_method_with_0_params(&zobject, ce, &ce->constructor, "__construct", NULL); /* Call class constructor on given instance */
zend_hash_next_index_insert(HASH_OF(return_value), &zobject, sizeof(zval *), NULL);
}
if (objects)
g_free(objects);
}
开发者ID:indeyets,项目名称:midgard-php5,代码行数:43,代码来源:query_builder.c
示例18: PHP_METHOD
/**
* Returns a list of all the events associated with the EventLoop.
*
* NOTE: In the case of the default event loop, only events which have
* been added using php-libev will be returned as the others are
* managed by others.
*
* @return array
*/
PHP_METHOD(EventLoop, getEvents)
{
event_loop_object *obj = (event_loop_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
array_init(return_value);
event_object *ev = obj->events;
while(ev)
{
assert(ev->this);
zval_add_ref(&ev->this);
zend_hash_next_index_insert(HASH_OF(return_value), (void *)&ev->this, sizeof(zval *), NULL);
ev = ev->next;
}
return;
}
开发者ID:WordpressDev,项目名称:php-libev,代码行数:29,代码来源:EventLoop.c
示例19: parse_point_pair
static int parse_point_pair(zval *coordinates, double *lon, double *lat)
{
HashTable *coords;
zval **z_lon, **z_lat;
coords = HASH_OF(coordinates);
if (coords->nNumOfElements != 2) {
return 0;
}
if (zend_hash_index_find(coords, 0, (void**) &z_lon) != SUCCESS) {
return 0;
}
if (zend_hash_index_find(coords, 1, (void**) &z_lat) != SUCCESS) {
return 0;
}
convert_to_double_ex(z_lon);
convert_to_double_ex(z_lat);
*lon = Z_DVAL_PP(z_lon);
*lat = Z_DVAL_PP(z_lat);
return 1;
}
开发者ID:rickogden,项目名称:geospatial,代码行数:21,代码来源:geospatial.c
示例20: PHP_METHOD
static PHP_METHOD(midgard_query_builder, execute)
{
RETVAL_FALSE;
MidgardConnection *mgd = mgd_handle(TSRMLS_C);
CHECK_MGD(mgd);
if (zend_parse_parameters_none() == FAILURE)
return;
_GET_BUILDER_OBJECT;
zend_class_entry *ce = php_gobject->user_ce;
if (ce == NULL) {
php_error(E_WARNING, "Query Builder instance not associated with any class");
return;
}
guint i, n_objects;
GObject **objects = midgard_query_builder_execute(builder, &n_objects);
array_init(return_value);
if (!objects)
return;
/* TODO: Should use iterator, instead, and create objects lazily */
for (i = 0; i < n_objects; i++) {
GObject *gobject = objects[i];
zval *zobject;
MAKE_STD_ZVAL(zobject);
php_midgard_gobject_new_with_gobject(zobject, ce, gobject, TRUE TSRMLS_CC);
zend_hash_next_index_insert(HASH_OF(return_value), &zobject, sizeof(zval *), NULL);
}
if (objects)
g_free(objects);
}
开发者ID:William-Wai,项目名称:midgard-php5,代码行数:40,代码来源:query_builder.c
注:本文中的HASH_OF函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论