int i;
char *cp;
char *zurl_str;
+ int zurl_len;
const char *sru_str = 0, *sru_version_str = 0;
const char *user_str = 0, *group_str = 0, *pass_str = 0;
const char *cookie_str = 0, *proxy_str = 0;
const char *preferredMessageSize = 0;
int persistent = 1;
int piggyback = 1;
- zval *zurl, *user = 0;
Yaz_Association as;
int max_links = YAZSG(max_links);
otherInfo[0] = otherInfo[1] = otherInfo[2] = 0;
if (ZEND_NUM_ARGS() == 1) {
- if (GET_PARM1(&zurl) == FAILURE) {
+ if (zend_parse_parameters(1 TSRMLS_CC, "s", &zurl_str, &zurl_len)
+ == FAILURE) {
WRONG_PARAM_COUNT;
}
} else if (ZEND_NUM_ARGS() == 2) {
- if (GET_PARM2(&zurl, &user) == FAILURE) {
+ zval *user = 0;
+ if (zend_parse_parameters(2 TSRMLS_CC, "sz", &zurl_str, &zurl_len,
+ &user) == FAILURE) {
WRONG_PARAM_COUNT;
}
} else {
WRONG_PARAM_COUNT;
}
- convert_to_string_ex(&zurl);
- zurl_str = zurl->value.str.val;
for (cp = zurl_str; *cp && strchr("\t\n ", *cp); cp++);
if (!*cp) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty zurl");
Yaz_Association p;
zval *id;
- if (ZEND_NUM_ARGS() != 1) {
+ if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters(1 TSRMLS_CC, "z", &id)
+ == FAILURE) {
WRONG_PARAM_COUNT;
}
- if (GET_PARM1(&id) == FAILURE) {
- RETURN_FALSE;
- }
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
if (!p) {
RETURN_FALSE;
PHP_FUNCTION(yaz_search)
{
char *query_str, *type_str;
- zval *id, *type, *query;
+ int query_len, type_len;
+ zval *id;
Yaz_Association p;
- if (ZEND_NUM_ARGS() == 3) {
- if (GET_PARM3(&id, &type, &query) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
+ if (ZEND_NUM_ARGS() != 3 ||
+ zend_parse_parameters(3 TSRMLS_CC, "zss", &id,
+ &type_str, &type_len,
+ &query_str, &query_len) == FAILURE) {
WRONG_PARAM_COUNT;
}
-
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
if (!p) {
RETURN_FALSE;
}
- convert_to_string_ex(&type);
- type_str = type->value.str.val;
- convert_to_string_ex(&query);
- query_str = query->value.str.val;
-
ZOOM_resultset_destroy(p->zoom_set);
p->zoom_set = 0;
zval *id;
Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1) {
- WRONG_PARAM_COUNT;
- }
- if (GET_PARM1(&id) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters(1 TSRMLS_CC, "z", &id)
+ == FAILURE) {
WRONG_PARAM_COUNT;
}
-
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
if (!p) {
RETURN_FALSE;
long *val = 0;
long *event_bool = 0;
HashTable *options_ht = 0;
- if (GET_PARM1(&pval_options) == FAILURE) {
+ if (zend_parse_parameters(1 TSRMLS_CC, "a", &pval_options) ==
+ FAILURE) {
WRONG_PARAM_COUNT;
}
- if (Z_TYPE_PP(&pval_options) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array parameter");
- RETURN_FALSE;
- }
options_ht = Z_ARRVAL_PP(&pval_options);
val = array_lookup_long(options_ht, "timeout");
if (val) {
Yaz_Association p = conn_as[ev-1];
int event_code = ZOOM_connection_last_event(p->zoom_conn);
- add_assoc_long(pval_options, "connid", ev);
-
- add_assoc_long(pval_options, "eventcode", event_code);
+ if (pval_options) {
+ add_assoc_long(pval_options, "connid", ev);
+ add_assoc_long(pval_options, "eventcode", event_code);
+ }
zend_list_addref(p->zval_resource);
Z_LVAL_P(return_value) = p->zval_resource;
zval *id;
Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 || GET_PARM1(&id) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters(1 TSRMLS_CC, "z", &id)
+ == FAILURE) {
WRONG_PARAM_COUNT;
}
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
zval *id;
Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 || GET_PARM1(&id) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters(1 TSRMLS_CC, "z", &id)
+ == FAILURE) {
WRONG_PARAM_COUNT;
}
-
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
if (p) {
int code = ZOOM_connection_errcode(p->zoom_conn);
zval *id;
Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 || GET_PARM1(&id) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters(1 TSRMLS_CC, "z", &id)
+ == FAILURE) {
WRONG_PARAM_COUNT;
}
-
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, id, &p);
if (p) {
const char *addinfo = ZOOM_connection_addinfo(p->zoom_conn);
Yaz_Association p;
if (ZEND_NUM_ARGS() == 1) {
- if (GET_PARM1(&id) == FAILURE) {
+ if (zend_parse_parameters(1 TSRMLS_CC, "z", &id) == FAILURE) {
WRONG_PARAM_COUNT;
}
} else if (ZEND_NUM_ARGS() == 2) {
- if (GET_PARM2(&id, &searchresult) == FAILURE) {
+ if (zend_parse_parameters(2 TSRMLS_CC, "za", &id, &searchresult)
+ == FAILURE) {
WRONG_PARAM_COUNT;
}
- if (array_init(searchresult) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "Could not initialize search result array");
- RETURN_FALSE;
- }
} else {
WRONG_PARAM_COUNT;
}
ZOOM_resultset_option_get(p->zoom_set, "searchresult.size");
int i, sz = 0;
-
if (sz_str && *sz_str)
sz = atoi(sz_str);
for (i = 0; i<sz; i++)
Return record information at given result set position */
PHP_FUNCTION(yaz_record)
{
- zval *pval_id, *pval_pos, *pval_type;
+ zval *pval_id;
Yaz_Association p;
- int pos;
+ long pos;
char *type;
+ int type_len;
if (ZEND_NUM_ARGS() != 3) {
WRONG_PARAM_COUNT;
}
- if (GET_PARM3( &pval_id, &pval_pos, &pval_type) == FAILURE) {
+
+ if (zend_parse_parameters(3 TSRMLS_CC, "zls", &pval_id, &pos,
+ &type, &type_len) == FAILURE) {
WRONG_PARAM_COUNT;
}
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- convert_to_long_ex(&pval_pos);
- pos = pval_pos->value.lval;
- convert_to_string_ex(&pval_type);
- type = pval_type->value.str.val;
-
if (p && p->zoom_set) {
ZOOM_record r;
char type_args[4][60]; /* 0; 1=2,3 (1 is assumed charset) */
Set record syntax for retrieval */
PHP_FUNCTION(yaz_syntax)
{
- zval *pval_id, *pval_syntax;
+ zval *pval_id;
+ const char *syntax;
+ int syntax_len;
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- GET_PARM2(&pval_id, &pval_syntax) == FAILURE) {
+ zend_parse_parameters(2 TSRMLS_CC, "zs", &pval_id,
+ &syntax, &syntax_len) == FAILURE) {
WRONG_PARAM_COUNT;
}
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- convert_to_string_ex(&pval_syntax);
- option_set(p, "preferredRecordSyntax", pval_syntax->value.str.val);
+ option_set(p, "preferredRecordSyntax", syntax);
release_assoc(p);
}
/* }}} */
Set Element-Set-Name for retrieval */
PHP_FUNCTION(yaz_element)
{
- zval *pval_id, *pval_element;
+ zval *pval_id;
+ const char *element;
+ int element_len;
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- GET_PARM2(&pval_id, &pval_element) == FAILURE) {
+ zend_parse_parameters(2 TSRMLS_CC, "zs", &pval_id,
+ &element, &element_len) == FAILURE) {
WRONG_PARAM_COUNT;
}
-
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- convert_to_string_ex(&pval_element);
- option_set(p, "elementSetName", pval_element->value.str.val);
+ option_set(p, "elementSetName", element);
release_assoc(p);
}
/* }}} */
Set Schema for retrieval */
PHP_FUNCTION(yaz_schema)
{
- zval *pval_id, *pval_element;
+ zval *pval_id;
+ const char *schema;
+ int schema_len;
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- GET_PARM2(&pval_id, &pval_element) == FAILURE) {
+ zend_parse_parameters(2 TSRMLS_CC, "zs", &pval_id,
+ &schema, &schema_len) == FAILURE) {
WRONG_PARAM_COUNT;
}
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- convert_to_string_ex(&pval_element);
- option_set(p, "schema", pval_element->value.str.val);
+ option_set(p, "schema", schema);
release_assoc(p);
}
/* }}} */
Set Option(s) for connection */
PHP_FUNCTION(yaz_set_option)
{
- zval *pval_ar, *pval_name, *pval_val, *pval_id;
Yaz_Association p;
if (ZEND_NUM_ARGS() == 2) {
- if (GET_PARM2(&pval_id, &pval_ar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(&pval_ar) != IS_ARRAY) {
+ zval *pval_ar, *pval_id;
+ if (zend_parse_parameters(2 TSRMLS_CC, "za",
+ &pval_id, &pval_ar) == FAILURE) {
WRONG_PARAM_COUNT;
}
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
release_assoc(p);
}
} else if (ZEND_NUM_ARGS() == 3) {
- if (GET_PARM3( &pval_id, &pval_name, &pval_val) == FAILURE) {
+ zval *pval_id;
+ char *name, *value;
+ int name_len, value_len;
+ if (zend_parse_parameters(3 TSRMLS_CC, "zss",
+ &pval_id, &name, &name_len,
+ &value, &value_len) == FAILURE) {
WRONG_PARAM_COUNT;
}
get_assoc (INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- convert_to_string_ex(&pval_name);
- convert_to_string_ex(&pval_val);
- option_set(p, pval_name->value.str.val, pval_val->value.str.val);
-
+ option_set(p, name, value);
release_assoc(p);
} else {
WRONG_PARAM_COUNT;
Set Option(s) for connection */
PHP_FUNCTION(yaz_get_option)
{
- zval *pval_id, *pval_name;
+ zval *pval_id;
+ char *name;
+ int name_len;
Yaz_Association p;
- if (ZEND_NUM_ARGS() != 2) {
- WRONG_PARAM_COUNT;
- }
- if (GET_PARM2(&pval_id, &pval_name) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 2 ||
+ zend_parse_parameters(2 TSRMLS_CC, "zs", &pval_id, &name, &name_len)
+ == FAILURE) {
WRONG_PARAM_COUNT;
}
-
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
if (p) {
const char *name_str, *v;
- convert_to_string_ex(&pval_name);
- name_str = pval_name->value.str.val;
-
- v = option_get(p, name_str);
+ v = option_get(p, name);
if (!v) {
v = "";
}
Set result set start point and number of records to request */
PHP_FUNCTION(yaz_range)
{
- zval *pval_id, *pval_start, *pval_number;
+ zval *pval_id;
Yaz_Association p;
- int start;
+ long start, number;
if (ZEND_NUM_ARGS() != 3 ||
- GET_PARM3( &pval_id, &pval_start, &pval_number) == FAILURE) {
+ zend_parse_parameters(3 TSRMLS_CC, "zll", &pval_id, &start, &number)
+ == FAILURE) {
WRONG_PARAM_COUNT;
}
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
- convert_to_long_ex(&pval_start);
- convert_to_long_ex(&pval_number);
- start = pval_start->value.lval;
- count = pval_number->value.lval;
option_set_int(p, "start", start > 0 ? start - 1 : 0);
- option_set_int(p, "count", pval_number->value.lval);
+ option_set_int(p, "count", number);
release_assoc(p);
}
/* }}} */
Set result set sorting criteria */
PHP_FUNCTION(yaz_sort)
{
- zval *pval_id, *pval_criteria;
+ zval *pval_id;
+ const char *criteria;
+ int criteria_len;
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- GET_PARM2(&pval_id, &pval_criteria) == FAILURE) {
+ zend_parse_parameters(2 TSRMLS_CC, "zs", &pval_id, &criteria,
+ &criteria_len) == FAILURE) {
WRONG_PARAM_COUNT;
}
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
if (p) {
- convert_to_string_ex(&pval_criteria);
xfree(p->sort_criteria);
- p->sort_criteria = xstrdup(pval_criteria->value.str.val);
+ p->sort_criteria = xstrdup(criteria);
if (p->zoom_set)
- ZOOM_resultset_sort(p->zoom_set, "yaz",
- pval_criteria->value.str.val);
+ ZOOM_resultset_sort(p->zoom_set, "yaz", criteria);
}
release_assoc(p);
}
Yaz_Association p;
if (ZEND_NUM_ARGS() != 2 ||
- GET_PARM2(&pval_id, &pval_package) == FAILURE) {
+ zend_parse_parameters(2 TSRMLS_CC, "za", &pval_id, &pval_package) ==
+ FAILURE) {
WRONG_PARAM_COUNT;
}
- if (Z_TYPE_PP(&pval_package) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array parameter");
- RETURN_FALSE;
- }
-
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
if (p) {
ZOOM_options options = ZOOM_options_create();
Sends Extended Services Request */
PHP_FUNCTION(yaz_es)
{
- zval *pval_id, *pval_type, *pval_package;
+ zval *pval_id, *pval_package;
+ const char *type;
+ int type_len;
Yaz_Association p;
if (ZEND_NUM_ARGS() != 3 ||
- GET_PARM3( &pval_id, &pval_type, &pval_package) == FAILURE) {
+ zend_parse_parameters(3 TSRMLS_CC, "zsa", &pval_id,
+ &type, &type_len, &pval_package) == FAILURE) {
WRONG_PARAM_COUNT;
}
- if (Z_TYPE_PP(&pval_type) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected string parameter");
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(&pval_package) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array parameter");
- RETURN_FALSE;
- }
-
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
if (p) {
ZOOM_options options = ZOOM_options_create();
Z_ARRVAL_PP(&pval_package));
ZOOM_package_destroy(p->zoom_package);
p->zoom_package = ZOOM_connection_package(p->zoom_conn, options);
- ZOOM_package_send(p->zoom_package, pval_type->value.str.val);
+ ZOOM_package_send(p->zoom_package, type);
ZOOM_options_set_callback(options, 0, 0);
ZOOM_options_destroy(options);
}
Sends Scan Request */
PHP_FUNCTION(yaz_scan)
{
- zval *pval_id, *pval_type, *pval_query, *pval_flags = 0;
+ zval *pval_id, *pval_flags;
+ char *type, *query;
+ int type_len, query_len;
HashTable *flags_ht = 0;
Yaz_Association p;
if (ZEND_NUM_ARGS() == 3) {
- if (GET_PARM3( &pval_id, &pval_type, &pval_query) == FAILURE) {
+ if (zend_parse_parameters(3 TSRMLS_CC, "zss",
+ &pval_id, &type, &type_len,
+ &query, &query_len) == FAILURE) {
WRONG_PARAM_COUNT;
}
} else if (ZEND_NUM_ARGS() == 4) {
- if (GET_PARM4(&pval_id, &pval_type, &pval_query, &pval_flags)
- == FAILURE) {
+ if (zend_parse_parameters(4 TSRMLS_CC, "zssa",
+ &pval_id, &type, &type_len,
+ &query, &query_len, &pval_flags) == FAILURE) {
WRONG_PARAM_COUNT;
}
- if (Z_TYPE_PP(&pval_flags) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad flags parameter");
- RETURN_FALSE;
- }
flags_ht = Z_ARRVAL_PP(&pval_flags);
} else {
WRONG_PARAM_COUNT;
}
-
- convert_to_string_ex(&pval_type);
- convert_to_string_ex(&pval_query);
-
get_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, pval_id, &p);
ZOOM_scanset_destroy(p->zoom_scan);
p->zoom_scan = 0;
option_set(p, "number", array_lookup_string(flags_ht, "number"));
option_set(p, "position", array_lookup_string(flags_ht, "position"));
option_set(p, "stepSize", array_lookup_string(flags_ht, "stepsize"));
- p->zoom_scan = ZOOM_connection_scan(p->zoom_conn,
- Z_STRVAL_PP(&pval_query));
+ p->zoom_scan = ZOOM_connection_scan(p->zoom_conn, query);
}
release_assoc(p);
}
zval *pval_id;
Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 || GET_PARM1(&pval_id) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters(1 TSRMLS_CC, "z",
+ &pval_id) == FAILURE) {
WRONG_PARAM_COUNT;
}
Yaz_Association p;
if (ZEND_NUM_ARGS() == 2) {
- if (GET_PARM2(&pval_id, &pval_opt) == FAILURE) {
+ if (zend_parse_parameters(2 TSRMLS_CC, "zz",
+ &pval_id, &pval_opt) == FAILURE) {
WRONG_PARAM_COUNT;
}
} else if (ZEND_NUM_ARGS() == 1) {
- if (GET_PARM1(&pval_id) == FAILURE) {
+ if (zend_parse_parameters(1 TSRMLS_CC, "z",
+ &pval_id) == FAILURE) {
WRONG_PARAM_COUNT;
}
} else {
ccl_qual_rm(&p->bibset);
p->bibset = ccl_qual_mk();
- for(zend_hash_internal_pointer_reset_ex(ht, &pos);
+ for (zend_hash_internal_pointer_reset_ex(ht, &pos);
zend_hash_get_current_data_ex(ht, (void**) &ent, &pos) == SUCCESS;
zend_hash_move_forward_ex(ht, &pos)
) {