dickmeiss Tue Jan 30 05:09:27 2001 EDT
Modified files:
/php4/ext/yaz README php_yaz.c
Log:
Fixed problem with looping present requests for Isite targets.
Index: php4/ext/yaz/README
diff -u php4/ext/yaz/README:1.1 php4/ext/yaz/README:1.2
--- php4/ext/yaz/README:1.1 Thu May 25 15:24:42 2000
+++ php4/ext/yaz/README Tue Jan 30 05:09:24 2001
@@ -1,7 +1,4 @@
-What is PHP extension YAZ?
-
-This extension implements a Z39.50 client and is build on top of
-the YAZ toolkit.
+This extension implements a Z39.50 client for PHP using the YAZ toolkit.
Find more information at:
http://www.indexdata.dk/phpyaz/
Index: php4/ext/yaz/php_yaz.c
diff -u php4/ext/yaz/php_yaz.c:1.7 php4/ext/yaz/php_yaz.c:1.8
--- php4/ext/yaz/php_yaz.c:1.7 Wed Nov 1 14:10:54 2000
+++ php4/ext/yaz/php_yaz.c Tue Jan 30 05:09:24 2001
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_yaz.c,v 1.7 2000/11/01 22:10:54 dickmeiss Exp $ */
+/* $Id: php_yaz.c,v 1.8 2001/01/30 13:09:24 dickmeiss Exp $ */
#include "php.h"
@@ -321,7 +321,8 @@
static int send_present (Yaz_Association t);
-static void handle_records (Yaz_Association t, Z_Records *sr)
+static void handle_records (Yaz_Association t, Z_Records *sr,
+ int present_phase)
{
if (sr && sr->which == Z_Records_NSD)
{
@@ -338,7 +339,7 @@
else if (sr && sr->which == Z_Records_multipleNSD)
{
if (sr->u.multipleNonSurDiagnostics->num_diagRecs >= 1)
- response_diag(t,
sr->u.multipleNonSurDiagnostics->diagRecs[0]);
+ response_diag(t, sr->u.multipleNonSurDiagnostics->diagRecs[0]);
else
t->error = PHP_YAZ_ERROR_DECODE;
}
@@ -366,6 +367,7 @@
if (sr && sr->which == Z_Records_DBOSD)
{
int j, i;
+ NMEM nmem = odr_extract_mem (t->odr_in);
Z_NamePlusRecordList *p =
sr->u.databaseOrSurDiagnostics;
for (j = 0; j < t->resultSets->recordList->num_records; j++)
@@ -374,20 +376,33 @@
for (i = 0; i<p->num_records; i++)
t->resultSets->recordList->records[i+j] =
p->records[i];
/* transfer our response to search_nmem .. we need it later */
- nmem_transfer (t->resultSets->odr->mem, odr_extract_mem
(t->odr_in));
+ nmem_transfer (t->resultSets->odr->mem, nmem);
+ nmem_destroy (nmem);
+ if (present_phase && p->num_records == 0)
+ {
+ /* present response and we didn't get any records! */
+ t->error = PHP_YAZ_ERROR_DECODE;
+ t->resultSets->recordList = 0;
+ }
}
+ else if (present_phase)
+ {
+ /* present response and we didn't get any records! */
+ t->error = PHP_YAZ_ERROR_DECODE;
+ t->resultSets->recordList = 0;
+ }
}
}
static void search_response (Yaz_Association t, Z_SearchResponse *sr)
{
t->resultSets->resultCount = *sr->resultCount;
- handle_records (t, sr->records);
+ handle_records (t, sr->records, 0);
}
static void present_response (Yaz_Association t, Z_PresentResponse *pr)
{
- handle_records (t, pr->records);
+ handle_records (t, pr->records, 1);
}
static void handle_apdu (Yaz_Association t, Z_APDU *apdu)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]