[PHP-CVS] cvs: php-src(PHP_4_3) /ext/yaz config.m4
dickmeiss Wed Apr 7 15:37:21 2004 EDT Modified files: (Branch: PHP_4_3) /php-src/ext/yazconfig.m4 Log: Fixed bug #27803 (YAZ lib path) http://cvs.php.net/diff.php/php-src/ext/yaz/config.m4?r1=1.11r2=1.11.2.1ty=u Index: php-src/ext/yaz/config.m4 diff -u php-src/ext/yaz/config.m4:1.11 php-src/ext/yaz/config.m4:1.11.2.1 --- php-src/ext/yaz/config.m4:1.11 Fri Sep 20 11:42:20 2002 +++ php-src/ext/yaz/config.m4 Wed Apr 7 15:37:20 2004 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.11 2002/09/20 15:42:20 sniper Exp $ +dnl $Id: config.m4,v 1.11.2.1 2004/04/07 19:37:20 dickmeiss Exp $ dnl PHP_ARG_WITH(yaz,for YAZ support, @@ -37,6 +37,9 @@ case $c in -L*) dir=`echo $c|cut -c 3-|sed 's%/\.libs%%g'` +if test $dir != /usr/lib; then + PHP_ADD_LIBPATH($dir,YAZ_SHARED_LIBADD) + fi ;; -lyaz*) ;; @@ -45,9 +48,6 @@ ;; esac done -if test -n $dir; then - PHP_ADD_LIBPATH($dir,YAZ_SHARED_LIBADD) -fi PHP_ADD_LIBRARY_DEFER(yaz,1,YAZ_SHARED_LIBADD) PHP_EVAL_INCLINE($YAZINC) PHP_SUBST(YAZ_SHARED_LIBADD) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/yaz php_yaz.c
dickmeiss Tue Apr 6 13:40:03 2004 EDT Modified files: /php-src/ext/yazphp_yaz.c Log: Allow character set conversion for yaz_record's array method, e.g. yaz_record($id,$pos,array;charset=marc8,iso-8859-1) http://cvs.php.net/diff.php/php-src/ext/yaz/php_yaz.c?r1=1.85r2=1.86ty=u Index: php-src/ext/yaz/php_yaz.c diff -u php-src/ext/yaz/php_yaz.c:1.85 php-src/ext/yaz/php_yaz.c:1.86 --- php-src/ext/yaz/php_yaz.c:1.85 Mon Mar 15 05:01:09 2004 +++ php-src/ext/yaz/php_yaz.c Tue Apr 6 13:40:03 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.85 2004/03/15 10:01:09 dickmeiss Exp $ */ +/* $Id: php_yaz.c,v 1.86 2004/04/06 17:40:03 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -898,6 +898,74 @@ } } +static int iconv_grs1(Z_GenericRecord *p, ODR odr, + const char *to, const char *from) +{ + size_t outbuf_size = 10; + char *outbuf = (char*) odr_malloc(odr, outbuf_size); + + Z_GenericRecord *grs[20]; + int eno[20]; + int level = 0; + yaz_iconv_t cd; + if (!to || to[0]==0) + to = UTF-8; + if (!from || !to) + return 0; + cd = yaz_iconv_open(to, from); + if (!cd) + return -1; + + eno[level] = 0; + grs[level] = p; + + while(level = 0) { + Z_TaggedElement *e = 0; + Z_GenericRecord *p = grs[level]; + + if (eno[level] = p-num_elements) { + --level; + if (level = 0) + eno[level]++; + continue; + } + e = grs[level]-elements[eno[level]]; + switch (e-content-which) { + case Z_ElementData_string: + while(1) { + size_t inbytesleft = strlen(e-content-u.string); + const char *inp = e-content-u.string; + size_t outbytesleft = outbuf_size; + char *outp = outbuf; + size_t r = yaz_iconv(cd, (char**) inp, inbytesleft, + outp, outbytesleft); + if (r == (size_t) (-1)) { + int e = yaz_iconv_error(cd); + if (e != YAZ_ICONV_E2BIG || outbuf_size 20) + break; + outbuf_size = outbuf_size * 2 + 30; + outbuf = (char*) odr_malloc(odr, outbuf_size); + } else { + e-content-u.string = odr_malloc(odr, 1+(outp-outbuf)); + memcpy(e-content-u.string, outbuf, outp-outbuf); + e-content-u.string[outp-outbuf] = '\0'; + break; + } + } + break; + case Z_ElementData_subtree: + if (level 20) { + level++; + grs[level] = e-content-u.subtree; + eno[level] = -1; + } + } + eno[level]++; + } + yaz_iconv_close(cd); + return 0; +} + static void retval_array1_grs1(zval *return_value, Z_GenericRecord *p) { Z_GenericRecord *grs[20]; @@ -918,13 +986,10 @@ if (eno[level] = p-num_elements) { --level; - if (level = 0) { + if (level = 0) eno[level]++; - } continue; } - /* eno[level]++; */ - *tag = '\0'; for (i = 0; i = level; i++) { int tag_type = 3; @@ -966,11 +1031,12 @@ add_next_index_long(my_zval, *e-content-u.trueOrFalse); break; case Z_ElementData_subtree: - level++; - grs[level] = e-content-u.subtree; - eno[level] = -1; + if (level 20) { + level++; + grs[level] = e-content-u.subtree; + eno[level] = -1; + } } - zend_hash_next_index_insert(return_value-value.ht, (void *) my_zval, sizeof(zval *), NULL);
[PHP-CVS] cvs: php-src /ext/yaz config.m4 php_yaz.c
dickmeiss Mon Feb 23 05:48:44 2004 EDT Modified files: /php-src/ext/yazconfig.m4 php_yaz.c Log: Use ZOOM_resultset_sort for yaz_sort. Require YAZ 2.0.13 or later. http://cvs.php.net/diff.php/php-src/ext/yaz/config.m4?r1=1.15r2=1.16ty=u Index: php-src/ext/yaz/config.m4 diff -u php-src/ext/yaz/config.m4:1.15 php-src/ext/yaz/config.m4:1.16 --- php-src/ext/yaz/config.m4:1.15 Mon Jan 26 08:40:49 2004 +++ php-src/ext/yaz/config.m4 Mon Feb 23 05:48:44 2004 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.15 2004/01/26 13:40:49 dickmeiss Exp $ +dnl $Id: config.m4,v 1.16 2004/02/23 10:48:44 dickmeiss Exp $ dnl PHP_ARG_WITH(yaz,for YAZ support, @@ -23,14 +23,14 @@ AC_DEFINE(HAVE_YAZ,1,[Whether you have YAZ]) . $yazconfig -dnl Check version (2.0.6 or greater required) +dnl Check version (2.0.13 or greater required) AC_MSG_CHECKING([for YAZ version]) yaz_version=`echo $YAZVERSION | awk 'BEGIN { FS = .; } { printf %d, ($1 * 1000 + $2) * 1000 + $3;}'` echo $yaz_version -if test $yaz_version -ge 206; then +if test $yaz_version -ge 213; then AC_MSG_RESULT([$YAZVERSION]) else - AC_MSG_ERROR([YAZ version 2.0.6 or later required.]) + AC_MSG_ERROR([YAZ version 2.0.13 or later required.]) fi for c in $YAZLIB; do http://cvs.php.net/diff.php/php-src/ext/yaz/php_yaz.c?r1=1.83r2=1.84ty=u Index: php-src/ext/yaz/php_yaz.c diff -u php-src/ext/yaz/php_yaz.c:1.83 php-src/ext/yaz/php_yaz.c:1.84 --- php-src/ext/yaz/php_yaz.c:1.83 Mon Jan 26 08:40:49 2004 +++ php-src/ext/yaz/php_yaz.c Mon Feb 23 05:48:44 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.83 2004/01/26 13:40:49 dickmeiss Exp $ */ +/* $Id: php_yaz.c,v 1.84 2004/02/23 10:48:44 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -33,9 +33,9 @@ #include yaz/yaz-version.h #ifndef YAZ_VERSIONL -#error YAZ version 2.0.6 or later must be used. -#elif YAZ_VERSIONL 0x020006 -#error YAZ version 2.0.6 or later must be used. +#error YAZ version 2.0.13 or later must be used. +#elif YAZ_VERSIONL 0x02000D +#error YAZ version 2.0.13 or later must be used. #endif #ifdef PHP_WIN32 @@ -1267,6 +1267,9 @@ convert_to_string_ex(pval_criteria); xfree(p-sort_criteria); p-sort_criteria = xstrdup((*pval_criteria)-value.str.val); + if (p-zoom_set) + ZOOM_resultset_sort(p-zoom_set, yaz, + (*pval_criteria)-value.str.val); } release_assoc(p); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/yaz config.m4 php_yaz.c php_yaz.h
dickmeiss Mon Jan 26 08:40:50 2004 EDT Modified files: /php-src/ext/yazconfig.m4 php_yaz.c php_yaz.h Log: New function yaz_es that creates Z39.50 Extended Service Package to facilitate record update, database create, database drop. http://cvs.php.net/diff.php/php-src/ext/yaz/config.m4?r1=1.14r2=1.15ty=u Index: php-src/ext/yaz/config.m4 diff -u php-src/ext/yaz/config.m4:1.14 php-src/ext/yaz/config.m4:1.15 --- php-src/ext/yaz/config.m4:1.14 Fri Feb 28 02:17:46 2003 +++ php-src/ext/yaz/config.m4 Mon Jan 26 08:40:49 2004 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.14 2003/02/28 07:17:46 sniper Exp $ +dnl $Id: config.m4,v 1.15 2004/01/26 13:40:49 dickmeiss Exp $ dnl PHP_ARG_WITH(yaz,for YAZ support, @@ -23,13 +23,14 @@ AC_DEFINE(HAVE_YAZ,1,[Whether you have YAZ]) . $yazconfig -dnl Check version (2.0 or greater required) +dnl Check version (2.0.6 or greater required) AC_MSG_CHECKING([for YAZ version]) yaz_version=`echo $YAZVERSION | awk 'BEGIN { FS = .; } { printf %d, ($1 * 1000 + $2) * 1000 + $3;}'` -if test $yaz_version -ge 200; then +echo $yaz_version +if test $yaz_version -ge 206; then AC_MSG_RESULT([$YAZVERSION]) else - AC_MSG_ERROR([YAZ version 2.0 or later required.]) + AC_MSG_ERROR([YAZ version 2.0.6 or later required.]) fi for c in $YAZLIB; do http://cvs.php.net/diff.php/php-src/ext/yaz/php_yaz.c?r1=1.82r2=1.83ty=u Index: php-src/ext/yaz/php_yaz.c diff -u php-src/ext/yaz/php_yaz.c:1.82 php-src/ext/yaz/php_yaz.c:1.83 --- php-src/ext/yaz/php_yaz.c:1.82 Thu Jan 8 03:17:50 2004 +++ php-src/ext/yaz/php_yaz.c Mon Jan 26 08:40:49 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.82 2004/01/08 08:17:50 andi Exp $ */ +/* $Id: php_yaz.c,v 1.83 2004/01/26 13:40:49 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -33,9 +33,9 @@ #include yaz/yaz-version.h #ifndef YAZ_VERSIONL -#error YAZ version 2.0 or later must be used. -#elif YAZ_VERSIONL 0x02 -#error YAZ version 2.0 or later must be used. +#error YAZ version 2.0.6 or later must be used. +#elif YAZ_VERSIONL 0x020006 +#error YAZ version 2.0.6 or later must be used. #endif #ifdef PHP_WIN32 @@ -111,11 +111,34 @@ static int order_associations; static int le_link; + +#ifdef COMPILE_DL_YAZ +ZEND_GET_MODULE(yaz) +#endif + +#ifdef ZEND_BEGIN_ARG_INFO +ZEND_BEGIN_ARG_INFO(second_argument_force_ref, 0) +ZEND_ARG_PASS_INFO(0) +ZEND_ARG_PASS_INFO(1) +ZEND_END_ARG_INFO(); + +ZEND_BEGIN_ARG_INFO(third_argument_force_ref, 0) +ZEND_ARG_PASS_INFO(0) +ZEND_ARG_PASS_INFO(1) +ZEND_END_ARG_INFO(); +#else +static unsigned char second_argument_force_ref[] = { +2, BYREF_NONE, BYREF_FORCE }; +static unsigned char third_argument_force_ref[] = { +3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; +#endif + + function_entry yaz_functions [] = { PHP_FE(yaz_connect, NULL) PHP_FE(yaz_close, NULL) PHP_FE(yaz_search, NULL) - PHP_FE(yaz_wait, second_arg_force_ref) + PHP_FE(yaz_wait, second_argument_force_ref) PHP_FE(yaz_errno, NULL) PHP_FE(yaz_error, NULL) PHP_FE(yaz_addinfo, NULL) @@ -127,15 +150,16 @@ PHP_FE(yaz_itemorder, NULL) PHP_FE(yaz_es_result, NULL) PHP_FE(yaz_scan, NULL) - PHP_FE(yaz_scan_result, second_arg_force_ref) + PHP_FE(yaz_scan_result, second_argument_force_ref) PHP_FE(yaz_present, NULL) PHP_FE(yaz_ccl_conf, NULL) - PHP_FE(yaz_ccl_parse, third_arg_force_ref) + PHP_FE(yaz_ccl_parse, third_argument_force_ref) PHP_FE(yaz_database, NULL) PHP_FE(yaz_sort, NULL) PHP_FE(yaz_schema, NULL) PHP_FE(yaz_set_option, NULL) PHP_FE(yaz_get_option, NULL) + PHP_FE(yaz_es, NULL) {NULL, NULL, NULL} }; @@ -304,9 +328,10 @@ otherInfo[0] = array_lookup_string(ht, otherInfo0); otherInfo[1] = array_lookup_string(ht, otherInfo1); otherInfo[2] = array_lookup_string(ht, otherInfo2); - } else { + } else if (Z_TYPE_PP(user) == IS_STRING) { convert_to_string_ex(user); - user_str = (*user)-value.str.val; + if (*(*user)-value.str.val) + user_str = (*user)-value.str.val; } } else { WRONG_PARAM_COUNT; @@ -831,8 +856,50 @@ } return r; } +static void retval_array2_grs1(zval *return_value, Z_GenericRecord *p) +{ + int i; + + array_init(return_value); + + for (i = 0; ip-num_elements; i++) + { + zval *zval_element; + zval *zval_sub; + Z_TaggedElement *e = p-elements[i]; + +
[PHP-CVS] cvs: php-src /ext/yaz php_yaz.c php_yaz.h
dickmeiss Fri Oct 24 15:32:08 2003 EDT Modified files: /php-src/ext/yazphp_yaz.c php_yaz.h Log: For YAZ, RSHUTDOWN closes persistent connections that have been idle more than yaz.keepalive seconds. Default value for config yaz.keepalive is 120 seconds. The shutdown prevents many sockets in CLOSE_WAIT state. Index: php-src/ext/yaz/php_yaz.c diff -u php-src/ext/yaz/php_yaz.c:1.80 php-src/ext/yaz/php_yaz.c:1.81 --- php-src/ext/yaz/php_yaz.c:1.80 Sun Aug 31 08:41:53 2003 +++ php-src/ext/yaz/php_yaz.c Fri Oct 24 15:32:06 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.80 2003/08/31 12:41:53 zeev Exp $ */ +/* $Id: php_yaz.c,v 1.81 2003/10/24 19:32:06 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -48,7 +48,7 @@ #include yaz/yaz-ccl.h #include yaz/zoom.h -#define MAX_ASSOC 100 +#define MAX_ASSOC 200 typedef struct Yaz_AssociationInfo *Yaz_Association; @@ -63,6 +63,7 @@ int in_use; int order; int zval_resource; + long time_stamp; }; static Yaz_Association yaz_association_mk() @@ -81,6 +82,7 @@ p-persistent = 0; p-ccl_parser = ccl_parser_create(); p-ccl_parser-bibset = 0; + p-time_stamp = 0; return p; } @@ -374,7 +376,7 @@ as-in_use = 1; as-persistent = persistent; as-order = YAZSG(assoc_seq); - + as-time_stamp = time(0); #ifdef ZTS tsrm_mutex_unlock (yaz_mutex); #endif @@ -1484,6 +1486,11 @@ #else STD_PHP_INI_ENTRY(yaz.max_links, 100, PHP_INI_ALL, OnUpdateInt, max_links, zend_yaz_globals, yaz_globals) #endif +#if PHP_MAJOR_VERSION = 5 + STD_PHP_INI_ENTRY(yaz.keepalive, 120, PHP_INI_ALL, OnUpdateLong, keepalive, zend_yaz_globals, yaz_globals) +#else + STD_PHP_INI_ENTRY(yaz.keepalive, 120, PHP_INI_ALL, OnUpdateInt, keepalive, zend_yaz_globals, yaz_globals) +#endif STD_PHP_INI_ENTRY(yaz.log_file, NULL, PHP_INI_ALL, OnUpdateString, log_file, zend_yaz_globals, yaz_globals) PHP_INI_END() /* }}} */ @@ -1566,6 +1573,31 @@ PHP_RSHUTDOWN_FUNCTION(yaz) { + long now = time(0); + int i; + + yaz_log(LOG_LOG, rshutdown keepalive=%ld, YAZSG(keepalive)); +#ifdef ZTS + tsrm_mutex_lock(yaz_mutex); +#endif + for (i = 0; i YAZSG(max_links); i++) { + Yaz_Association *as = shared_associations + i; + if (*as) + { + if (now - (*as)-time_stamp YAZSG(keepalive)) + { + const char *host = option_get(*as, host); + if (host) + yaz_log(LOG_LOG, shutdown of %s, host); + + yaz_association_destroy(*as); + *as = 0; + } + } + } +#ifdef ZTS + tsrm_mutex_unlock(yaz_mutex); +#endif return SUCCESS; } Index: php-src/ext/yaz/php_yaz.h diff -u php-src/ext/yaz/php_yaz.h:1.18 php-src/ext/yaz/php_yaz.h:1.19 --- php-src/ext/yaz/php_yaz.h:1.18 Tue Jun 10 16:03:40 2003 +++ php-src/ext/yaz/php_yaz.h Fri Oct 24 15:32:06 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.h,v 1.18 2003/06/10 20:03:40 imajes Exp $ */ +/* $Id: php_yaz.h,v 1.19 2003/10/24 19:32:06 dickmeiss Exp $ */ #ifndef PHP_YAZ_H #define PHP_YAZ_H @@ -58,6 +58,7 @@ ZEND_BEGIN_MODULE_GLOBALS(yaz) int assoc_seq; long max_links; + long keepalive; char *log_file; ZEND_END_MODULE_GLOBALS(yaz) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/yaz php_yaz.c
dickmeiss Wed Jul 30 05:53:37 2003 EDT Modified files: /php-src/ext/yazphp_yaz.c Log: Fix yaz_record, type array to return bibliographic record part Index: php-src/ext/yaz/php_yaz.c diff -u php-src/ext/yaz/php_yaz.c:1.77 php-src/ext/yaz/php_yaz.c:1.78 --- php-src/ext/yaz/php_yaz.c:1.77 Sat Jul 19 15:23:33 2003 +++ php-src/ext/yaz/php_yaz.c Wed Jul 30 05:53:37 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.77 2003/07/19 19:23:33 andrey Exp $ */ +/* $Id: php_yaz.c,v 1.78 2003/07/30 09:53:37 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -943,6 +943,8 @@ if (r) { if (!strcmp(type, array)) { Z_External *ext = (Z_External *) ZOOM_record_get(r, ext, 0); + if (ext-which == Z_External_OPAC) + ext = ext-u.opac-bibliographicRecord; if (ext) { oident *ent = oid_getentbyoid(ext-direct_reference); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/yaz php_yaz.c
dickmeiss Fri Jul 4 15:17:08 2003 EDT Modified files: /php-src/ext/yazphp_yaz.c Log: On Windows, handle YAZ versions that don't export yaz_version. Index: php-src/ext/yaz/php_yaz.c diff -u php-src/ext/yaz/php_yaz.c:1.75 php-src/ext/yaz/php_yaz.c:1.76 --- php-src/ext/yaz/php_yaz.c:1.75 Tue Jun 10 16:03:40 2003 +++ php-src/ext/yaz/php_yaz.c Fri Jul 4 15:17:08 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.75 2003/06/10 20:03:40 imajes Exp $ */ +/* $Id: php_yaz.c,v 1.76 2003/07/04 19:17:08 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -1545,7 +1545,19 @@ { char version_str[20]; +#if WIN32 + HINSTANCE h = LoadLibrary(yaz); + unsigned long (__cdecl *p)(char *version_str, char *sys_str) = 0; + strcpy(version_str, unknown); + + if (h (p = (unsigned long(__cdecl*)(char*,char*)) + GetProcAddress(h, yaz_version))) + p(version_str, 0); + if (h) + FreeLibrary(h); +#else yaz_version(version_str, 0); +#endif php_info_print_table_start(); php_info_print_table_row(2, YAZ Support, enabled); php_info_print_table_row(2, YAZ Version, version_str); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) / NEWS /ext/yaz php_yaz.c
dickmeiss Fri May 30 05:45:57 2003 EDT Modified files: (Branch: PHP_4_3) /php4 NEWS /php4/ext/yaz php_yaz.c Log: Prevent yaz from logging unless yaz.log_file is set Index: php4/NEWS diff -u php4/NEWS:1.1247.2.218 php4/NEWS:1.1247.2.219 --- php4/NEWS:1.1247.2.218 Thu May 29 11:42:45 2003 +++ php4/NEWS Fri May 30 05:45:57 2003 @@ -1,6 +1,7 @@ PHP 4 NEWS ||| ?? Jul 2003, Version 4.3.3 +- Prevent yaz from logging unless yaz.log_file is set (Adam Dickmeiss) - Added long options into CLI CGI (e.g. --version). (Marcus) - Added new command line parameters -B, -F, -R and -E which allow to process stdin line by line (See 'php -h' or 'man php' for more). (Marcus) Index: php4/ext/yaz/php_yaz.c diff -u php4/ext/yaz/php_yaz.c:1.57.2.4 php4/ext/yaz/php_yaz.c:1.57.2.5 --- php4/ext/yaz/php_yaz.c:1.57.2.4 Tue May 27 05:50:45 2003 +++ php4/ext/yaz/php_yaz.c Fri May 30 05:45:57 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.57.2.4 2003/05/27 09:50:45 dickmeiss Exp $ */ +/* $Id: php_yaz.c,v 1.57.2.5 2003/05/30 09:45:57 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -1473,6 +1473,7 @@ PHP_MINIT_FUNCTION(yaz) { int i; + const char *fname; nmem_init(); #ifdef ZTS yaz_mutex = tsrm_mutex_alloc(); @@ -1481,9 +1482,10 @@ REGISTER_INI_ENTRIES(); - if (YAZSG(log_file)) + fname = YAZSG(log_file); + if (fname *fname) { - yaz_log_init_file(YAZSG(log_file)); + yaz_log_init_file(fname); yaz_log_init_level(LOG_ALL); } else -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/yaz php_yaz.c
dickmeiss Fri May 30 05:48:49 2003 EDT Modified files: /php4/ext/yaz php_yaz.c Log: Prevent yaz from logging unless yaz.log_file is set Index: php4/ext/yaz/php_yaz.c diff -u php4/ext/yaz/php_yaz.c:1.73 php4/ext/yaz/php_yaz.c:1.74 --- php4/ext/yaz/php_yaz.c:1.73 Tue May 27 05:47:26 2003 +++ php4/ext/yaz/php_yaz.c Fri May 30 05:48:49 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.73 2003/05/27 09:47:26 dickmeiss Exp $ */ +/* $Id: php_yaz.c,v 1.74 2003/05/30 09:48:49 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -1492,6 +1492,7 @@ PHP_MINIT_FUNCTION(yaz) { int i; + const char *fname; nmem_init(); #ifdef ZTS yaz_mutex = tsrm_mutex_alloc(); @@ -1501,12 +1502,14 @@ REGISTER_INI_ENTRIES(); - if (YAZSG(log_file)) { + fname = YAZSG(log_file); + if (fname *fname) + { + yaz_log_init_file(fname); yaz_log_init_level(LOG_ALL); - yaz_log_init_file(YAZSG(log_file)); - } else { - yaz_log_init_level(0); } + else + yaz_log_init_level(0); le_link = zend_register_list_destructors_ex (yaz_close_link, 0, YAZ link, module_number); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/yaz php_yaz.c
dickmeiss Tue Feb 25 03:31:53 2003 EDT Modified files: /php4/ext/yaz php_yaz.c Log: yaz_search supports query type cql Index: php4/ext/yaz/php_yaz.c diff -u php4/ext/yaz/php_yaz.c:1.62 php4/ext/yaz/php_yaz.c:1.63 --- php4/ext/yaz/php_yaz.c:1.62 Sat Jan 18 14:53:33 2003 +++ php4/ext/yaz/php_yaz.c Tue Feb 25 03:31:52 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.62 2003/01/18 19:53:33 iliaa Exp $ */ +/* $Id: php_yaz.c,v 1.63 2003/02/25 08:31:52 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -454,6 +454,18 @@ { ZOOM_query q = ZOOM_query_create (); ZOOM_query_prefix (q, query_str); + if (p-sort_criteria) + ZOOM_query_sortby (q, p-sort_criteria); +xfree (p-sort_criteria); +p-sort_criteria = 0; + p-zoom_set = ZOOM_connection_search (p-zoom_conn, q); + ZOOM_query_destroy (q); + RETVAL_TRUE; + } + if (!strcmp (type_str, cql)) + { + ZOOM_query q = ZOOM_query_create (); + ZOOM_query_cql (q, query_str); if (p-sort_criteria) ZOOM_query_sortby (q, p-sort_criteria); xfree (p-sort_criteria); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/yaz php_yaz.c
dickmeiss Tue Feb 25 03:34:33 2003 EDT Modified files: /php4/ext/yaz php_yaz.c Log: Tabify Index: php4/ext/yaz/php_yaz.c diff -u php4/ext/yaz/php_yaz.c:1.63 php4/ext/yaz/php_yaz.c:1.64 --- php4/ext/yaz/php_yaz.c:1.63 Tue Feb 25 03:31:52 2003 +++ php4/ext/yaz/php_yaz.c Tue Feb 25 03:34:32 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.63 2003/02/25 08:31:52 dickmeiss Exp $ */ +/* $Id: php_yaz.c,v 1.64 2003/02/25 08:34:32 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -73,7 +73,7 @@ p-zoom_conn = ZOOM_connection_create (0); p-zoom_set = 0; p-zoom_scan = 0; -p-zoom_package = 0; + p-zoom_package = 0; ZOOM_connection_option_set(p-zoom_conn, implementationName, PHP); ZOOM_connection_option_set(p-zoom_conn, async, 1); p-sort_criteria = 0; @@ -91,7 +91,7 @@ return ; ZOOM_resultset_destroy (p-zoom_set); ZOOM_scanset_destroy (p-zoom_scan); -ZOOM_package_destroy (p-zoom_package); + ZOOM_package_destroy (p-zoom_package); ZOOM_connection_destroy (p-zoom_conn); xfree (p-sort_criteria); ccl_qual_rm(p-ccl_parser-bibset); @@ -143,7 +143,7 @@ }; static void get_assoc (INTERNAL_FUNCTION_PARAMETERS, pval **id, - Yaz_Association *assocp) + Yaz_Association *assocp) { Yaz_Association *as = 0; @@ -274,14 +274,14 @@ const char *user_str = 0, *group_str = 0, *pass_str = 0; const char *cookie_str = 0, *proxy_str = 0; const char *charset_str = 0; -const char *client_IP = 0; -const char *otherInfo[3]; + const char *client_IP = 0; + const char *otherInfo[3]; int persistent = 1; int piggyback = 1; pval **zurl, **user = 0; Yaz_Association as; -otherInfo[0] = otherInfo[1] = otherInfo[2] = 0; + otherInfo[0] = otherInfo[1] = otherInfo[2] = 0; if (ZEND_NUM_ARGS() == 1) { if (zend_get_parameters_ex (1, zurl) == FAILURE) @@ -309,9 +309,9 @@ piggyback_val = array_lookup_bool(ht, piggyback); if (piggyback_val) piggyback = *piggyback_val; -otherInfo[0] = array_lookup_string(ht, otherInfo0); -otherInfo[1] = array_lookup_string(ht, otherInfo1); -otherInfo[2] = array_lookup_string(ht, otherInfo2); + otherInfo[0] = array_lookup_string(ht, otherInfo0); + otherInfo[1] = array_lookup_string(ht, otherInfo1); + otherInfo[2] = array_lookup_string(ht, otherInfo2); } else { @@ -377,19 +377,19 @@ } shared_associations[i] = as = yaz_association_mk (); -option_set (as, proxy, proxy_str); + option_set (as, proxy, proxy_str); option_set (as, user, user_str); option_set (as, group, group_str); option_set (as, pass, pass_str); option_set (as, cookie, cookie_str); -option_set (as, charset, charset_str); + option_set (as, charset, charset_str); } -option_set (as, otherInfo0, otherInfo[0]); -option_set (as, otherInfo1, otherInfo[1]); -option_set (as, otherInfo2, otherInfo[2]); -option_set (as, clientIP, client_IP); -option_set (as, piggyback, piggyback ? 1 : 0); -ZOOM_connection_connect (as-zoom_conn, zurl_str, 0); + option_set (as, otherInfo0, otherInfo[0]); + option_set (as, otherInfo1, otherInfo[1]); + option_set (as, otherInfo2, otherInfo[2]); + option_set (as, clientIP, client_IP); + option_set (as, piggyback, piggyback ? 1 : 0); + ZOOM_connection_connect (as-zoom_conn, zurl_str, 0); as-in_use = 1; as-persistent = persistent; as-order = YAZSG(assoc_seq); @@ -456,8 +456,8 @@ ZOOM_query_prefix (q, query_str); if (p-sort_criteria) ZOOM_query_sortby (q, p-sort_criteria); -xfree (p-sort_criteria); -p-sort_criteria = 0; + xfree (p-sort_criteria); + p-sort_criteria = 0; p-zoom_set = ZOOM_connection_search (p-zoom_conn, q); ZOOM_query_destroy (q); RETVAL_TRUE; @@ -468,8 +468,8 @@ ZOOM_query_cql (q, query_str); if (p-sort_criteria) ZOOM_query_sortby (q, p-sort_criteria); -xfree (p-sort_criteria); -p-sort_criteria = 0; + xfree (p-sort_criteria); + p-sort_criteria = 0; p-zoom_set = ZOOM_connection_search (p-zoom_conn, q); ZOOM_query_destroy (q);
[PHP-CVS] cvs: php4 /ext/yaz php_yaz.c php_yaz.h
dickmeiss Wed Jan 15 03:00:45 2003 EDT Modified files: /php4/ext/yaz php_yaz.c php_yaz.h Log: Fix functions comments (connection resource rather than connection id). New functions yaz_set_option and yaz_get_option. Cleanup in yaz_connect. Index: php4/ext/yaz/php_yaz.c diff -u php4/ext/yaz/php_yaz.c:1.60 php4/ext/yaz/php_yaz.c:1.61 --- php4/ext/yaz/php_yaz.c:1.60 Tue Dec 31 11:08:10 2002 +++ php4/ext/yaz/php_yaz.c Wed Jan 15 03:00:41 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_yaz.c,v 1.60 2002/12/31 16:08:10 sebastian Exp $ */ +/* $Id: php_yaz.c,v 1.61 2003/01/15 08:00:41 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -59,7 +59,7 @@ ZOOM_connection zoom_conn; ZOOM_resultset zoom_set; ZOOM_scanset zoom_scan; -ZOOM_package zoom_package; + ZOOM_package zoom_package; char *sort_criteria; int persistent; int in_use; @@ -137,6 +137,8 @@ PHP_FE(yaz_database, NULL) PHP_FE(yaz_sort, NULL) PHP_FE(yaz_schema, NULL) + PHP_FE(yaz_set_option, NULL) + PHP_FE(yaz_get_option, NULL) {NULL, NULL, NULL} }; @@ -262,7 +264,7 @@ return strcmp(s1, s2); } -/* {{{ proto int yaz_connect(string zurl [ array options]) +/* {{{ proto int yaz_connect(string zurl [, array options]) Create target with given zurl. Returns positive id if successful. */ PHP_FUNCTION(yaz_connect) { @@ -343,15 +345,7 @@ !strcmp_null(option_get(as, pass), pass_str) !strcmp_null(option_get(as, cookie), cookie_str) !strcmp_null(option_get(as, charset), charset_str)) - { -option_set (as, clientIP, client_IP); -option_set (as, otherInfo0, otherInfo[0]); -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); break; - } } if (i == YAZSG(max_links)) { @@ -383,21 +377,19 @@ } shared_associations[i] = as = yaz_association_mk (); +option_set (as, proxy, proxy_str); option_set (as, user, user_str); option_set (as, group, group_str); option_set (as, pass, pass_str); option_set (as, cookie, cookie_str); -option_set (as, clientIP, client_IP); - -option_set (as, otherInfo0, otherInfo[0]); -option_set (as, otherInfo1, otherInfo[1]); -option_set (as, otherInfo2, otherInfo[2]); -option_set (as, proxy, proxy_str); -option_set (as, piggyback, piggyback ? 1 : 0); option_set (as, charset, charset_str); - - ZOOM_connection_connect (as-zoom_conn, zurl_str, 0); } +option_set (as, otherInfo0, otherInfo[0]); +option_set (as, otherInfo1, otherInfo[1]); +option_set (as, otherInfo2, otherInfo[2]); +option_set (as, clientIP, client_IP); +option_set (as, piggyback, piggyback ? 1 : 0); +ZOOM_connection_connect (as-zoom_conn, zurl_str, 0); as-in_use = 1; as-persistent = persistent; as-order = YAZSG(assoc_seq); @@ -409,7 +401,7 @@ } /* }}} */ -/* {{{ proto int yaz_close(int id) +/* {{{ proto int yaz_close(resource id) Destory and close target */ PHP_FUNCTION(yaz_close) { @@ -428,7 +420,7 @@ } /* }}} */ -/* {{{ proto int yaz_search(int id, string type, string query) +/* {{{ proto int yaz_search(resource id, string type, string query) Specify query of type for search - returns true if successful */ PHP_FUNCTION(yaz_search) { @@ -464,6 +456,8 @@ ZOOM_query_prefix (q, query_str); if (p-sort_criteria) ZOOM_query_sortby (q, p-sort_criteria); +xfree (p-sort_criteria); +p-sort_criteria = 0; p-zoom_set = ZOOM_connection_search (p-zoom_conn, q); ZOOM_query_destroy (q); RETVAL_TRUE; @@ -476,7 +470,7 @@ } /* }}} */ -/* {{{ proto int yaz_present(int id) +/* {{{ proto int yaz_present(resource id) Retrieve records */ PHP_FUNCTION(yaz_present) { @@ -557,7 +551,7 @@ } /* }}} */ -/* {{{ proto int yaz_errno(int id) +/* {{{ proto int yaz_errno(resource id) Return last error number (0 for bib-1 diagnostic, 0 for other error, 0 for no error */ PHP_FUNCTION(yaz_errno) { @@ -577,7 +571,7 @@ } /* }}} */ -/* {{{ proto string yaz_error(int id) +/* {{{ proto string yaz_error(resource id) Return last error message */ PHP_FUNCTION(yaz_error) { @@ -603,7 +597,7 @@ } /* }}} */ -/* {{{ proto string yaz_addinfo(int id) +/* {{{ proto string yaz_addinfo(resource id) Return additional info for last
[PHP-CVS] cvs: php4 /ext/yaz config.m4
dickmeiss Wed Jan 15 02:57:51 2003 EDT Modified files: /php4/ext/yaz config.m4 Log: Fix lib config for the case where YAZ depends on multiple libraries Index: php4/ext/yaz/config.m4 diff -u php4/ext/yaz/config.m4:1.11 php4/ext/yaz/config.m4:1.12 --- php4/ext/yaz/config.m4:1.11 Fri Sep 20 11:42:20 2002 +++ php4/ext/yaz/config.m4 Wed Jan 15 02:57:51 2003 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.11 2002/09/20 15:42:20 sniper Exp $ +dnl $Id: config.m4,v 1.12 2003/01/15 07:57:51 dickmeiss Exp $ dnl PHP_ARG_WITH(yaz,for YAZ support, @@ -32,25 +32,19 @@ AC_MSG_ERROR([YAZ version 1.9 or later required.]) fi -dir= for c in $YAZLIB; do case $c in -L*) dir=`echo $c|cut -c 3-|sed 's%/\.libs%%g'` + PHP_ADD_LIBPATH($dir,YAZ_SHARED_LIBADD) ;; - -lyaz*) -;; - *) - PHP_EVAL_LIBLINE($c, YAZ_SHARED_LIBADD) + -l*) + lib=`echo $c|cut -c 3-` +PHP_ADD_LIBRARY($lib,YAZ_SHARED_LIBADD) ;; esac done -if test -n $dir; then - PHP_ADD_LIBPATH($dir,YAZ_SHARED_LIBADD) -fi -PHP_ADD_LIBRARY_DEFER(yaz,1,YAZ_SHARED_LIBADD) PHP_EVAL_INCLINE($YAZINC) -PHP_SUBST(YAZ_SHARED_LIBADD) PHP_NEW_EXTENSION(yaz, php_yaz.c, $ext_shared) else AC_MSG_ERROR([YAZ not found (missing $yazconfig)]) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/yaz php_yaz.c
dickmeiss Tue Nov 5 04:19:24 2002 EDT Modified files: /php4/ext/yaz php_yaz.c Log: Fix handling of zero-length records Index: php4/ext/yaz/php_yaz.c diff -u php4/ext/yaz/php_yaz.c:1.55 php4/ext/yaz/php_yaz.c:1.56 --- php4/ext/yaz/php_yaz.c:1.55 Mon Oct 28 05:56:23 2002 +++ php4/ext/yaz/php_yaz.c Tue Nov 5 04:19:23 2002 -16,7 +16,7 +--+ */ -/* $Id: php_yaz.c,v 1.55 2002/10/28 10:56:23 dickmeiss Exp $ */ +/* $Id: php_yaz.c,v 1.56 2002/11/05 09:19:23 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h -973,17 +973,9 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-value.str.len = (rlen 0) ? rlen : 0; +return_value-value.str.val = +estrndup(info, return_value-value.str.len); return_value-type = IS_STRING; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/yaz php_yaz.c
dickmeiss Mon Oct 28 05:56:23 2002 EDT Modified files: /php4/ext/yaz php_yaz.c Log: Raw records for yaz_record Index: php4/ext/yaz/php_yaz.c diff -u php4/ext/yaz/php_yaz.c:1.54 php4/ext/yaz/php_yaz.c:1.55 --- php4/ext/yaz/php_yaz.c:1.54 Thu Sep 19 08:20:06 2002 +++ php4/ext/yaz/php_yaz.c Mon Oct 28 05:56:23 2002 -16,7 +16,7 +--+ */ -/* $Id: php_yaz.c,v 1.54 2002/09/19 12:20:06 dickmeiss Exp $ */ +/* $Id: php_yaz.c,v 1.55 2002/10/28 10:56:23 dickmeiss Exp $ */ #ifdef HAVE_CONFIG_H #include config.h -344,7 +344,7 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 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); -979,6 +967,24 retval_grs1 (return_value, rec); 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; } } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php