]> granicus.if.org Git - php/commitdiff
Fixed compile errors for PostgreSQL support (Mc)
authorMarc Boeren <mboeren@php.net>
Fri, 23 Mar 2001 14:50:17 +0000 (14:50 +0000)
committerMarc Boeren <mboeren@php.net>
Fri, 23 Mar 2001 14:50:17 +0000 (14:50 +0000)
Removed globals that Rui put in, and changed the dbx_get_row
to include a row_number (which PostgreSQL expects) (Mc)
Added source files to Makefile.in and dbx.dsp (Mc)
#Could someone please check if the PostgreSQL support works?
#And please, check your work _before_ you commit anything!

ext/dbx/Makefile.in
ext/dbx/dbx.c
ext/dbx/dbx.dsp
ext/dbx/dbx_mysql.c
ext/dbx/dbx_mysql.h
ext/dbx/dbx_odbc.c
ext/dbx/dbx_odbc.h
ext/dbx/dbx_pgsql.c
ext/dbx/dbx_pgsql.h
ext/dbx/php_dbx.h

index 8f4015124098c3d45be6a7389f28b4d122aad95d..1c750f570b5ad19563f091c552745299ee7e9829 100644 (file)
@@ -1,6 +1,6 @@
 
 LTLIBRARY_NAME = libdbx.la
-LTLIBRARY_SOURCES = dbx.c dbx_mysql.c dbx_odbc.c
+LTLIBRARY_SOURCES = dbx.c dbx_mysql.c dbx_odbc.c dbx_pgsql.c
 LTLIBRARY_SHARED_NAME = dbx.la
 
 include $(top_srcdir)/build/dynlib.mk
index 2bb49a98292c9564b4baab77095ad78f21d95829..df728b21cd8ef679b7da90eb3509d0e90509f253 100644 (file)
@@ -96,27 +96,30 @@ int switch_dbx_getcolumnname(zval ** rv, zval ** result_handle, long column_inde
     /*/ returns column-name as string on success or 0 as long on failure /*/
 int switch_dbx_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
     /*/ returns column-type as string on success or 0 as long on failure /*/
-int switch_dbx_getrow(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
+int switch_dbx_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
     /*/ returns array[0..columncount-1] as strings on success or 0 as long on failure /*/
 int switch_dbx_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
     /*/ returns string /*/
-
+/*
 #ifdef ZTS
 int dbx_globals_id;
 #else
 ZEND_DBX_API zend_dbx_globals dbx_globals;
 #endif
+*/
 /* If you declare any globals in php_dbx.h uncomment this: */
 /* ZEND_DECLARE_MODULE_GLOBALS(dbx) */
 /* True global resources - no need for thread safety here */
+/*
 static int le_dbx;
-
+*/
+/*
 static void zend_dbx_init_globals(PGLS_D)
 {
        DBXG(row_count) = 0;
        DBXG(num_rows) = 0;
 }
-
+*/
 /* Every user visible function must have an entry in dbx_functions[].
 */
 function_entry dbx_functions[] = {
@@ -155,13 +158,13 @@ ZEND_GET_MODULE(dbx)
 /*/
 ZEND_MINIT_FUNCTION(dbx)
 {
-
+/*
 #ifdef ZTS
        dbx_globals_id = ts_allocate_id(sizeof(zend_dbx_globals), (ts_allocate_ctor) zend_dbx_init_globals, NULL);
 #else
        zend_dbx_init_globals(DBXLS_C);
 #endif
-
+*/
 /*/    REGISTER_INI_ENTRIES(); /*/
 
     REGISTER_LONG_CONSTANT("DBX_PERSISTENT", DBX_PERSISTENT, CONST_CS | CONST_PERSISTENT);
@@ -455,7 +458,7 @@ ZEND_FUNCTION(dbx_query)
     while (result) {
         zval * rv_row;
         MAKE_STD_ZVAL(rv_row);
-        result = switch_dbx_getrow(&rv_row, &rv_result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
+        result = switch_dbx_getrow(&rv_row, &rv_result_handle, row_count, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
         if (result) {
 /*/            if (row_count>=result_row_offset && (result_row_count==-1 || row_count<result_row_offset+result_row_count)) { /*/
                 zval ** row_ptr;
@@ -762,12 +765,12 @@ int switch_dbx_getcolumntype(zval ** rv, zval ** result_handle, long column_inde
     return 0;
     }
 
-int switch_dbx_getrow(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
+int switch_dbx_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
     /*/ returns array[0..columncount-1] as strings on success or 0 as long on failure /*/
     switch ((*dbx_module)->value.lval) {
-        case DBX_MYSQL: return dbx_mysql_getrow(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);        
-        case DBX_ODBC: return dbx_odbc_getrow(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);        
-        case DBX_PGSQL: return dbx_pgsql_getrow(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);        
+        case DBX_MYSQL: return dbx_mysql_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);        
+        case DBX_ODBC: return dbx_odbc_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);        
+        case DBX_PGSQL: return dbx_pgsql_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);        
         }
     zend_error(E_WARNING, "dbx_getrow: not supported in this module");
     return 0;
index 3a964642a4b0187685084a7cd34418aee611575d..bf067f77cfc5c637732c921a7c374085daf52139 100644 (file)
@@ -104,6 +104,10 @@ SOURCE=.\dbx_mysql.c
 \r
 SOURCE=.\dbx_odbc.c\r
 # End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\dbx_pgsql.c\r
+# End Source File\r
 # End Group\r
 # Begin Group "Header Files"\r
 \r
@@ -122,6 +126,10 @@ SOURCE=.\dbx_odbc.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\dbx_pgsql.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\php_dbx.h\r
 # End Source File\r
 # End Group\r
index 1a4354dfe91aca7dfb02d4d6dbda4688129414fa..0d2d300424ba33b3c2599fb1e17896cf16d6f099 100644 (file)
@@ -174,7 +174,7 @@ int dbx_mysql_getcolumntype(zval ** rv, zval ** result_handle, long column_index
     return 1;
     }
 
-int dbx_mysql_getrow(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS) {
+int dbx_mysql_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS) {
     /*/ returns array[0..columncount-1] as strings on success or 0 as long on failure /*/
     int number_of_arguments=2;
     zval ** arguments[2];
index e68f66d30fa41750a0de69ac7ace722375e8d9ef..1f36383cfe52ec6fd14f87f7ca72c875be617d12 100644 (file)
@@ -43,7 +43,7 @@ int dbx_mysql_getcolumnname(zval ** rv, zval ** result_handle, long column_index
     /*/ returns column-name as string on success or 0 as long on failure /*/
 int dbx_mysql_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
     /*/ returns column-type as string on success or 0 as long on failure /*/
-int dbx_mysql_getrow(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS);
+int dbx_mysql_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
     /*/ returns array[0..columncount-1] as strings on success or 0 as long on failure /*/
 int dbx_mysql_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
     /*/ returns string /*/
index dd39b54b12a0f21d5a364895e2382bf7d0db2939..290ea0882122ee3fcba53d7b8c7952b9bef95a90 100644 (file)
@@ -173,7 +173,7 @@ int dbx_odbc_getcolumntype(zval ** rv, zval ** result_handle, long column_index,
     return 1;
     }
 
-int dbx_odbc_getrow(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS) {
+int dbx_odbc_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS) {
     /*/ returns array[0..columncount-1] as strings on success or 0 as long on failure /*/
     int number_of_arguments;
     zval ** arguments[2];
index c08832776fc3ec4cf8e7022eede77a9b053c7013..ffa20f4b8b4bc20240ce2ac251a862f1d93e7696 100644 (file)
@@ -43,7 +43,7 @@ int dbx_odbc_getcolumnname(zval ** rv, zval ** result_handle, long column_index,
     /*/ returns column-name as string on success or 0 as long on failure /*/
 int dbx_odbc_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
     /*/ returns column-type as string on success or 0 as long on failure /*/
-int dbx_odbc_getrow(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS);
+int dbx_odbc_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
     /*/ returns array[0..columncount-1] as strings on success or 0 as long on failure /*/
 int dbx_odbc_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
     /*/ returns string /*/
index b94b176616b328b568f5346e305809a6d925a69d..bc0bbd6214c5fd1e74bc493c815bbf6fa9ac5b9f 100644 (file)
 #include "php_dbx.h"
 #include "dbx_pgsql.h"
 #include <string.h>
-
+/*
 #ifdef ZTS
 extern int dbx_globals_id;
 #else
 extern ZEND_DBX_API zend_dbx_globals dbx_globals;
 #endif
-
+*/
 #define PGSQL_ASSOC            1<<0
 #define PGSQL_NUM              1<<1
 
@@ -153,7 +153,7 @@ int dbx_pgsql_query(zval ** rv, zval ** dbx_handle, zval ** sql_statement, INTER
                return 0;
        }
     MOVE_RETURNED_TO_RV(rv, returned_zval);
-
+/*
        if(strstr(Z_STRVAL_PP(sql_statement), "SELECT") ||
           strstr(Z_STRVAL_PP(sql_statement), "select")){
                DBXG(row_count) = 0;
@@ -163,7 +163,7 @@ int dbx_pgsql_query(zval ** rv, zval ** dbx_handle, zval ** sql_statement, INTER
                dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_numrows", &num_rows_zval, nargs, args);
                DBXG(num_rows) = Z_LVAL_P(num_rows_zval);
        } 
-
+*/
     return 1;
 }
 
@@ -229,7 +229,7 @@ int dbx_pgsql_getcolumntype(zval ** rv, zval ** result_handle, long column_index
     return 1;
 }
 
-int dbx_pgsql_getrow(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS) {
+int dbx_pgsql_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS) {
     /* returns array[0..columncount-1] as strings on success or 0 
           as long on failure */
     int number_of_arguments=2;
@@ -238,13 +238,15 @@ int dbx_pgsql_getrow(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAME
     zval * returned_zval=NULL;
        
     MAKE_STD_ZVAL(zval_row);
-    ZVAL_LONG(zval_row, DBXG(row_count));
+    ZVAL_LONG(zval_row, row_number);
     arguments[0]=result_handle;
     arguments[1]=&zval_row;
+/*
        DBXG(row_count)++;
        if (DBXG(row_count)>DBXG(num_rows)){
                return 0;
        }
+*/
     dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_fetch_array", &returned_zval, number_of_arguments, arguments);
     if (!returned_zval || returned_zval->type!=IS_ARRAY) {
         if (returned_zval) zval_ptr_dtor(&returned_zval);
index 70c342fa15a1388d2e5fd4957d56a4303154142b..6c267fa2195eca048f3dc84837bb029e69efa680 100644 (file)
@@ -39,7 +39,7 @@ int dbx_pgsql_getcolumnname(zval ** rv, zval ** result_handle, long column_index
     /*/ returns column-name as string on success or 0 as long on failure /*/
 int dbx_pgsql_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
     /*/ returns column-type as string on success or 0 as long on failure /*/
-int dbx_pgsql_getrow(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS);
+int dbx_pgsql_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
     /*/ returns array[0..columncount-1] as strings on success or 0 as long on failure /*/
 int dbx_pgsql_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
     /*/ returns string /*/
index cb6a8acdcc920587cad27b36167a24d40f58912b..6240b953fc8a8ce11ebedccc52c8c4ec2bef6f08 100644 (file)
@@ -58,11 +58,12 @@ ZEND_FUNCTION(dbx_test);
        Declare any global variables you may need between the BEGIN
        and END macros here:     
 */
+/*
 ZEND_BEGIN_MODULE_GLOBALS(dbx)
         int row_count;
         int num_rows;
 ZEND_END_MODULE_GLOBALS(dbx)
-
+*/
 /* In every function that needs to use variables in php_dbx_globals,
    do call dbxLS_FETCH(); after declaring other variables used by
    that function, and always refer to them as dbxG(variable).