summaryrefslogtreecommitdiff
path: root/ext/yaz/php_yaz.c
diff options
context:
space:
mode:
authorAdam Dickmeiss <dickmeiss@php.net>2002-10-28 10:56:24 +0000
committerAdam Dickmeiss <dickmeiss@php.net>2002-10-28 10:56:24 +0000
commite7daf531de15abdb95971393dff05ae3d761fcb5 (patch)
treea6a4f77a2e4bd5a5231092c062796c1e506eac3f /ext/yaz/php_yaz.c
parentabb1f691661415ed741dc7ebe414fc2e944a9c69 (diff)
downloadphp-git-e7daf531de15abdb95971393dff05ae3d761fcb5.tar.gz
Raw records for yaz_record
Diffstat (limited to 'ext/yaz/php_yaz.c')
-rw-r--r--ext/yaz/php_yaz.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/ext/yaz/php_yaz.c b/ext/yaz/php_yaz.c
index 338e945147..9728231ab2 100644
--- a/ext/yaz/php_yaz.c
+++ b/ext/yaz/php_yaz.c
@@ -344,7 +344,7 @@ PHP_FUNCTION(yaz_connect)
option_set (as, "otherInfo1", otherInfo[1]);
option_set (as, "otherInfo2", otherInfo[2]);
option_set (as, "piggyback", piggyback ? "1" : "0");
- ZOOM_connection_connect (as->zoom_conn, zurl_str, 0);
+ ZOOM_connection_connect (as->zoom_conn, zurl_str, 0);
break;
}
}
@@ -936,19 +936,7 @@ PHP_FUNCTION(yaz_record)
type = "render";
if (r)
{
- if (!strcmp (type, "syntax") ||
- !strcmp (type, "database") ||
- !strcmp (type, "render") ||
- !strcmp (type, "xml"))
- {
- const char *info = ZOOM_record_get (r, type, 0);
-
- return_value->value.str.len = strlen(info);
- return_value->value.str.val =
- estrndup(info, return_value->value.str.len);
- return_value->type = IS_STRING;
- }
- else if (!strcmp (type, "array"))
+ if (!strcmp (type, "array"))
{
Z_External *ext = (Z_External *) ZOOM_record_get (r, "ext", 0);
oident *ent = oid_getentbyoid(ext->direct_reference);
@@ -980,6 +968,24 @@ PHP_FUNCTION(yaz_record)
odr_destroy (odr);
}
}
+ else
+ {
+ int rlen;
+ const char *info = ZOOM_record_get (r, type, &rlen);
+
+ if (rlen <= 0)
+ {
+ return_value->value.str.len = 0;
+ return_value->value.str.val = "";
+ }
+ else
+ {
+ return_value->value.str.len = rlen;
+ return_value->value.str.val =
+ estrndup(info, return_value->value.str.len);
+ }
+ return_value->type = IS_STRING;
+ }
}
}
release_assoc (p);