cvs: pecl /paradox paradox.c
| From: | Uwe Steinmann | Date: | Tue, 21 Feb 2006 12:53:18 +0000 |
| Subject: | cvs: pecl /paradox paradox.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-5236@lists.php.net to get a copy of this message | ||
steinm Tue Feb 21 12:53:18 2006 UTC
Modified files:
/pecl/paradox paradox.c
Log:
- added initial (not working) version of px_pack()
- fixed compiler warnings issued by gcc 2.9.5 (fixes bug #6775)
http://cvs.php.net/viewcvs.cgi/pecl/paradox/paradox.c?r1=1.33&r2=1.34&diff_format=u
Index: pecl/paradox/paradox.c
diff -u pecl/paradox/paradox.c:1.33 pecl/paradox/paradox.c:1.34
--- pecl/paradox/paradox.c:1.33 Mon Feb 13 10:12:28 2006
+++ pecl/paradox/paradox.c Tue Feb 21 12:53:18 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: paradox.c,v 1.33 2006/02/13 10:12:28 steinm Exp $ */
+/* $Id: paradox.c,v 1.34 2006/02/21 12:53:18 steinm Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -70,6 +70,9 @@
#ifdef HAVE_PXRETRIEVERECORD
PHP_FE(px_retrieve_record, NULL)
#endif
+#ifdef HAVE_PXPACK
+ PHP_FE(px_pack, NULL)
+#endif
PHP_FE(px_get_field, NULL)
PHP_FE(px_get_schema, NULL)
PHP_FE(px_get_info, NULL)
@@ -86,9 +89,6 @@
};
/* }}} */
-//#define PHP_ME_MAPPING(name, func_name, arg_types) \
-// ZEND_NAMED_FE(name, ZEND_FN(func_name), arg_types)
-
function_entry paradox_funcs_db[] = {
PHP_ME_MAPPING(__construct, px_new, NULL)
PHP_ME_MAPPING(open_fp, px_open_fp, NULL)
@@ -110,6 +110,9 @@
#ifdef HAVE_PXRETRIEVERECORD
PHP_ME_MAPPING(retrieve_record, px_retrieve_record, NULL)
#endif
+#ifdef HAVE_PXPACK
+ PHP_ME_MAPPING(pack, px_pack, NULL)
+#endif
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)
@@ -392,7 +395,7 @@
}
php_info_print_table_row(2, "support for recoding record data", tmp );
php_info_print_table_row(2, "pxlib was build on", PX_get_builddate() );
- php_info_print_table_row(2, "Revision", "$Revision: 1.33 $" );
+ php_info_print_table_row(2, "Revision", "$Revision: 1.34 $" );
php_info_print_table_end();
/* Remove comments if you have entries in php.ini
@@ -425,6 +428,7 @@
FILE *fp = NULL;
pxdoc_t *pxdoc = NULL;
zval *object = getThis();
+ php_stream *stream;
if (object) {
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zfp)) {
@@ -438,8 +442,6 @@
PXDOC_FROM_ZVAL(pxdoc, &zpx);
}
- php_stream *stream;
-
php_stream_from_zval(stream, &zfp);
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void*)&fp, 1) == FAILURE) {
@@ -468,6 +470,7 @@
pxfield_t *pxf;
int numfields, i;
zval *object = getThis();
+ php_stream *stream;
if (object) {
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &zfp,
&schema)) {
@@ -486,7 +489,6 @@
RETURN_FALSE;
}
- php_stream *stream;
php_stream_from_zval(stream, &zfp);
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void*)&fp, 1) == FAILURE) {
@@ -727,6 +729,31 @@
}
/* }}} */
+#ifdef HAVE_PXPACK
+/* {{{ proto bool px_pack(resource pxdoc)
+ Reduce paradox document to smallest possible size. */
+PHP_FUNCTION(px_pack)
+{
+ zval *zpx;
+ pxdoc_t *pxdoc;
+ zval *object = getThis();
+
+ if (object) {
+ PXDOC_FROM_OBJECT(pxdoc, object);
+ } else {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zpx)) {
+ return;
+ }
+ PXDOC_FROM_ZVAL(pxdoc, &zpx);
+ }
+
+ PX_pack(pxdoc);
+
+ RETURN_TRUE;
+}
+/* }}} */
+#endif
+
/* {{{ proto array px_get_record(resource pxdoc, int recno[, int type])
Returns a record from the database */
PHP_FUNCTION(px_get_record)
@@ -1018,7 +1045,7 @@
case pxfTimestamp:
case pxfNumber:
convert_to_double_ex(keydataptr);
- dataptr[i]->value.dval = Z_LVAL_PP(keydataptr);
+ dataptr[i]->value.dval = Z_DVAL_PP(keydataptr);
break;
default:
dataptr[i]->isnull = 1;