9 changed files with 1639 additions and 0 deletions
-
2ext/dbplus/CREDITS
-
5ext/dbplus/EXPERIMENTAL
-
8ext/dbplus/Makefile.in
-
3ext/dbplus/README
-
47ext/dbplus/config.m4
-
141ext/dbplus/nonimp_dbplus.c
-
1279ext/dbplus/php_dbplus.c
-
131ext/dbplus/php_dbplus.h
-
23ext/dbplus/tests/001.phpt
@ -0,0 +1,2 @@ |
|||
dbplus |
|||
Hartmut Holzgraefe |
|||
@ -0,0 +1,5 @@ |
|||
this extension is experimental, |
|||
its functions may change their names |
|||
or move to extension all together |
|||
so do not rely to much on them |
|||
you have been warned! |
|||
@ -0,0 +1,8 @@ |
|||
# $Id$
|
|||
|
|||
LTLIBRARY_NAME = libdbplus.la |
|||
LTLIBRARY_SOURCES = dbplus.c php_dbplus.c |
|||
LTLIBRARY_SHARED_NAME = dbplus.la |
|||
LTLIBRARY_SHARED_LIBADD = $(DBPLUS_SHARED_LIBADD) |
|||
|
|||
include $(top_srcdir)/build/dynlib.mk |
|||
@ -0,0 +1,3 @@ |
|||
experimental db++ extension |
|||
for more information on db++ see |
|||
http://www.concept-asa.de |
|||
@ -0,0 +1,47 @@ |
|||
dnl $Id$ |
|||
dnl config.m4 for extension dbplus |
|||
|
|||
|
|||
PHP_ARG_WITH(dbplus, for dbplus support, |
|||
[ --with-dbplus Include dbplus support]) |
|||
|
|||
if test "$PHP_DBPLUS" != "no"; then |
|||
# --with-dbplus -> check with-path |
|||
SEARCH_PATH="/usr/dbplus" |
|||
SEARCH_FOR="/include/dbconfig.h" |
|||
if test -r $PHP_DBPLUS/; then # path given as parameter |
|||
DBPLUS_DIR=$PHP_DBPLUS |
|||
else # search default path list |
|||
AC_MSG_CHECKING(for dbplus files in default path) |
|||
for i in $SEARCH_PATH ; do |
|||
if test -r $i/$SEARCH_FOR; then |
|||
DBPLUS_DIR=$i |
|||
AC_MSG_RESULT(found in $i) |
|||
fi |
|||
done |
|||
fi |
|||
|
|||
if test -z "$DBPLUS_DIR"; then |
|||
AC_MSG_RESULT(not found) |
|||
AC_MSG_ERROR(Please reinstall the dbplus distribution) |
|||
fi |
|||
|
|||
# --with-dbplus -> add include path |
|||
AC_ADD_INCLUDE($DBPLUS_DIR/include) |
|||
|
|||
# --with-dbplus -> chech for lib and symbol presence |
|||
LIBNAME=Ddb |
|||
LIBSYMBOL=Db_Init |
|||
old_LIBS=$LIBS |
|||
LIBS="$LIBS -L$DBPLUS_DIR/lib -ldl -lDmacc -lDracc" |
|||
AC_CHECK_LIB($LIBNAME, $LIBSYMBOL, [AC_DEFINE(HAVE_DBPLUSLIB,1,[ ])], |
|||
[AC_MSG_ERROR(wrong dbplus lib version or lib not found)]) |
|||
LIBS=$old_LIBS |
|||
|
|||
PHP_SUBST(DBPLUS_SHARED_LIBADD) |
|||
AC_ADD_LIBRARY_WITH_PATH($LIBNAME, $DBPLUS_DIR/lib, DBPLUS_SHARED_LIBADD) |
|||
AC_ADD_LIBRARY_WITH_PATH(Dmacc, $DBPLUS_DIR/lib, DBPLUS_SHARED_LIBADD) |
|||
AC_ADD_LIBRARY_WITH_PATH(Dracc, $DBPLUS_DIR/lib, DBPLUS_SHARED_LIBADD) |
|||
|
|||
PHP_EXTENSION(dbplus, $ext_shared) |
|||
fi |
|||
@ -0,0 +1,141 @@ |
|||
/* |
|||
+----------------------------------------------------------------------+ |
|||
| PHP version 4.0 | |
|||
+----------------------------------------------------------------------+ |
|||
| Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | |
|||
+----------------------------------------------------------------------+ |
|||
| 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: Hartmut Holzgraefe <hartmut@six.de> | |
|||
| | |
|||
+----------------------------------------------------------------------+ |
|||
*/ |
|||
|
|||
#include "php.h" |
|||
#include "php_ini.h" |
|||
#include "php_dbplus.h" |
|||
|
|||
|
|||
/* {{{ proto int dbplus_change(int handle, string domain) |
|||
*/ |
|||
PHP_FUNCTION(dbplus_change) |
|||
{ |
|||
zval **handle, **domain; |
|||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &handle, &domain) == FAILURE){ |
|||
WRONG_PARAM_COUNT; |
|||
} |
|||
|
|||
convert_to_long_ex(handle); |
|||
convert_to_string_ex(domain); |
|||
|
|||
|
|||
php_error(E_WARNING, "dbplus_change: not yet implemented"); |
|||
} |
|||
/* }}} */ |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/* {{{ proto int dbplus_rcreate(string name, string domlist, int flag) |
|||
*/ |
|||
PHP_FUNCTION(dbplus_rcreate) |
|||
{ |
|||
zval **name, **domlist, **flag; |
|||
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &name, &domlist, &flag) == FAILURE){ |
|||
WRONG_PARAM_COUNT; |
|||
} |
|||
|
|||
convert_to_string_ex(name); |
|||
convert_to_string_ex(domlist); |
|||
convert_to_long_ex(flag); |
|||
|
|||
|
|||
php_error(E_WARNING, "dbplus_rcreate: not yet implemented"); |
|||
} |
|||
/* }}} */ |
|||
|
|||
/* {{{ proto int dbplus_rcrtexact(string name, int handle, int flag) |
|||
*/ |
|||
PHP_FUNCTION(dbplus_rcrtexact) |
|||
{ |
|||
zval **name, **handle, **flag; |
|||
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &name, &handle, &flag) == FAILURE){ |
|||
WRONG_PARAM_COUNT; |
|||
} |
|||
|
|||
convert_to_string_ex(name); |
|||
convert_to_long_ex(handle); |
|||
convert_to_long_ex(flag); |
|||
|
|||
|
|||
php_error(E_WARNING, "dbplus_rcrtexact: not yet implemented"); |
|||
} |
|||
/* }}} */ |
|||
|
|||
/* {{{ proto int dbplus_rcrtlike(string name, int handle, int flag) |
|||
*/ |
|||
PHP_FUNCTION(dbplus_rcrtlike) |
|||
{ |
|||
zval **name, **handle, **flag; |
|||
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &name, &handle, &flag) == FAILURE){ |
|||
WRONG_PARAM_COUNT; |
|||
} |
|||
|
|||
convert_to_string_ex(name); |
|||
convert_to_long_ex(handle); |
|||
convert_to_long_ex(flag); |
|||
|
|||
|
|||
php_error(E_WARNING, "dbplus_rcrtlike: not yet implemented"); |
|||
} |
|||
/* }}} */ |
|||
|
|||
/* {{{ proto int dbplus_resolve(string name, string vname) |
|||
*/ |
|||
PHP_FUNCTION(dbplus_resolve) |
|||
{ |
|||
zval **name, **vname; |
|||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &name, &vname) == FAILURE){ |
|||
WRONG_PARAM_COUNT; |
|||
} |
|||
|
|||
convert_to_string_ex(name); |
|||
convert_to_string_ex(vname); |
|||
|
|||
|
|||
php_error(E_WARNING, "dbplus_resolve: not yet implemented"); |
|||
} |
|||
/* }}} */ |
|||
|
|||
/* {{{ proto int dbplus_tcl(int sid, string script) |
|||
*/ |
|||
PHP_FUNCTION(dbplus_tcl) |
|||
{ |
|||
zval **sid, **script; |
|||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &sid, &script) == FAILURE){ |
|||
WRONG_PARAM_COUNT; |
|||
} |
|||
|
|||
convert_to_long_ex(sid); |
|||
convert_to_string_ex(script); |
|||
|
|||
|
|||
php_error(E_WARNING, "dbplus_tcl: not yet implemented"); |
|||
} |
|||
/* }}} */ |
|||
|
|||
|
|||
|
|||
/* |
|||
* Local variables: |
|||
* tab-width: 4 |
|||
* c-basic-offset: 4 |
|||
* End: |
|||
*/ |
|||
1279
ext/dbplus/php_dbplus.c
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,131 @@ |
|||
/* |
|||
+----------------------------------------------------------------------+ |
|||
| PHP version 4.0 | |
|||
+----------------------------------------------------------------------+ |
|||
| Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | |
|||
+----------------------------------------------------------------------+ |
|||
| 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: | |
|||
| | |
|||
+----------------------------------------------------------------------+ |
|||
*/ |
|||
|
|||
#ifndef PHP_DBPLUS_H |
|||
#define PHP_DBPLUS_H |
|||
|
|||
#include <saccess.h> |
|||
#include <relation.h> |
|||
#include <dblight.h> |
|||
|
|||
extern zend_module_entry dbplus_module_entry; |
|||
#define phpext_dbplus_ptr &dbplus_module_entry |
|||
|
|||
#ifdef PHP_WIN32 |
|||
#define PHP_DBPLUS_API __declspec(dllexport) |
|||
#else |
|||
#define PHP_DBPLUS_API |
|||
#endif |
|||
|
|||
PHP_MINIT_FUNCTION(dbplus); |
|||
PHP_MSHUTDOWN_FUNCTION(dbplus); |
|||
PHP_RINIT_FUNCTION(dbplus); |
|||
PHP_RSHUTDOWN_FUNCTION(dbplus); |
|||
PHP_MINFO_FUNCTION(dbplus); |
|||
|
|||
PHP_FUNCTION(dbplus_add); |
|||
PHP_FUNCTION(dbplus_aql); |
|||
PHP_FUNCTION(dbplus_change); |
|||
PHP_FUNCTION(dbplus_chdir); |
|||
PHP_FUNCTION(dbplus_close); |
|||
PHP_FUNCTION(dbplus_curr); |
|||
PHP_FUNCTION(dbplus_errno); |
|||
PHP_FUNCTION(dbplus_errcode); |
|||
PHP_FUNCTION(dbplus_find); |
|||
PHP_FUNCTION(dbplus_first); |
|||
PHP_FUNCTION(dbplus_flush); |
|||
PHP_FUNCTION(dbplus_freealllocks); |
|||
PHP_FUNCTION(dbplus_freelock); |
|||
PHP_FUNCTION(dbplus_freerlocks); |
|||
PHP_FUNCTION(dbplus_getlock); |
|||
PHP_FUNCTION(dbplus_getunique); |
|||
PHP_FUNCTION(dbplus_info); |
|||
PHP_FUNCTION(dbplus_last); |
|||
PHP_FUNCTION(dbplus_next); |
|||
PHP_FUNCTION(dbplus_open); |
|||
PHP_FUNCTION(dbplus_prev); |
|||
PHP_FUNCTION(dbplus_rchperm); |
|||
PHP_FUNCTION(dbplus_rcreate); |
|||
PHP_FUNCTION(dbplus_rcrtexact); |
|||
PHP_FUNCTION(dbplus_rcrtlike); |
|||
PHP_FUNCTION(dbplus_resolve); |
|||
PHP_FUNCTION(dbplus_restorepos); |
|||
PHP_FUNCTION(dbplus_rkeys); |
|||
PHP_FUNCTION(dbplus_ropen); |
|||
PHP_FUNCTION(dbplus_rquery); |
|||
PHP_FUNCTION(dbplus_rrename); |
|||
PHP_FUNCTION(dbplus_rsecindex); |
|||
PHP_FUNCTION(dbplus_runlink); |
|||
PHP_FUNCTION(dbplus_rzap); |
|||
PHP_FUNCTION(dbplus_savepos); |
|||
PHP_FUNCTION(dbplus_setindex); |
|||
PHP_FUNCTION(dbplus_setindexbynumber); |
|||
PHP_FUNCTION(dbplus_sql); |
|||
PHP_FUNCTION(dbplus_tcl); |
|||
PHP_FUNCTION(dbplus_tremove); |
|||
PHP_FUNCTION(dbplus_undo); |
|||
PHP_FUNCTION(dbplus_undoprepare); |
|||
PHP_FUNCTION(dbplus_unlockrel); |
|||
PHP_FUNCTION(dbplus_unselect); |
|||
PHP_FUNCTION(dbplus_update); |
|||
PHP_FUNCTION(dbplus_xlockrel); |
|||
PHP_FUNCTION(dbplus_xunlockrel); |
|||
|
|||
|
|||
/* |
|||
Declare any global variables you may need between the BEGIN |
|||
and END macros here: |
|||
|
|||
ZEND_BEGIN_MODULE_GLOBALS(dbplus) |
|||
int global_variable; |
|||
ZEND_END_MODULE_GLOBALS(dbplus) |
|||
*/ |
|||
|
|||
/* In every function that needs to use variables in php_dbplus_globals, |
|||
do call DBPLUSLS_FETCH(); after declaring other variables used by |
|||
that function, and always refer to them as DBPLUSG(variable). |
|||
You are encouraged to rename these macros something shorter, see |
|||
examples in any other php module directory. |
|||
*/ |
|||
|
|||
#ifdef ZTS |
|||
#define DBPLUSG(v) (dbplus_globals->v) |
|||
#define DBPLUSLS_FETCH() php_dbplus_globals *dbplus_globals = ts_resource(dbplus_globals_id) |
|||
#else |
|||
#define DBPLUSG(v) (dbplus_globals.v) |
|||
#define DBPLUSLS_FETCH() |
|||
#endif |
|||
|
|||
|
|||
int le_dbplus_relation; |
|||
int le_dbplus_tuple; |
|||
|
|||
void dbplus_destruct_relation(zend_rsrc_list_entry *rsrc); |
|||
void dbplus_destruct_tupel(zend_rsrc_list_entry *rsrc); |
|||
|
|||
|
|||
#endif /* PHP_DBPLUS_H */ |
|||
|
|||
|
|||
/* |
|||
* Local variables: |
|||
* tab-width: 4 |
|||
* c-basic-offset: 4 |
|||
* End: |
|||
*/ |
|||
@ -0,0 +1,23 @@ |
|||
--TEST-- |
|||
Check for dbplus presence |
|||
--SKIPIF-- |
|||
<?php if (!extension_loaded("dbplus")) print "skip"; ?> |
|||
--POST-- |
|||
--GET-- |
|||
--FILE-- |
|||
<?php |
|||
echo "dbplus extension is available"; |
|||
/* |
|||
you can add regression tests for your extension here |
|||
|
|||
the output of your test code has to be equal to the |
|||
text in the --EXPECT-- section below for the tests |
|||
to pass, differences between the output and the |
|||
expected text are interpreted as failure |
|||
|
|||
see php4/tests/README for further information on |
|||
writing regression tests |
|||
*/ |
|||
?> |
|||
--EXPECT-- |
|||
dbplus extension is available |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue