From: Sergey Kartashoff Date: Mon, 5 Feb 2001 08:42:54 +0000 (+0000) Subject: Fixed mnogosearch protos. Fixed mnogosearch functions return values. X-Git-Tag: php-4.0.5RC1~368 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fad70e0d98e0d34f27d1ba372ebffa8783a119ab;p=php Fixed mnogosearch protos. Fixed mnogosearch functions return values. A bug with capital letters break search has been fixed. @- Fixed mnogosearch protos. Fixed mnogosearch functions return values. @ A bug with capital letters break search has been fixed. (gluke) --- diff --git a/ext/mnogosearch/README b/ext/mnogosearch/README index 5e5b9e871a..3f547838d1 100644 --- a/ext/mnogosearch/README +++ b/ext/mnogosearch/README @@ -12,14 +12,13 @@ library. To do this you should compile php with specefying mysql-dir TODO ---- -1. Implement more UdmSearch functions. +1. Implement more mnoGoSearch functions. -2. Fix config.m4 to detect whether UdmSearch is actually installed. -Currently there is no any checking. ./configure just trust that UdmSearch +2. Fix config.m4 to detect whether mnoGoSearch is actually installed. +Currently there is no any checking. ./configure just trust that mnoGoSearch does exist. -3. Test with more databases. Currently tested with MySQL which is compiled into -PHP4 by default and does not require any additional UdmSearch libraries. - Actually it should work fine with other supported database. +3. Test with more databases. Currently tested with MySQL. +Actually it should work fine with other supported databases. 4. Write PHP interface documentation. diff --git a/ext/mnogosearch/php_mnogo.c b/ext/mnogosearch/php_mnogo.c index d20389cde7..6001a0a535 100644 --- a/ext/mnogosearch/php_mnogo.c +++ b/ext/mnogosearch/php_mnogo.c @@ -174,7 +174,7 @@ DLEXPORT PHP_MINFO_FUNCTION(mnogosearch) } -/* {{{ proto int mnogosearch_alloc_agent(string dbaddr [, string dbmode]) +/* {{{ proto int udm_alloc_agent(string dbaddr [, string dbmode]) Allocate mnoGoSearch session */ DLEXPORT PHP_FUNCTION(udm_alloc_agent) { @@ -233,7 +233,7 @@ DLEXPORT PHP_FUNCTION(udm_alloc_agent) /* }}} */ -/* {{{ proto int udm_set_agent_param(string agent, int var, string val) +/* {{{ proto int udm_set_agent_param(int agent, int var, string val) Set mnoGoSearch agent session parameters */ DLEXPORT PHP_FUNCTION(udm_set_agent_param) { @@ -363,7 +363,7 @@ DLEXPORT PHP_FUNCTION(udm_set_agent_param) /* }}} */ -/* {{{ proto int udm_find(int agent_identifier, string query) +/* {{{ proto int udm_find(int agent, string query) Perform search */ DLEXPORT PHP_FUNCTION(udm_find) { @@ -385,13 +385,17 @@ DLEXPORT PHP_FUNCTION(udm_find) } ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link); convert_to_string_ex(yyquery); - Res=UdmFind(Agent,(*yyquery)->value.str.val); - ZEND_REGISTER_RESOURCE(return_value,Res,le_res); + + if (Res=UdmFind(Agent,UdmTolower((*yyquery)->value.str.val,Agent->charset))) { + ZEND_REGISTER_RESOURCE(return_value,Res,le_res); + } else { + RETURN_FALSE; + } } /* }}} */ -/* {{{ proto int udm_get_res_field(int res_identifier, int row_num, int field_name) +/* {{{ proto int udm_get_res_field(int res, int row, int field) Fetch mnoGoSearch result field */ DLEXPORT PHP_FUNCTION(udm_get_res_field){ pval **yyres, **yyrow_num, **yyfield_name; @@ -440,8 +444,8 @@ DLEXPORT PHP_FUNCTION(udm_get_res_field){ /* }}} */ -/* {{{ proto int udm_get_res_param(int res_identifier, int param_id) - mnoGoSearch result parameters */ +/* {{{ proto int udm_get_res_param(int res, int param) + Get mnoGoSearch result parameters */ DLEXPORT PHP_FUNCTION(udm_get_res_param) { pval ** yyres, ** yyparam; @@ -473,7 +477,7 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param) /* }}} */ -/* {{{ proto int udm_free_res(int res_identifier) +/* {{{ proto int udm_free_res(int res) mnoGoSearch free result */ DLEXPORT PHP_FUNCTION(udm_free_res) { @@ -492,12 +496,13 @@ DLEXPORT PHP_FUNCTION(udm_free_res) } ZEND_FETCH_RESOURCE(Res, UDM_RESULT *, yyres, -1, "mnoGoSearch-Result", le_res); zend_list_delete((*yyres)->value.lval); - + + RETURN_TRUE; } /* }}} */ -/* {{{ proto int udm_errno(int agent_identifier) +/* {{{ proto int udm_errno(int agent) mnoGoSearch error number */ DLEXPORT PHP_FUNCTION(udm_errno) { @@ -520,7 +525,7 @@ DLEXPORT PHP_FUNCTION(udm_errno) /* }}} */ -/* {{{ proto int udm_error(int agent_identifier) +/* {{{ proto string udm_error(int agent) mnoGoSearch error message */ DLEXPORT PHP_FUNCTION(udm_error) { @@ -544,7 +549,7 @@ DLEXPORT PHP_FUNCTION(udm_error) /* }}} */ -/* {{{ proto int udm_free_agent(int agent_identifier) +/* {{{ proto int udm_free_agent(int agent) Free mnoGoSearch session */ DLEXPORT PHP_FUNCTION(udm_free_agent) { @@ -563,6 +568,8 @@ DLEXPORT PHP_FUNCTION(udm_free_agent) } ZEND_FETCH_RESOURCE(Agent, UDM_RESULT *, yyagent, -1, "mnoGoSearch-agent", le_link); zend_list_delete((*yyagent)->value.lval); + + RETURN_TRUE; } /* }}} */ diff --git a/ext/mnogosearch/php_mnogo.h b/ext/mnogosearch/php_mnogo.h index 6def9dce20..897b564169 100644 --- a/ext/mnogosearch/php_mnogo.h +++ b/ext/mnogosearch/php_mnogo.h @@ -3,28 +3,17 @@ /* +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | + | PHP version 4.0 | +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 PHP Development Team (See Credits file) | + | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of one of the following licenses: | - | | - | A) the GNU General Public License as published by the Free Software | - | Foundation; either version 2 of the License, or (at your option) | - | any later version. | - | | - | B) the PHP License as published by the PHP Development Team and | - | included in the distribution in the file: LICENSE | - | | - | This program is distributed in the hope that it will be useful, | - | but WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | - | GNU General Public License for more details. | - | | - | You should have received a copy of both licenses referred to here. | - | If you did not, or have any questions about PHP licensing, please | - | contact core@php.net. | + | This source file is subject to version 2.02 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.php.net/license/2_02.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Initial version by Alex Barkov |