diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
commit | a175314c3e5827eb193872241446f2f8f5c9d33c (patch) | |
tree | cd3d60ca99ae00829c52a6ca79150a5b6e62528b /storage/mroonga/vendor/groonga/bindings/php | |
parent | Initial commit. (diff) | |
download | mariadb-10.5-upstream.tar.xz mariadb-10.5-upstream.zip |
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'storage/mroonga/vendor/groonga/bindings/php')
6 files changed, 559 insertions, 0 deletions
diff --git a/storage/mroonga/vendor/groonga/bindings/php/config.m4 b/storage/mroonga/vendor/groonga/bindings/php/config.m4 new file mode 100644 index 00000000..c656c9d4 --- /dev/null +++ b/storage/mroonga/vendor/groonga/bindings/php/config.m4 @@ -0,0 +1,66 @@ + +PHP_ARG_WITH(groonga, whether groonga is available,[ --with-groonga[=DIR] With groonga support]) + + +if test "$PHP_GROONGA" != "no"; then + + + if test -r "$PHP_GROONGA/include/groonga.h"; then + PHP_GROONGA_DIR="$PHP_GROONGA" + PHP_ADD_INCLUDE($PHP_GROONGA_DIR/include) + elif test -r "$PHP_GROONGA/include/groonga/groonga.h"; then + PHP_GROONGA_DIR="$PHP_GROONGA" + PHP_ADD_INCLUDE($PHP_GROONGA_DIR/include/groonga) + else + AC_MSG_CHECKING(for groonga in default path) + for i in /usr /usr/local; do + if test -r "$i/include/groonga/groonga.h"; then + PHP_GROONGA_DIR=$i + AC_MSG_RESULT(found in $i) + break + fi + done + if test "x" = "x$PHP_GROONGA_DIR"; then + AC_MSG_ERROR(not found) + fi + PHP_ADD_INCLUDE($PHP_GROONGA_DIR/include) + fi + + export OLD_CPPFLAGS="$CPPFLAGS" + export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_GROONGA" + AC_CHECK_HEADER([groonga.h], [], AC_MSG_ERROR('groonga.h' header not found)) + PHP_SUBST(GROONGA_SHARED_LIBADD) + + + PHP_CHECK_LIBRARY(groonga, grn_init, + [ + PHP_ADD_LIBRARY_WITH_PATH(groonga, $PHP_GROONGA_DIR/lib, GROONGA_SHARED_LIBADD) + ],[ + AC_MSG_ERROR([wrong groonga lib version or lib not found]) + ],[ + -L$PHP_GROONGA_DIR/lib + ]) + export CPPFLAGS="$OLD_CPPFLAGS" + + export OLD_CPPFLAGS="$CPPFLAGS" + export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_GROONGA" + + AC_MSG_CHECKING(PHP version) + AC_TRY_COMPILE([#include <php_version.h>], [ +#if PHP_VERSION_ID < 40000 +#error this extension requires at least PHP version 4.0.0 +#endif +], +[AC_MSG_RESULT(ok)], +[AC_MSG_ERROR([need at least PHP 4.0.0])]) + + export CPPFLAGS="$OLD_CPPFLAGS" + + + PHP_SUBST(GROONGA_SHARED_LIBADD) + AC_DEFINE(HAVE_GROONGA, 1, [ ]) + + PHP_NEW_EXTENSION(groonga, groonga.c , $ext_shared) + +fi + diff --git a/storage/mroonga/vendor/groonga/bindings/php/config.w32 b/storage/mroonga/vendor/groonga/bindings/php/config.w32 new file mode 100644 index 00000000..d0fab53b --- /dev/null +++ b/storage/mroonga/vendor/groonga/bindings/php/config.w32 @@ -0,0 +1,6 @@ +ARG_WITH('groonga', 'Groonga', 'no'); + +if (PHP_GROONGA == "yes") { + EXTENSION("groonga", "groonga.c"); + AC_DEFINE("HAVE_GROONGA", 1, "groonga support"); +} diff --git a/storage/mroonga/vendor/groonga/bindings/php/groonga.c b/storage/mroonga/vendor/groonga/bindings/php/groonga.c new file mode 100644 index 00000000..a04bb9cd --- /dev/null +++ b/storage/mroonga/vendor/groonga/bindings/php/groonga.c @@ -0,0 +1,221 @@ + +#include "php_groonga.h" + +#if HAVE_GROONGA + +int le_grn_ctx; +void grn_ctx_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) +{ + grn_ctx *ctx = (grn_ctx *)(rsrc->ptr); + grn_ctx_close(ctx); +} + +zend_function_entry groonga_functions[] = { + PHP_FE(grn_ctx_init , grn_ctx_init_arg_info) + PHP_FE(grn_ctx_close , grn_ctx_close_arg_info) + PHP_FE(grn_ctx_connect , grn_ctx_connect_arg_info) + PHP_FE(grn_ctx_send , grn_ctx_send_arg_info) + PHP_FE(grn_ctx_recv , grn_ctx_recv_arg_info) + { NULL, NULL, NULL } +}; + + +zend_module_entry groonga_module_entry = { + STANDARD_MODULE_HEADER, + "groonga", + groonga_functions, + PHP_MINIT(groonga), + PHP_MSHUTDOWN(groonga), + PHP_RINIT(groonga), + PHP_RSHUTDOWN(groonga), + PHP_MINFO(groonga), + "0.1", + STANDARD_MODULE_PROPERTIES +}; + +#ifdef COMPILE_DL_GROONGA +ZEND_GET_MODULE(groonga) +#endif + + +PHP_MINIT_FUNCTION(groonga) +{ + REGISTER_LONG_CONSTANT("GRN_CTX_USE_QL", GRN_CTX_USE_QL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_CTX_BATCH_MODE", GRN_CTX_BATCH_MODE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_ENC_DEFAULT", GRN_ENC_DEFAULT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_ENC_NONE", GRN_ENC_NONE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_ENC_EUC_JP", GRN_ENC_EUC_JP, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_ENC_UTF8", GRN_ENC_UTF8, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_ENC_SJIS", GRN_ENC_SJIS, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_ENC_LATIN1", GRN_ENC_LATIN1, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_ENC_KOI8R", GRN_ENC_KOI8R, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_CTX_MORE", GRN_CTX_MORE, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_CTX_TAIL", GRN_CTX_TAIL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_CTX_HEAD", GRN_CTX_HEAD, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_CTX_QUIET", GRN_CTX_QUIET, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_CTX_QUIT", GRN_CTX_QUIT, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("GRN_CTX_FIN", GRN_CTX_FIN, CONST_PERSISTENT | CONST_CS); + le_grn_ctx = zend_register_list_destructors_ex( + grn_ctx_dtor, NULL, "grn_ctx", module_number); + + grn_init(); + + return SUCCESS; +} + + +PHP_MSHUTDOWN_FUNCTION(groonga) +{ + grn_fin(); + return SUCCESS; +} + + +PHP_RINIT_FUNCTION(groonga) +{ + return SUCCESS; +} + + +PHP_RSHUTDOWN_FUNCTION(groonga) +{ + return SUCCESS; +} + + +PHP_MINFO_FUNCTION(groonga) +{ + php_info_print_box_start(0); + php_printf("<p>Groonga</p>\n"); + php_printf("<p>Version 0.2 (ctx)</p>\n"); + php_printf("<p><b>Authors:</b></p>\n"); + php_printf("<p>yu <yu@irx.jp> (lead)</p>\n"); + php_info_print_box_end(); +} + + +PHP_FUNCTION(grn_ctx_init) +{ + grn_ctx *ctx = (grn_ctx *) malloc(sizeof(grn_ctx)); + long res_id = -1; + long flags = 0; + grn_rc rc; + + if (ctx == NULL) { + RETURN_FALSE; // unable to allocate memory for ctx + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) { + return; + } + + if ((rc = grn_ctx_init(ctx, flags)) != GRN_SUCCESS) { + RETURN_FALSE; + } + + res_id = ZEND_REGISTER_RESOURCE(return_value, ctx, le_grn_ctx); + RETURN_RESOURCE(res_id); +} + + +PHP_FUNCTION(grn_ctx_close) +{ + zval *res = NULL; + int res_id = -1; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) { + return; + } + + zend_list_delete(Z_LVAL_P(res)); // call grn_ctx_dtor + RETURN_TRUE; +} + + +PHP_FUNCTION(grn_ctx_connect) +{ + zval *res = NULL; + int res_id = -1; + + grn_rc rc; + grn_ctx *ctx; + char *host = "localhost"; + int host_len = 0; + long port = 10041; + long flags = 0; + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ll", &res, &host, &host_len, &port, &flags) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE(ctx, grn_ctx *, &res, res_id, "grn_ctx", le_grn_ctx); + + if ((rc = grn_ctx_connect(ctx, host, port, flags)) != GRN_SUCCESS) { + RETURN_FALSE; + } + + RETURN_TRUE; +} + + +PHP_FUNCTION(grn_ctx_send) +{ + zval *res = NULL; + int res_id = -1; + + grn_ctx *ctx; + char *query = NULL; + unsigned int query_len, qid; + long flags = 0; + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &res, &query, &query_len, &flags) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE(ctx, grn_ctx *, &res, res_id, "grn_ctx", le_grn_ctx); + qid = grn_ctx_send(ctx, query, query_len, flags); + if (ctx->rc != GRN_SUCCESS) { + RETURN_FALSE; + } + + RETURN_LONG(qid) + +} + + +PHP_FUNCTION(grn_ctx_recv) +{ + zval *res,*ret = NULL; + int res_id = -1; + grn_ctx *ctx; + + char *str; + int flags; + unsigned int str_len, qid; + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE(ctx, grn_ctx *, &res, res_id, "grn_ctx", le_grn_ctx); + + qid = grn_ctx_recv(ctx, &str, &str_len, &flags); + + if (ctx->rc != GRN_SUCCESS) { + RETURN_FALSE; + } + + MAKE_STD_ZVAL(ret); + array_init(ret); + array_init(return_value); + + add_next_index_long(ret, flags); + add_next_index_stringl(ret, str, str_len, 1); + + add_index_zval(return_value, qid, ret); +} + +#endif /* HAVE_GROONGA */ diff --git a/storage/mroonga/vendor/groonga/bindings/php/groonga.dsp b/storage/mroonga/vendor/groonga/bindings/php/groonga.dsp new file mode 100644 index 00000000..dd7c91ce --- /dev/null +++ b/storage/mroonga/vendor/groonga/bindings/php/groonga.dsp @@ -0,0 +1,112 @@ +# Microsoft Developer Studio Project File - Name="groonga" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=groonga - Win32 Debug_TS +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "groonga.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "groonga.mak" CFG="groonga - Win32 Debug_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "groonga - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "groonga - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "groonga - Win32 Release_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release_TS" +# PROP BASE Intermediate_Dir "Release_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_TS" +# PROP Intermediate_Dir "Release_TS" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GROONGA_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_GROONGA" /D ZTS=1 /D HAVE_GROONGA=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_groonga.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" + +!ELSEIF "$(CFG)" == "groonga - Win32 Debug_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug_TS" +# PROP BASE Intermediate_Dir "Debug_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_TS" +# PROP Intermediate_Dir "Debug_TS" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GROONGA_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_GROONGA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GROONGA=1 /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_groonga.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" + +!ENDIF + +# Begin Target + +# Name "groonga - Win32 Release_TS" +# Name "groonga - Win32 Debug_TS" + +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" + +# Begin Source File + +SOURCE=./groonga.c +# End Source File + +# End Group + +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" + +# Begin Source File + +SOURCE=.\php_groonga.h +# End Source File +# End Group +# End Target +# End Project diff --git a/storage/mroonga/vendor/groonga/bindings/php/php_groonga.h b/storage/mroonga/vendor/groonga/bindings/php/php_groonga.h new file mode 100644 index 00000000..3af4427f --- /dev/null +++ b/storage/mroonga/vendor/groonga/bindings/php/php_groonga.h @@ -0,0 +1,125 @@ +/* + +----------------------------------------------------------------------+ + | unknown license: | + +----------------------------------------------------------------------+ + | Authors: yu <yu@irx.jp> | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_GROONGA_H +#define PHP_GROONGA_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <php.h> + +#ifdef HAVE_GROONGA + +#include <php_ini.h> +#include <SAPI.h> +#include <ext/standard/info.h> +#include <Zend/zend_extensions.h> +#ifdef __cplusplus +} // extern "C" +#endif +#include <groonga.h> +#ifdef __cplusplus +extern "C" { +#endif + +extern zend_module_entry groonga_module_entry; +#define phpext_groonga_ptr &groonga_module_entry + +#ifdef PHP_WIN32 +#define PHP_GROONGA_API __declspec(dllexport) +#else +#define PHP_GROONGA_API +#endif + +PHP_MINIT_FUNCTION(groonga); +PHP_MSHUTDOWN_FUNCTION(groonga); +PHP_RINIT_FUNCTION(groonga); +PHP_RSHUTDOWN_FUNCTION(groonga); +PHP_MINFO_FUNCTION(groonga); + +#ifdef ZTS +#include "TSRM.h" +#endif + +#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource)) + +#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC) + +#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC) + +#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC) +#define PROP_SET_STRINGL(name, s, l) zend_update_property_stringl(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC) + + +PHP_FUNCTION(grn_ctx_init); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(grn_ctx_init_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, flags) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define grn_ctx_init_arg_info NULL +#endif + +PHP_FUNCTION(grn_ctx_close); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(grn_ctx_close_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, res) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define grn_ctx_close_arg_info NULL +#endif + +PHP_FUNCTION(grn_ctx_connect); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(grn_ctx_connect_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 4) + ZEND_ARG_INFO(0, res) + ZEND_ARG_INFO(0, host) + ZEND_ARG_INFO(0, port) + ZEND_ARG_INFO(0, flags) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define grn_ctx_connect_arg_info NULL +#endif + +PHP_FUNCTION(grn_ctx_send); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(grn_ctx_send_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) + ZEND_ARG_INFO(0, res) + ZEND_ARG_INFO(0, query) + ZEND_ARG_INFO(0, flags) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define grn_ctx_send_arg_info NULL +#endif + +PHP_FUNCTION(grn_ctx_recv); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(grn_ctx_recv_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, res) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define grn_ctx_recv_arg_info NULL +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif /* PHP_HAVE_GROONGA */ + +#endif /* PHP_GROONGA_H */ diff --git a/storage/mroonga/vendor/groonga/bindings/php/tests/001.phpt b/storage/mroonga/vendor/groonga/bindings/php/tests/001.phpt new file mode 100644 index 00000000..d215b3ea --- /dev/null +++ b/storage/mroonga/vendor/groonga/bindings/php/tests/001.phpt @@ -0,0 +1,29 @@ +--TEST-- +groonga connection +--DESCRIPTION-- +required: variables_order includes "E" +--SKIPIF-- +<?php +if (!extension_loaded("groonga")) print "skip"; +if (!getenv('GROONGA_TEST_HOST')) print "skip"; +?> +--FILE-- +<?php +$host = getenv('GROONGA_TEST_HOST'); +$port = getenv('GROONGA_TEST_PORT') ? getenv('GROONGA_TEST_PORT') : 10041; + +$grn = grn_ctx_init(); +grn_ctx_connect($grn, $host, $port) or die("cannot connect groong server ({$host}:{$port})"); +grn_ctx_send($grn, 'table_list'); +var_dump(grn_ctx_recv($grn)); +grn_ctx_close($grn); +--EXPECTF-- +array(1) { + [0]=> + array(2) { + [0]=> + int(0) + [1]=> + string(%d) "%s" + } +} |