cvs: pecl /paradox paradox.c php_paradox.h
| From: | Uwe Steinmann | Date: | Tue, 09 Dec 2003 13:07:32 +0000 |
| Subject: | cvs: pecl /paradox paradox.c php_paradox.h | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-570@lists.php.net to get a copy of this message | ||
steinm Tue Dec 9 08:07:32 2003 EDT
Modified files:
/pecl/paradox paradox.c php_paradox.h
Log:
- added functions px_[get|set]_[parameter|value]
Index: pecl/paradox/paradox.c
diff -u pecl/paradox/paradox.c:1.13 pecl/paradox/paradox.c:1.14
--- pecl/paradox/paradox.c:1.13 Tue Dec 9 02:59:23 2003
+++ pecl/paradox/paradox.c Tue Dec 9 08:07:32 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: paradox.c,v 1.13 2003/12/09 07:59:23 steinm Exp $ */
+/* $Id: paradox.c,v 1.14 2003/12/09 13:07:32 steinm Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -61,6 +61,10 @@
PHP_FE(px_get_field, NULL)
PHP_FE(px_get_schema, NULL)
PHP_FE(px_get_info, NULL)
+ PHP_FE(px_set_parameter, NULL)
+ PHP_FE(px_get_parameter, NULL)
+ PHP_FE(px_set_value, NULL)
+ PHP_FE(px_get_value, NULL)
PHP_FE(px_set_targetencoding, NULL)
PHP_FE(px_set_tablename, NULL)
{NULL, NULL, NULL} /* Must be the last line in paradox_functions[] */
@@ -81,6 +85,10 @@
PHP_ME_MAPPING(get_field, px_get_field, NULL)
PHP_ME_MAPPING(get_schema, px_get_schema, NULL)
PHP_ME_MAPPING(get_info, px_get_info, NULL)
+ PHP_ME_MAPPING(set_parameter, px_set_parameter, NULL)
+ PHP_ME_MAPPING(get_parameter, px_get_parameter, NULL)
+ PHP_ME_MAPPING(set_value, px_set_value, NULL)
+ PHP_ME_MAPPING(get_value, px_get_value, NULL)
PHP_ME_MAPPING(set_targetencoding, px_set_targetencoding, NULL)
PHP_ME_MAPPING(set_tablename, px_set_tablename, NULL)
{NULL, NULL, NULL}
@@ -346,7 +354,7 @@
default: snprintf(tmp, 31, "none"); break;
}
php_info_print_table_row(2, "support for recoding record data", tmp );
- php_info_print_table_row(2, "Revision", "$Revision: 1.13 $" );
+ php_info_print_table_row(2, "Revision", "$Revision: 1.14 $" );
php_info_print_table_end();
/* Remove comments if you have entries in php.ini
@@ -372,7 +380,7 @@
/* }}} */
/* {{{ proto bool px_open_fp(resource pxdoc, resource filedesc)
- Opens a new paradox document. */
+ Opens an existing paradox document. */
PHP_FUNCTION(px_open_fp)
{
zval **arg1, **arg2;
@@ -1066,6 +1074,136 @@
}
/* }}} */
+/* {{{ proto bool px_set_parameter(resource pxdoc, string name, string value)
+ Sets certain parameters. */
+PHP_FUNCTION(px_set_parameter)
+{
+ zval **arg1, **arg2, **arg3;
+ pxdoc_t *pxdoc;
+ int ret;
+ zval *object = getThis();
+
+ if (object) {
+ if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg2, &arg3) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ PXDOC_FROM_OBJECT(pxdoc, object);
+ } else {
+
+ if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) ==
FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ ZEND_FETCH_RESOURCE(pxdoc, pxdoc_t *, arg1, -1, "px object", le_pxdoc);
+ }
+
+ convert_to_string_ex(arg2);
+ convert_to_string_ex(arg3);
+
+ if(0 > PX_set_parameter(pxdoc, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3))) {
+ RETURN_FALSE;
+ } else {
+ RETURN_TRUE;
+ }
+}
+/* }}} */
+
+/* {{{ proto bool px_get_parameter(resource pxdoc, string name)
+ Returns the value of a parameter. */
+PHP_FUNCTION(px_get_parameter)
+{
+ zval **arg1, **arg2;
+ pxdoc_t *pxdoc;
+ char *value;
+ zval *object = getThis();
+
+ if (object) {
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ PXDOC_FROM_OBJECT(pxdoc, object);
+ } else {
+
+ if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ ZEND_FETCH_RESOURCE(pxdoc, pxdoc_t *, arg1, -1, "px object", le_pxdoc);
+ }
+
+ convert_to_string_ex(arg2);
+
+ if(0 > PX_get_parameter(pxdoc, Z_STRVAL_PP(arg2), &value)) {
+ RETURN_FALSE;
+ } else {
+ RETURN_STRING(value, 1);
+ }
+}
+/* }}} */
+
+/* {{{ proto bool px_set_value(resource pxdoc, string name, float value)
+ Sets certain values. */
+PHP_FUNCTION(px_set_value)
+{
+ zval **arg1, **arg2, **arg3;
+ pxdoc_t *pxdoc;
+ int ret;
+ zval *object = getThis();
+
+ if (object) {
+ if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg2, &arg3) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ PXDOC_FROM_OBJECT(pxdoc, object);
+ } else {
+
+ if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) ==
FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ ZEND_FETCH_RESOURCE(pxdoc, pxdoc_t *, arg1, -1, "px object", le_pxdoc);
+ }
+
+ convert_to_string_ex(arg2);
+ convert_to_double_ex(arg3);
+
+ if(0 > PX_set_value(pxdoc, Z_STRVAL_PP(arg2), Z_DVAL_PP(arg3))) {
+ RETURN_FALSE;
+ } else {
+ RETURN_TRUE;
+ }
+}
+/* }}} */
+
+/* {{{ proto bool px_get_value(resource pxdoc, string name)
+ Returns the value of a value. */
+PHP_FUNCTION(px_get_value)
+{
+ zval **arg1, **arg2;
+ pxdoc_t *pxdoc;
+ float value;
+ zval *object = getThis();
+
+ if (object) {
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ PXDOC_FROM_OBJECT(pxdoc, object);
+ } else {
+
+ if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ ZEND_FETCH_RESOURCE(pxdoc, pxdoc_t *, arg1, -1, "px object", le_pxdoc);
+ }
+
+ convert_to_string_ex(arg2);
+
+ if(0 > PX_get_value(pxdoc, Z_STRVAL_PP(arg2), &value)) {
+ RETURN_FALSE;
+ } else {
+ RETURN_DOUBLE(value);
+ }
+}
+/* }}} */
+
/* {{{ proto bool px_set_targetencoding(resource pxdoc, string encoding)
Sets encoding of field data when it is retrieved. */
PHP_FUNCTION(px_set_targetencoding)
Index: pecl/paradox/php_paradox.h
diff -u pecl/paradox/php_paradox.h:1.5 pecl/paradox/php_paradox.h:1.6
--- pecl/paradox/php_paradox.h:1.5 Fri Oct 17 09:52:25 2003
+++ pecl/paradox/php_paradox.h Tue Dec 9 08:07:32 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_paradox.h,v 1.5 2003/10/17 13:52:25 steinm Exp $ */
+/* $Id: php_paradox.h,v 1.6 2003/12/09 13:07:32 steinm Exp $ */
#ifndef PHP_PARADOX_H
#define PHP_PARADOX_H
@@ -87,6 +87,10 @@
PHP_FUNCTION(px_get_field);
PHP_FUNCTION(px_get_schema);
PHP_FUNCTION(px_get_info);
+PHP_FUNCTION(px_set_parameter);
+PHP_FUNCTION(px_get_parameter);
+PHP_FUNCTION(px_set_value);
+PHP_FUNCTION(px_get_value);
PHP_FUNCTION(px_set_targetencoding);
PHP_FUNCTION(px_set_tablename);