mboeren         Mon Sep  8 03:19:08 2003 EDT

  Modified files:              
    /php-src/ext/dbx    dbx.c dbx.h php_dbx.h 
  Log:
  Fix warning and converted dos-crlf to unix line-endings.
  
  
Index: php-src/ext/dbx/dbx.c
diff -u php-src/ext/dbx/dbx.c:1.54 php-src/ext/dbx/dbx.c:1.55
--- php-src/ext/dbx/dbx.c:1.54  Fri Sep  5 04:39:25 2003
+++ php-src/ext/dbx/dbx.c       Mon Sep  8 03:19:08 2003
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: dbx.c,v 1.54 2003/09/05 08:39:25 mboeren Exp $ */
+/* $Id: dbx.c,v 1.55 2003/09/08 07:19:08 mboeren Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -100,20 +100,20 @@
        return 1;
 }
 
-int split_dbx_result_object(zval **dbx_result, zval ***pdbx_link, zval 
***pdbx_handle, zval ***pdbx_flags, zval ***pdbx_info, zval ***pdbx_cols , zval 
***pdbx_rows TSRMLS_DC)
-{
-       convert_to_object_ex(dbx_result);
-       if (zend_hash_find(Z_OBJPROP_PP(dbx_result), "link", 5, (void **) 
pdbx_link)==FAILURE
-       || zend_hash_find(Z_OBJPROP_PP(dbx_result), "handle", 7, (void **) 
pdbx_handle)==FAILURE
-       || zend_hash_find(Z_OBJPROP_PP(dbx_result), "flags", 6, (void **) 
pdbx_flags)==FAILURE
-       || zend_hash_find(Z_OBJPROP_PP(dbx_result), "info", 5, (void **) 
pdbx_info)==FAILURE
-       || zend_hash_find(Z_OBJPROP_PP(dbx_result), "cols", 5, (void **) 
pdbx_cols)==FAILURE
-       || zend_hash_find(Z_OBJPROP_PP(dbx_result), "rows", 5, (void **) 
pdbx_rows)==FAILURE) {
-               return 0;
-       }
-       return 1;
-}
-
+int split_dbx_result_object(zval **dbx_result, zval ***pdbx_link, zval 
***pdbx_handle, zval ***pdbx_flags, zval ***pdbx_info, zval ***pdbx_cols , zval 
***pdbx_rows TSRMLS_DC)
+{
+       convert_to_object_ex(dbx_result);
+       if (zend_hash_find(Z_OBJPROP_PP(dbx_result), "link", 5, (void **) 
pdbx_link)==FAILURE
+       || zend_hash_find(Z_OBJPROP_PP(dbx_result), "handle", 7, (void **) 
pdbx_handle)==FAILURE
+       || zend_hash_find(Z_OBJPROP_PP(dbx_result), "flags", 6, (void **) 
pdbx_flags)==FAILURE
+       || zend_hash_find(Z_OBJPROP_PP(dbx_result), "info", 5, (void **) 
pdbx_info)==FAILURE
+       || zend_hash_find(Z_OBJPROP_PP(dbx_result), "cols", 5, (void **) 
pdbx_cols)==FAILURE
+       || zend_hash_find(Z_OBJPROP_PP(dbx_result), "rows", 5, (void **) 
pdbx_rows)==FAILURE) {
+               return 0;
+       }
+       return 1;
+}
+
 /* from dbx.h, to be used in support-files (dbx_mysql.c etc...) */
 void dbx_call_any_function(INTERNAL_FUNCTION_PARAMETERS, char *function_name, zval 
**returnvalue, int number_of_arguments, zval ***params)
 {
@@ -163,7 +163,7 @@
        ZEND_FE(dbx_connect,    NULL)
        ZEND_FE(dbx_close,              NULL)
        ZEND_FE(dbx_query,              NULL)
-       ZEND_FE(dbx_fetch_row,  NULL)
+       ZEND_FE(dbx_fetch_row,  NULL)
        ZEND_FE(dbx_error,              NULL)
        ZEND_FE(dbx_escape_string,      NULL)
 
@@ -212,7 +212,7 @@
        REGISTER_LONG_CONSTANT("DBX_RESULT_INFO", DBX_RESULT_INFO, CONST_CS | 
CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("DBX_RESULT_INDEX", DBX_RESULT_INDEX, CONST_CS | 
CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("DBX_RESULT_ASSOC", DBX_RESULT_ASSOC, CONST_CS | 
CONST_PERSISTENT);
-       REGISTER_LONG_CONSTANT("DBX_RESULT_UNBUFFERED", DBX_RESULT_UNBUFFERED, 
CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("DBX_RESULT_UNBUFFERED", DBX_RESULT_UNBUFFERED, 
CONST_CS | CONST_PERSISTENT);
 
        REGISTER_LONG_CONSTANT("DBX_COLNAMES_UNCHANGED", DBX_COLNAMES_UNCHANGED, 
CONST_CS | CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("DBX_COLNAMES_UPPERCASE", DBX_COLNAMES_UPPERCASE, 
CONST_CS | CONST_PERSISTENT);
@@ -415,7 +415,7 @@
                if (result_flags & DBX_RESULT_ASSOC) {
                        result_flags |= DBX_RESULT_INFO;
                }
-               if (!result_flags) result_flags = DBX_RESULT_INFO | DBX_RESULT_INDEX | 
DBX_RESULT_ASSOC;
+               if (!result_flags) result_flags = DBX_RESULT_INFO | DBX_RESULT_INDEX | 
DBX_RESULT_ASSOC;
                if (result_flags == DBX_RESULT_UNBUFFERED) result_flags |= 
DBX_RESULT_INFO | DBX_RESULT_INDEX | DBX_RESULT_ASSOC;
                /* override ini-setting for colcase */
                if (query_flags & DBX_COLNAMES_UNCHANGED) {
@@ -444,15 +444,15 @@
        /* init return_value as object (of rows) */
        object_init(return_value);
 
-       zend_hash_update(Z_OBJPROP_P(return_value), "link", 5, (void *)(arguments[0]), 
sizeof(zval *), NULL);
-        /* need extra refcount here otherwise the link object is destroyed when the 
-         * query resultobject is destroyed (or not assigned!)
-         */
-       zval_add_ref(arguments[0]);
+       zend_hash_update(Z_OBJPROP_P(return_value), "link", 5, (void *)(arguments[0]), 
sizeof(zval *), NULL);
+        /* need extra refcount here otherwise the link object is destroyed when the 
+         * query resultobject is destroyed (or not assigned!)
+         */
+       zval_add_ref(arguments[0]);
        /* add result_handle property to return_value */
-       zend_hash_update(Z_OBJPROP_P(return_value), "handle", 7, (void 
*)&(rv_result_handle), sizeof(zval *), NULL);
+       zend_hash_update(Z_OBJPROP_P(return_value), "handle", 7, (void 
*)&(rv_result_handle), sizeof(zval *), NULL);
        /* add flags property to return_value */
-       add_property_long(return_value, "flags", result_flags | colcase);
+       add_property_long(return_value, "flags", result_flags | colcase);
        /* init info property as array and add to return_value as a property */
        if (result_flags & DBX_RESULT_INFO) {
                MAKE_STD_ZVAL(info); 
@@ -460,10 +460,10 @@
                zend_hash_update(Z_OBJPROP_P(return_value), "info", 5, (void 
*)&(info), sizeof(zval *), NULL);
        }
        /* init data property as array and add to return_value as a property */
-       if (!(result_flags & DBX_RESULT_UNBUFFERED)) {
+       if (!(result_flags & DBX_RESULT_UNBUFFERED)) {
                MAKE_STD_ZVAL(data); 
                array_init(data);
-               zend_hash_update(Z_OBJPROP_P(return_value), "data", 5, (void 
*)&(data), sizeof(zval *), NULL);
+               zend_hash_update(Z_OBJPROP_P(return_value), "data", 5, (void 
*)&(data), sizeof(zval *), NULL);
        }
        /* get columncount and add to returnvalue as property */
        MAKE_STD_ZVAL(rv_column_count); 
@@ -516,7 +516,7 @@
                zend_hash_update(Z_ARRVAL_P(info), "type", 5, (void *) &info_row_type, 
sizeof(zval *), NULL);
        }
        /* fill each row array with fieldvalues (indexed (and assoc)) */
-       if (!(result_flags & DBX_RESULT_UNBUFFERED)) {
+       if (!(result_flags & DBX_RESULT_UNBUFFERED)) {
                row_count=0;
                result=1;
                while (result) {
@@ -543,81 +543,80 @@
                        }
                }
                /* add row_count property */
-               add_property_long(return_value, "rows", row_count);
-       }
+               add_property_long(return_value, "rows", row_count);
+       }
        else {
-               add_property_long(return_value, "rows", 0);
-       }
+               add_property_long(return_value, "rows", 0);
+       }
+}
+/* }}} */
+
+/* {{{ proto dbx_row dbx_fetch_row(dbx_query_object dbx_q)
+   Returns a row (index and assoc based on query) on success and returns 0 on failure 
or no more rows */
+ZEND_FUNCTION(dbx_fetch_row)
+{
+       int number_of_arguments=1;
+       zval **arguments[1];
+
+       zval **dbx_result_link;
+       zval **dbx_result_handle;
+       zval **dbx_result_flags;
+       zval **dbx_result_info;
+       zval **dbx_result_cols;
+       zval **dbx_result_rows;
+
+       zval **dbx_handle;
+       zval **dbx_module;
+       zval **dbx_database;
+
+       int result;
+       long col_index;
+       long col_count;
+       long row_count;
+       long result_flags;
+       zval **inforow_ptr;
+
+       if (ZEND_NUM_ARGS()!=number_of_arguments || 
zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+       if (!split_dbx_result_object(arguments[0], &dbx_result_link, 
&dbx_result_handle, &dbx_result_flags, &dbx_result_info, &dbx_result_cols, 
&dbx_result_rows TSRMLS_CC)) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "not a valid 
dbx_result-object...");
+               RETURN_LONG(0);
+       }
+       if (!split_dbx_handle_object(dbx_result_link, &dbx_handle, &dbx_module, 
&dbx_database TSRMLS_CC)) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "not a valid 
dbx_handle-object...");
+               RETURN_LONG(0);
+       }
+
+       /* default values */
+       result_flags = Z_LVAL_PP(dbx_result_flags);
+       col_count = Z_LVAL_PP(dbx_result_cols);
+       row_count = Z_LVAL_PP(dbx_result_rows);
+
+       /* find fieldnames (for assoc) */
+       if (result_flags & DBX_RESULT_ASSOC) {
+               zend_hash_find(Z_ARRVAL_PP(dbx_result_info), "name", 5, (void **) 
&inforow_ptr);
+       }
+
+       result = switch_dbx_getrow(&return_value, dbx_result_handle, row_count, 
INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
+       if (result) {
+               /* associate results with fieldnames */
+               if (result_flags & DBX_RESULT_ASSOC) {
+                       zval **columnname_ptr, **actual_ptr;
+                       for (col_index=0; col_index<col_count; ++col_index) {
+                               zend_hash_index_find(Z_ARRVAL_PP(inforow_ptr), 
col_index, (void **) &columnname_ptr);
+                               zend_hash_index_find(Z_ARRVAL_P(return_value), 
col_index, (void **) &actual_ptr);
+                               (*actual_ptr)->refcount+=1;
+                               (*actual_ptr)->is_ref=1;
+                               zend_hash_update(Z_ARRVAL_P(return_value), 
Z_STRVAL_PP(columnname_ptr), Z_STRLEN_PP(columnname_ptr) + 1, actual_ptr, sizeof(zval 
*), NULL);
+                       }
+               }
+       ++row_count;
+       add_property_long(*arguments[0], "rows", row_count);
+       }
 }
 /* }}} */
-
-/* {{{ proto dbx_row dbx_fetch_row(dbx_query_object dbx_q)
-   Returns a row (index and assoc based on query) on success and returns 0 on failure 
or no more rows */
-ZEND_FUNCTION(dbx_fetch_row)
-{
-       int min_number_of_arguments=1;
-       int number_of_arguments=1;
-       zval **arguments[1];
-
-       zval **dbx_result_link;
-       zval **dbx_result_handle;
-       zval **dbx_result_flags;
-       zval **dbx_result_info;
-       zval **dbx_result_cols;
-       zval **dbx_result_rows;
-
-       zval **dbx_handle;
-       zval **dbx_module;
-       zval **dbx_database;
-
-       int result;
-       long col_index;
-       long col_count;
-       long row_count;
-       long result_flags;
-       zval **inforow_ptr;
-
-       if (ZEND_NUM_ARGS()!=number_of_arguments || 
zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) {
-               WRONG_PARAM_COUNT;
-       }
-       if (!split_dbx_result_object(arguments[0], &dbx_result_link, 
&dbx_result_handle, &dbx_result_flags, &dbx_result_info, &dbx_result_cols, 
&dbx_result_rows TSRMLS_CC)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "not a valid 
dbx_result-object...");
-               RETURN_LONG(0);
-       }
-       if (!split_dbx_handle_object(dbx_result_link, &dbx_handle, &dbx_module, 
&dbx_database TSRMLS_CC)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "not a valid 
dbx_handle-object...");
-               RETURN_LONG(0);
-       }
-
-       /* default values */
-       result_flags = Z_LVAL_PP(dbx_result_flags);
-       col_count = Z_LVAL_PP(dbx_result_cols);
-       row_count = Z_LVAL_PP(dbx_result_rows);
-
-       /* find fieldnames (for assoc) */
-       if (result_flags & DBX_RESULT_ASSOC) {
-               zend_hash_find(Z_ARRVAL_PP(dbx_result_info), "name", 5, (void **) 
&inforow_ptr);
-       }
-
-       result = switch_dbx_getrow(&return_value, dbx_result_handle, row_count, 
INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
-       if (result) {
-               /* associate results with fieldnames */
-               if (result_flags & DBX_RESULT_ASSOC) {
-                       zval **columnname_ptr, **actual_ptr;
-                       for (col_index=0; col_index<col_count; ++col_index) {
-                               zend_hash_index_find(Z_ARRVAL_PP(inforow_ptr), 
col_index, (void **) &columnname_ptr);
-                               zend_hash_index_find(Z_ARRVAL_P(return_value), 
col_index, (void **) &actual_ptr);
-                               (*actual_ptr)->refcount+=1;
-                               (*actual_ptr)->is_ref=1;
-                               zend_hash_update(Z_ARRVAL_P(return_value), 
Z_STRVAL_PP(columnname_ptr), Z_STRLEN_PP(columnname_ptr) + 1, actual_ptr, sizeof(zval 
*), NULL);
-                       }
-               }
-       ++row_count;
-       add_property_long(*arguments[0], "rows", row_count);
-       }
-}
-/* }}} */
-
+
 
 /* {{{ proto string dbx_error(dbx_link_object dbx_link)
    Returns success or failure 
Index: php-src/ext/dbx/dbx.h
diff -u php-src/ext/dbx/dbx.h:1.15 php-src/ext/dbx/dbx.h:1.16
--- php-src/ext/dbx/dbx.h:1.15  Fri Sep  5 04:39:25 2003
+++ php-src/ext/dbx/dbx.h       Mon Sep  8 03:19:08 2003
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: dbx.h,v 1.15 2003/09/05 08:39:25 mboeren Exp $ */
+/* $Id: dbx.h,v 1.16 2003/09/08 07:19:08 mboeren Exp $ */
 
 #ifndef ZEND_DBX_H
 #define ZEND_DBX_H
@@ -40,7 +40,7 @@
 #define DBX_COLNAMES_UNCHANGED (1<<3)
 #define DBX_COLNAMES_UPPERCASE (1<<4)
 #define DBX_COLNAMES_LOWERCASE (1<<5)
-#define DBX_RESULT_UNBUFFERED  (1<<6)
+#define DBX_RESULT_UNBUFFERED  (1<<6)
 
 #define DBX_CMP_NATIVE         (1<<0)
 #define DBX_CMP_TEXT           (1<<1)
Index: php-src/ext/dbx/php_dbx.h
diff -u php-src/ext/dbx/php_dbx.h:1.17 php-src/ext/dbx/php_dbx.h:1.18
--- php-src/ext/dbx/php_dbx.h:1.17      Fri Sep  5 04:39:25 2003
+++ php-src/ext/dbx/php_dbx.h   Mon Sep  8 03:19:08 2003
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_dbx.h,v 1.17 2003/09/05 08:39:25 mboeren Exp $ */
+/* $Id: php_dbx.h,v 1.18 2003/09/08 07:19:08 mboeren Exp $ */
 
 #ifndef ZEND_PHP_DBX_H
 #define ZEND_PHP_DBX_H
@@ -48,7 +48,7 @@
 ZEND_FUNCTION(dbx_connect);
 ZEND_FUNCTION(dbx_close);
 ZEND_FUNCTION(dbx_query);
-ZEND_FUNCTION(dbx_fetch_row);
+ZEND_FUNCTION(dbx_fetch_row);
 ZEND_FUNCTION(dbx_error);
 ZEND_FUNCTION(dbx_escape_string);
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to