[PHP-CVS] cvs: php-src /ext/dbx dbx_oci8.c dbx_pgsql.c

2004-05-06 Thread Marc Boeren
mboeren Thu May  6 08:22:14 2004 EDT

  Modified files:  
/php-src/ext/dbxdbx_oci8.c dbx_pgsql.c 
  Log:
  Call functions by their new, proper names instead of what are now aliases.
  Change OCIFetchInto (deprecated) to oci_fetch_array.
  
  http://cvs.php.net/diff.php/php-src/ext/dbx/dbx_oci8.c?r1=1.17&r2=1.18&ty=u
Index: php-src/ext/dbx/dbx_oci8.c
diff -u php-src/ext/dbx/dbx_oci8.c:1.17 php-src/ext/dbx/dbx_oci8.c:1.18
--- php-src/ext/dbx/dbx_oci8.c:1.17 Thu Jan  8 03:15:09 2004
+++ php-src/ext/dbx/dbx_oci8.c  Thu May  6 08:22:14 2004
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx_oci8.c,v 1.17 2004/01/08 08:15:09 andi Exp $ */
+/* $Id: dbx_oci8.c,v 1.18 2004/05/06 12:22:14 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_oci8.h"
@@ -40,7 +40,7 @@
arguments[0]=username;
arguments[1]=password;
arguments[2]=db;
-   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCILogon", 
&returned_zval, number_of_arguments, arguments);
+   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "oci_connect", 
&returned_zval, number_of_arguments, arguments);
if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
if (returned_zval) zval_ptr_dtor(&returned_zval);
return 0;
@@ -59,7 +59,7 @@
arguments[0]=username;
arguments[1]=password;
arguments[2]=db;
-   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIPLogon", 
&returned_zval, number_of_arguments, arguments);
+   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "oci_pconnect", 
&returned_zval, number_of_arguments, arguments);
if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
if (returned_zval) zval_ptr_dtor(&returned_zval);
return 0;
@@ -71,14 +71,14 @@
 int dbx_oci8_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
 {
/* returns 1 as long on success or 0 as long on failure */
-   /* actually, ocilogoff officially does nothing, so what should I return? */
+   /* actually, oci_close officially does nothing, so what should I return? */
/* I will just return NULL right now and change the test accordingly */
int number_of_arguments=1;
zval **arguments[1];
zval *returned_zval=NULL;
 
arguments[0]=dbx_handle;
-   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCILogOff", 
&returned_zval, number_of_arguments, arguments);
+   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "oci_close", 
&returned_zval, number_of_arguments, arguments);
if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_BOOL) {
if (returned_zval) zval_ptr_dtor(&returned_zval);
return 0;
@@ -98,16 +98,16 @@
 
arguments[0]=dbx_handle;
arguments[1]=sql_statement;
-   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIParse", 
&returned_zval, number_of_arguments, arguments);
-   /* OCIParse returns a bool for failure, or a statement_identifier for valid 
sql_statements */
+   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "oci_parse", 
&returned_zval, number_of_arguments, arguments);
+   /* oci_parse returns a bool for failure, or a statement_identifier for valid 
sql_statements */
if (!returned_zval || (Z_TYPE_P(returned_zval)!=IS_BOOL && 
Z_TYPE_P(returned_zval)!=IS_RESOURCE)) {
if (returned_zval) zval_ptr_dtor(&returned_zval);
return 0;
}
number_of_arguments=1;
arguments[0]=&returned_zval;
-   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIExecute", 
&execute_zval, number_of_arguments, arguments);
-   /* OCIExecute returns a bool for success or failure */
+   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "oci_execute", 
&execute_zval, number_of_arguments, arguments);
+   /* oci_execute returns a bool for success or failure */
if (!execute_zval || Z_TYPE_P(execute_zval)!=IS_BOOL || 
Z_BVAL_P(execute_zval)==0) {
if (execute_zval) zval_ptr_dtor(&execute_zval);
zval_ptr_dtor(&returned_zval);
@@ -115,8 +115,8 @@
}
number_of_arguments=1;
arguments[0]=&returned_zval;
-   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "OCIStatementType", 
&statementtype_zval, number_of_arguments, arguments);
-   /* OCIStatementType returns a string. 'SELECT' means there are results */
+   dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "oci_statement_type", 
&statementtype_zval, number_of_arguments, arguments);
+   /* oci_statement_type returns a string. 'SELECT' means there are results */
if (!statementtype_zval || Z_TYPE_P(statementtype_zval)!=IS_STRING) {
if (statementtype_zval) zval_ptr_dtor(&statementtype_zval);
if (execute_zval

[PHP-CVS] cvs: php-src /ext/dbx dbx.c

2003-11-03 Thread Marc Boeren
mboeren Mon Nov  3 06:15:24 2003 EDT

  Modified files:  
/php-src/ext/dbxdbx.c 
  Log:
  Make life for the doc-team easier, without causing harm ;-)
  
  
Index: php-src/ext/dbx/dbx.c
diff -u php-src/ext/dbx/dbx.c:1.55 php-src/ext/dbx/dbx.c:1.56
--- php-src/ext/dbx/dbx.c:1.55  Mon Sep  8 03:19:08 2003
+++ php-src/ext/dbx/dbx.c   Mon Nov  3 06:15:23 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx.c,v 1.55 2003/09/08 07:19:08 mboeren Exp $ */
+/* $Id: dbx.c,v 1.56 2003/11/03 11:15:23 mboeren Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -365,7 +365,7 @@
 }
 /* }}} */
 
-/* {{{ proto dbx_result_object dbx_query(dbx_link_object dbx_link, string 
sql_statement [, long flags])
+/* {{{ proto dbx_result_object dbx_query(dbx_link_object dbx_link, string 
sql_statement [, int flags])
Returns a dbx_link_object on success and returns 0 on failure */
 ZEND_FUNCTION(dbx_query)
 {

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



[PHP-CVS] cvs: php-src /ext/dbx dbx.c dbx.h php_dbx.h

2003-09-08 Thread Marc Boeren
mboeren Mon Sep  8 03:19:08 2003 EDT

  Modified files:  
/php-src/ext/dbxdbx.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 assi

RE: [PHP-CVS] cvs: php-src / NEWS

2003-09-05 Thread Marc Boeren

> >   Added updates to dbx module to NEWS by hand as @ doesn't work
> >   according to Jani (since when is this?).

> since a long time now.

Slipped by me then :-)
BTW, someone better update README.CVS-RULES too then?

> Btw. why not group the dbx entries as we normally do
> if several things are dded/improved in one area.

This change would still amount to 2 lines and I already grouped it with the
SQLite support... but feel free :-)

Cheeroi, Marc.

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



[PHP-CVS] cvs: php-src / NEWS

2003-09-05 Thread Marc Boeren
mboeren Fri Sep  5 08:14:58 2003 EDT

  Modified files:  
/php-srcNEWS 
  Log:
  Added updates to dbx module to NEWS by hand as @ doesn't work
  according to Jani (since when is this?).
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1463 php-src/NEWS:1.1464
--- php-src/NEWS:1.1463 Thu Aug 28 12:06:49 2003
+++ php-src/NEWSFri Sep  5 08:14:57 2003
@@ -24,6 +24,8 @@
 - Added "resume_pos" context option to "ftp://"; wrapper. (Sara)
 - Added optional parameter to OCIWriteTemporaryLob() to specify the type of LOB
   (Patch by Novicky Marek <[EMAIL PROTECTED]>). (Thies)
+- Added DBX_RESULT_UNBUFFERED flag for dbx_query. (Marc)
+- Added dbx_fetch_row() function to DBX. (Marc)
 - Added SQLite support to DBX. (Marc)
 - Added reflection API. (Andrei, George, Timm)
 - Fixed support for  fields within XML documents in ext/xml. 

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



[PHP-CVS] cvs: php-src /ext/dbx dbx.c dbx.h php_dbx.h /ext/dbx/tests 002.phpt 005.phpt 010.phpt

2003-09-05 Thread Marc Boeren
mboeren Fri Sep  5 04:39:27 2003 EDT

  Added files: 
/php-src/ext/dbx/tests  010.phpt 

  Modified files:  
/php-src/ext/dbxdbx.c dbx.h php_dbx.h 
/php-src/ext/dbx/tests  002.phpt 005.phpt 
  Log:
  Added DBX_RESULT_UNBUFFERED flag for dbx_query.
  Added dbx_fetch_row() function.
  Added/updated tests for both.
  @Added DBX_RESULT_UNBUFFERED flag for dbx_query. (Marc)
  @Added dbx_fetch_row() function. (Marc)
  
  Index: php-src/ext/dbx/dbx.c
diff -u php-src/ext/dbx/dbx.c:1.53 php-src/ext/dbx/dbx.c:1.54
--- php-src/ext/dbx/dbx.c:1.53  Thu Jul 10 04:34:03 2003
+++ php-src/ext/dbx/dbx.c   Fri Sep  5 04:39:25 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx.c,v 1.53 2003/07/10 08:34:03 mboeren Exp $ */
+/* $Id: dbx.c,v 1.54 2003/09/05 08:39:25 mboeren Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -100,6 +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;
+}
+
 /* 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)
 {
@@ -149,6 +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_error,  NULL)
ZEND_FE(dbx_escape_string,  NULL)
 
@@ -197,6 +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_COLNAMES_UNCHANGED", DBX_COLNAMES_UNCHANGED, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DBX_COLNAMES_UPPERCASE", DBX_COLNAMES_UPPERCASE, 
CONST_CS | CONST_PERSISTENT);
@@ -231,7 +247,7 @@
 {
php_info_print_table_start();
php_info_print_table_row(2, "dbx support", "enabled");
-   php_info_print_table_row(2, "dbx version", "1.0.1");
+   php_info_print_table_row(2, "dbx version", "1.1.0");
php_info_print_table_row(2, "supported databases", 
"MySQL\nODBC\nPostgreSQL\nMicrosoft SQL Server\nFrontBase\nOracle 8 
(oci8)\nSybase-CT\nSQLite");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
@@ -395,11 +411,12 @@
convert_to_long_ex(arguments[2]);
query_flags = Z_LVAL_PP(arguments[2]);
/* fieldnames are needed for association! */
-   result_flags = (query_flags & DBX_RESULT_INFO) | (query_flags & 
DBX_RESULT_INDEX) | (query_flags & DBX_RESULT_ASSOC);
+   result_flags = (query_flags & DBX_RESULT_INFO) | (query_flags & 
DBX_RESULT_INDEX) | (query_flags & DBX_RESULT_ASSOC) | (query_flags & 
DBX_RESULT_UNBUFFERED);
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) {
colcase = DBX_COLNAMES_UNCHANGED;
@@ -427,8 +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!)
+ */
+   

[PHP-CVS] cvs: php-src /ext/dbx/tests 003.phpt dbx_test.p

2003-08-14 Thread Marc Boeren
mboeren Wed Aug 13 03:54:31 2003 EDT

  Modified files:  
/php-src/ext/dbx/tests  003.phpt dbx_test.p 
  Log:
  Remove special-case from test for SQLite persistent connections.
  
  
Index: php-src/ext/dbx/tests/003.phpt
diff -u php-src/ext/dbx/tests/003.phpt:1.6 php-src/ext/dbx/tests/003.phpt:1.7
--- php-src/ext/dbx/tests/003.phpt:1.6  Wed Jul  9 12:31:40 2003
+++ php-src/ext/dbx/tests/003.phpt  Wed Aug 13 03:54:31 2003
@@ -49,18 +49,14 @@
 }
 }
 
-if ($module != DBX_SQLITE) { // skip persistent tests for sqlite until that bug is 
solved
-
 $dlo = dbx_connect($module_name, $host, $database, $username, $password, 
DBX_PERSISTENT);
 if ($dlo!=0) {
print('persistent connect using string ok'."\n");
-var_dump($dlo->handle);
dbx_close($dlo);
}
 $dlo = dbx_connect($module, $host, $database, $username, $password, DBX_PERSISTENT);
 if ($dlo!=0) {
print('persistent connect using constant ok'."\n");
-var_dump($dlo->handle);
dbx_close($dlo);
}
 // sqlite is a special case as it will just create a db if it isn't found
@@ -77,22 +73,20 @@
 dbx_close($dlo);
 }
 }
-$dlo = @dbx_connect($module, $host, $database, $nonexisting_username, 
$nonexisting_password, DBX_PERSISTENT);
-if ($dlo==0) {
-   print('persistent connect with false username/password combi failed, so it\'s 
ok'."\n");
-   }
-else {
-print_r($dlo);
-   dbx_close($dlo);
+// sqlite is a special case as it doesn't use user/password restrictions
+if ($module == DBX_SQLITE) {
+print('persistent connect with false username/password combi failed, so it\'s 
ok'."\n");
 }
-
-}  // skip persistent tests for sqlite until that bug is solved
 else {
-   print('persistent connect using string ok'."\n");
-   print('persistent connect using constant ok'."\n");
-print('persistent connect to non-existing database failed, so it\'s ok'."\n");
-   print('persistent connect with false username/password combi failed, so it\'s 
ok'."\n");
-}
+$dlo = @dbx_connect($module, $host, $database, $nonexisting_username, 
$nonexisting_password, DBX_PERSISTENT);
+if ($dlo==0) {
+print('persistent connect with false username/password combi failed, so it\'s 
ok'."\n");
+}
+else {
+print_r($dlo);
+dbx_close($dlo);
+}
+}
 
 $dlo = @dbx_connect($module, $host, $database, $username, $password, DBX_PERSISTENT, 
"12many");
 if ($dlo==0) {
Index: php-src/ext/dbx/tests/dbx_test.p
diff -u php-src/ext/dbx/tests/dbx_test.p:1.10 php-src/ext/dbx/tests/dbx_test.p:1.11
--- php-src/ext/dbx/tests/dbx_test.p:1.10   Wed Jul  9 12:31:40 2003
+++ php-src/ext/dbx/tests/dbx_test.pWed Aug 13 03:54:31 2003
@@ -63,7 +63,7 @@
 case DBX_SQLITE:
 $module=DBX_SQLITE;
 $host="";
-$database="ext\\dbx\\tests\\dbx_test.sqlite.db";
+$database="dbx_test.sqlite.db";
 $username="";
 $password="";
 $module_name="sqlite";



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



[PHP-CVS] cvs: php-src /ext/dbx dbx.c

2003-07-10 Thread Marc Boeren
mboeren Thu Jul 10 04:34:03 2003 EDT

  Modified files:  
/php-src/ext/dbxdbx.c 
  Log:
  WS
  
  
Index: php-src/ext/dbx/dbx.c
diff -u php-src/ext/dbx/dbx.c:1.52 php-src/ext/dbx/dbx.c:1.53
--- php-src/ext/dbx/dbx.c:1.52  Thu Jul 10 04:25:58 2003
+++ php-src/ext/dbx/dbx.c   Thu Jul 10 04:34:03 2003
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx.c,v 1.52 2003/07/10 08:25:58 mboeren Exp $ */
+/* $Id: dbx.c,v 1.53 2003/07/10 08:34:03 mboeren Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -159,7 +159,7 @@
 };
 
 zend_module_entry dbx_module_entry = {
-STANDARD_MODULE_HEADER,
+   STANDARD_MODULE_HEADER,
"dbx",
dbx_functions,
ZEND_MINIT(dbx),
@@ -167,7 +167,7 @@
NULL, /*ZEND_RINIT(dbx), Replace with NULL if there's nothing to do at 
request start */
NULL, /*ZEND_RSHUTDOWN(dbx), Replace with NULL if there's nothing to do at 
request end */
ZEND_MINFO(dbx),
-NO_VERSION_YET,
+   NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
 };
 
@@ -176,12 +176,12 @@
 #endif
 
 ZEND_INI_BEGIN()
-ZEND_INI_ENTRY("dbx.colnames_case", "unchanged", ZEND_INI_SYSTEM, NULL)
+   ZEND_INI_ENTRY("dbx.colnames_case", "unchanged", ZEND_INI_SYSTEM, NULL)
 ZEND_INI_END()
 
 ZEND_MINIT_FUNCTION(dbx)
 {
-REGISTER_INI_ENTRIES();
+   REGISTER_INI_ENTRIES();
 
REGISTER_LONG_CONSTANT("DBX_MYSQL", DBX_MYSQL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DBX_ODBC", DBX_ODBC, CONST_CS | CONST_PERSISTENT);
@@ -213,7 +213,7 @@
 
 ZEND_MSHUTDOWN_FUNCTION(dbx)
 {
-UNREGISTER_INI_ENTRIES();
+   UNREGISTER_INI_ENTRIES();
return SUCCESS;
 }
 
@@ -234,7 +234,7 @@
php_info_print_table_row(2, "dbx version", "1.0.1");
php_info_print_table_row(2, "supported databases", 
"MySQL\nODBC\nPostgreSQL\nMicrosoft SQL Server\nFrontBase\nOracle 8 
(oci8)\nSybase-CT\nSQLite");
php_info_print_table_end();
-DISPLAY_INI_ENTRIES();
+   DISPLAY_INI_ENTRIES();
 }
 
 /*



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



[PHP-CVS] cvs: php-src /ext/dbx dbx.c dbx.h dbx_fbsql.c dbx_fbsql.h dbx_mssql.c dbx_mssql.h dbx_mysql.c dbx_mysql.h dbx_oci8.c dbx_oci8.h dbx_odbc.c dbx_odbc.h dbx_sqlite.c dbx_sqlite.h dbx_sybasect.c dbx_sybasect.h php_dbx.h

2003-07-10 Thread Marc Boeren
mboeren Thu Jul 10 04:25:58 2003 EDT

  Modified files:  
/php-src/ext/dbxdbx.c dbx.h dbx_fbsql.c dbx_fbsql.h dbx_mssql.c 
dbx_mssql.h dbx_mysql.c dbx_mysql.h dbx_oci8.c 
dbx_oci8.h dbx_odbc.c dbx_odbc.h dbx_sqlite.c 
dbx_sqlite.h dbx_sybasect.c dbx_sybasect.h 
php_dbx.h 
  Log:
  Add -2003 to copyright line (Marc).
  
  Index: php-src/ext/dbx/dbx.c
diff -u php-src/ext/dbx/dbx.c:1.51 php-src/ext/dbx/dbx.c:1.52
--- php-src/ext/dbx/dbx.c:1.51  Wed Jul  9 12:31:40 2003
+++ php-src/ext/dbx/dbx.c   Thu Jul 10 04:25:58 2003
@@ -6,7 +6,7 @@
+--+
| dbx module version 1.0   |
+--+
-   | Copyright (c) 2001 Guidance Rotterdam BV |
+   | Copyright (c) 2001-2003 Guidance Rotterdam BV|
+--+
| This source file is subject to version 3.0 of the PHP license,   |
| that is bundled with this package in the file LICENSE, and is|
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx.c,v 1.51 2003/07/09 16:31:40 mboeren Exp $ */
+/* $Id: dbx.c,v 1.52 2003/07/10 08:25:58 mboeren Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
Index: php-src/ext/dbx/dbx.h
diff -u php-src/ext/dbx/dbx.h:1.13 php-src/ext/dbx/dbx.h:1.14
--- php-src/ext/dbx/dbx.h:1.13  Tue Jun 10 16:03:27 2003
+++ php-src/ext/dbx/dbx.h   Thu Jul 10 04:25:58 2003
@@ -6,7 +6,7 @@
+--+
| dbx module version 1.0   |
+--+
-   | Copyright (c) 2001 Guidance Rotterdam BV |
+   | Copyright (c) 2001-2003 Guidance Rotterdam BV|
+--+
| This source file is subject to version 3.0 of the PHP license,   |
| that is bundled with this package in the file LICENSE, and is|
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx.h,v 1.13 2003/06/10 20:03:27 imajes Exp $ */
+/* $Id: dbx.h,v 1.14 2003/07/10 08:25:58 mboeren Exp $ */
 
 #ifndef ZEND_DBX_H
 #define ZEND_DBX_H
Index: php-src/ext/dbx/dbx_fbsql.c
diff -u php-src/ext/dbx/dbx_fbsql.c:1.12 php-src/ext/dbx/dbx_fbsql.c:1.13
--- php-src/ext/dbx/dbx_fbsql.c:1.12Fri Jun 13 23:33:38 2003
+++ php-src/ext/dbx/dbx_fbsql.c Thu Jul 10 04:25:58 2003
@@ -6,7 +6,7 @@
+--+
| dbx module version 1.0   |
+--+
-   | Copyright (c) 2001 Guidance Rotterdam BV |
+   | Copyright (c) 2001-2003 Guidance Rotterdam BV|
+--+
| This source file is subject to version 3.0 of the PHP license,   |
| that is bundled with this package in the file LICENSE, and is|
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: dbx_fbsql.c,v 1.12 2003/06/14 03:33:38 fmk Exp $ */
+/* $Id: dbx_fbsql.c,v 1.13 2003/07/10 08:25:58 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_fbsql.h"
Index: php-src/ext/dbx/dbx_fbsql.h
diff -u php-src/ext/dbx/dbx_fbsql.h:1.9 php-src/ext/dbx/dbx_fbsql.h:1.10
--- php-src/ext/dbx/dbx_fbsql.h:1.9 Fri Jun 13 23:33:38 2003
+++ php-src/ext/dbx/dbx_fbsql.h Thu Jul 10 04:25:58 2003
@@ -6,7 +6,7 @@
+--+
| dbx module version 1.0   |
+--+
-   | Copyright (c) 2001 Guidance Rotterdam BV |
+   | Copyright (c) 2001-2003 Guidance Rotterdam BV|
+--+
| This source file is subject to version 3.0 of the PHP license,   |
| that is bundled with this package in the file LICENSE, and is|
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: dbx_fbsql.h,v 1.9 2003/06/14 03:33:38 fmk Exp $ */
+/* $Id: dbx_fbsql.h,v 1.10 2003/07/10 08:25:58 mboeren Exp $ */
 
 #ifndef ZEND_DBX_FBSQL_H
 #define ZEND_DBX_FBSQL_H
Index: php-src/ext/dbx/dbx_mssql.c
diff -u php-src/ext/dbx/dbx_mssql.c:1.14 ph

[PHP-CVS] cvs: php-src /ext/dbx config.m4 dbx.c dbx.dsp dbx_sqlite.c dbx_sqlite.h /ext/dbx/tests 002.phpt 003.phpt 004.phpt 006.phpt dbx_test.p

2003-07-09 Thread Marc Boeren
+$dlo = @dbx_connect($module, $host, $nonexisting_database, $username, $password, 
DBX_PERSISTENT);
+if ($dlo==0) {
+print('persistent connect to non-existing database failed, so it\'s ok'."\n");
+}
+else {
+print_r($dlo);
+dbx_close($dlo);
+}
 }
 $dlo = @dbx_connect($module, $host, $database, $nonexisting_username, 
$nonexisting_password, DBX_PERSISTENT);
 if ($dlo==0) {
@@ -62,6 +85,15 @@
 print_r($dlo);
dbx_close($dlo);
 }
+
+}  // skip persistent tests for sqlite until that bug is solved
+else {
+   print('persistent connect using string ok'."\n");
+   print('persistent connect using constant ok'."\n");
+print('persistent connect to non-existing database failed, so it\'s ok'."\n");
+   print('persistent connect with false username/password combi failed, so it\'s 
ok'."\n");
+}
+
 $dlo = @dbx_connect($module, $host, $database, $username, $password, DBX_PERSISTENT, 
"12many");
 if ($dlo==0) {
print('too many parameters: connect failure works ok'."\n");
@@ -85,12 +117,18 @@
dbx_close($dlo1);
dbx_close($dlo2);
}
-$dlo1 = dbx_connect($module, $host, $database, $username, $password);
-$dlo2 = @dbx_connect($module, $host, $nonexisting_database, $username, $password);
-if ($dlo1!=0 && $dlo2==0) {
+// sqlite is a special case as it will just create a db if it isn't found
+if ($module == DBX_SQLITE) {
 print('multiple connects (2nd fails on database-name) ok'."\n");
-   dbx_close($dlo1);
-   }
+}
+else {
+$dlo1 = dbx_connect($module, $host, $database, $username, $password);
+$dlo2 = @dbx_connect($module, $host, $nonexisting_database, $username, $password);
+if ($dlo1!=0 && $dlo2==0) {
+print('multiple connects (2nd fails on database-name) ok'."\n");
+dbx_close($dlo1);
+}
+}
 ?>
 --EXPECT--
 connect using string ok
Index: php-src/ext/dbx/tests/004.phpt
diff -u php-src/ext/dbx/tests/004.phpt:1.4 php-src/ext/dbx/tests/004.phpt:1.5
--- php-src/ext/dbx/tests/004.phpt:1.4  Thu Oct 24 15:34:18 2002
+++ php-src/ext/dbx/tests/004.phpt  Wed Jul  9 12:31:40 2003
@@ -8,7 +8,7 @@
 

Index: php-src/ext/dbx/dbx_sqlite.c
+++ php-src/ext/dbx/dbx_sqlite.c
/*
   +--+
   | PHP Version 4|
   +--+
   | Copyright (c) 1997-2003 The PHP Group|
   +--+
   | dbx module version 1.0   |
   +--+
   | Copyright (c) 2001 Guidance Rotterdam BV |
   +--+
   | This source file is subject to version 3.0 of the PHP license,   |
   | that is bundled with this package in the file LICENSE, and is|
   | available through the world-wide-web at the following url:   |
   | http://www.php.net/license/3_0.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  |
   | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
   +--+
   | Author : Marc Boeren <[EMAIL PROTECTED]>  |
   +--+
*/

/* $Id: dbx_sqlite.c,v 1.1 2003/07/09 16:31:40 mboeren Exp $ */

#include "dbx.h"
#include "dbx_sqlite.h"

#define SQLITE_ASSOC 1
#define SQLITE_NUM   2
#define SQLITE_BOTH  3

int dbx_sqlite_connect(zval **rv, zval **host, zval **db, zval **username, zval 
**password, INTERNAL_FUNCTION_PARAMETERS)
{
/* returns connection handle as resource on success or 0 as long on failure */
int number_of_arguments=1;
zval **arguments[1];
zval *returned_zval=NULL;

arguments[0]=db;
dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "sqlite_open", 
&returned_zval, number_of_arguments, arguments);
if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
if (returned_zval) zval_ptr_dtor(&returned_zval);
return 0;
}

MOVE_RETURNED_TO_RV(rv, returned_zval);
return 1;
}

int dbx_sqlite_pconnect(zval **rv, zval **host, zval **db, zval **username, zval 
**password, INTERNAL_FUNCTION_PARAMETERS)
{
/* returns persist

[PHP-CVS] cvs: php4(PHP_4_3) /ext/dbx dbx_pgsql.c

2003-02-19 Thread Marc Boeren
mboeren Wed Feb 19 11:52:05 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/dbx   dbx_pgsql.c 
  Log:
  MFH: Fix for bug #1
  
  
Index: php4/ext/dbx/dbx_pgsql.c
diff -u php4/ext/dbx/dbx_pgsql.c:1.20.2.1 php4/ext/dbx/dbx_pgsql.c:1.20.2.2
--- php4/ext/dbx/dbx_pgsql.c:1.20.2.1   Tue Dec 31 11:34:24 2002
+++ php4/ext/dbx/dbx_pgsql.cWed Feb 19 11:52:05 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: dbx_pgsql.c,v 1.20.2.1 2002/12/31 16:34:24 sebastian Exp $ */
+/* $Id: dbx_pgsql.c,v 1.20.2.2 2003/02/19 16:52:05 mboeren Exp $ */
 
 #include "dbx.h"
 #include "php_dbx.h"
@@ -228,31 +228,17 @@
 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;
-   int save_error_reporting=0;
-   zval **arguments[2];
-   zval *zval_row=NULL;
+   int number_of_arguments=1;
+   zval **arguments[1];
zval *returned_zval=NULL;

-   MAKE_STD_ZVAL(zval_row);
-   ZVAL_LONG(zval_row, row_number);
arguments[0]=result_handle;
-   arguments[1]=&zval_row;
 
-   if (EG(error_reporting) & E_WARNING){
-   save_error_reporting = EG(error_reporting);
-   EG(error_reporting) &= ~E_WARNING;
-   }
dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_fetch_array", 
&returned_zval, number_of_arguments, arguments);
-   if (save_error_reporting) {
-   EG(error_reporting) = save_error_reporting;
-   }
if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) {
if (returned_zval) zval_ptr_dtor(&returned_zval);
-   FREE_ZVAL(zval_row);
return 0;
}
-   FREE_ZVAL(zval_row);
MOVE_RETURNED_TO_RV(rv, returned_zval);
return 1;
 }



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




[PHP-CVS] cvs: php4 /ext/dbx dbx_pgsql.c

2003-02-19 Thread Marc Boeren
mboeren Wed Feb 19 08:32:28 2003 EDT

  Modified files:  
/php4/ext/dbx   dbx_pgsql.c 
  Log:
  Fix for bug #1: pgsql version for dbx_query suppressed a warning that
  was trappable by using a user-defined error-handler. A different use of
  pgsql_getrow removed the warning and thus the need for suppressing it.
  
  
Index: php4/ext/dbx/dbx_pgsql.c
diff -u php4/ext/dbx/dbx_pgsql.c:1.21 php4/ext/dbx/dbx_pgsql.c:1.22
--- php4/ext/dbx/dbx_pgsql.c:1.21   Tue Dec 31 11:06:28 2002
+++ php4/ext/dbx/dbx_pgsql.cWed Feb 19 08:32:27 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: dbx_pgsql.c,v 1.21 2002/12/31 16:06:28 sebastian Exp $ */
+/* $Id: dbx_pgsql.c,v 1.22 2003/02/19 13:32:27 mboeren Exp $ */
 
 #include "dbx.h"
 #include "php_dbx.h"
@@ -228,31 +228,17 @@
 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;
-   int save_error_reporting=0;
-   zval **arguments[2];
-   zval *zval_row=NULL;
+   int number_of_arguments=1;
+   zval **arguments[1];
zval *returned_zval=NULL;

-   MAKE_STD_ZVAL(zval_row);
-   ZVAL_LONG(zval_row, row_number);
arguments[0]=result_handle;
-   arguments[1]=&zval_row;
 
-   if (EG(error_reporting) & E_WARNING){
-   save_error_reporting = EG(error_reporting);
-   EG(error_reporting) &= ~E_WARNING;
-   }
dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_fetch_array", 
&returned_zval, number_of_arguments, arguments);
-   if (save_error_reporting) {
-   EG(error_reporting) = save_error_reporting;
-   }
if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_ARRAY) {
if (returned_zval) zval_ptr_dtor(&returned_zval);
-   FREE_ZVAL(zval_row);
return 0;
}
-   FREE_ZVAL(zval_row);
MOVE_RETURNED_TO_RV(rv, returned_zval);
return 1;
 }



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




[PHP-CVS] cvs: php4 /ext/dbx dbx_fbsql.c dbx_mssql.c dbx_mysql.c dbx_oci8.c dbx_odbc.c dbx_pgsql.c dbx_sybasect.c

2002-10-30 Thread Marc Boeren
mboeren Wed Oct 30 10:03:02 2002 EDT

  Modified files:  
/php4/ext/dbx   dbx_fbsql.c dbx_mssql.c dbx_mysql.c dbx_oci8.c 
dbx_odbc.c dbx_pgsql.c dbx_sybasect.c 
  Log:
  Coding style.
  # not my style :-)
  
  
Index: php4/ext/dbx/dbx_fbsql.c
diff -u php4/ext/dbx/dbx_fbsql.c:1.8 php4/ext/dbx/dbx_fbsql.c:1.9
--- php4/ext/dbx/dbx_fbsql.c:1.8Wed Oct 30 07:02:49 2002
+++ php4/ext/dbx/dbx_fbsql.cWed Oct 30 10:03:00 2002
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: dbx_fbsql.c,v 1.8 2002/10/30 12:02:49 mboeren Exp $ */
+/* $Id: dbx_fbsql.c,v 1.9 2002/10/30 15:03:00 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_fbsql.h"
@@ -262,7 +262,7 @@
if (Z_STRLEN_PP(string) == 0) {
ZVAL_EMPTY_STRING(*rv);
return 1;
-   }
+   }
tmpstr = estrdup(Z_STRVAL_PP(string));
tmplen = Z_STRLEN_PP(string);
/* php_str_to_str uses a smart_str that allocates memory */
Index: php4/ext/dbx/dbx_mssql.c
diff -u php4/ext/dbx/dbx_mssql.c:1.11 php4/ext/dbx/dbx_mssql.c:1.12
--- php4/ext/dbx/dbx_mssql.c:1.11   Wed Oct 30 07:02:49 2002
+++ php4/ext/dbx/dbx_mssql.cWed Oct 30 10:03:00 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx_mssql.c,v 1.11 2002/10/30 12:02:49 mboeren Exp $ */
+/* $Id: dbx_mssql.c,v 1.12 2002/10/30 15:03:00 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_mssql.h"
@@ -261,7 +261,7 @@
if (Z_STRLEN_PP(string) == 0) {
ZVAL_EMPTY_STRING(*rv);
return 1;
-   }
+   }
tmpstr = estrdup(Z_STRVAL_PP(string));
tmplen = Z_STRLEN_PP(string);
/* php_str_to_str uses a smart_str that allocates memory */
Index: php4/ext/dbx/dbx_mysql.c
diff -u php4/ext/dbx/dbx_mysql.c:1.16 php4/ext/dbx/dbx_mysql.c:1.17
--- php4/ext/dbx/dbx_mysql.c:1.16   Wed Oct 30 07:02:50 2002
+++ php4/ext/dbx/dbx_mysql.cWed Oct 30 10:03:00 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx_mysql.c,v 1.16 2002/10/30 12:02:50 mboeren Exp $ */
+/* $Id: dbx_mysql.c,v 1.17 2002/10/30 15:03:00 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_mysql.h"
@@ -269,7 +269,7 @@
if (Z_STRLEN_PP(string) == 0) {
ZVAL_EMPTY_STRING(*rv);
return 1;
-   }
+   }
arguments[0]=string;
arguments[1]=dbx_handle;
dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, 
"mysql_real_escape_string", &returned_zval, number_of_arguments, arguments);
Index: php4/ext/dbx/dbx_oci8.c
diff -u php4/ext/dbx/dbx_oci8.c:1.12 php4/ext/dbx/dbx_oci8.c:1.13
--- php4/ext/dbx/dbx_oci8.c:1.12Wed Oct 30 09:57:55 2002
+++ php4/ext/dbx/dbx_oci8.c Wed Oct 30 10:03:00 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx_oci8.c,v 1.12 2002/10/30 14:57:55 mboeren Exp $ */
+/* $Id: dbx_oci8.c,v 1.13 2002/10/30 15:03:00 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_oci8.h"
@@ -280,7 +280,7 @@
if (Z_STRLEN_PP(string) == 0) {
ZVAL_EMPTY_STRING(*rv);
return 1;
-   }
+   }
tmpstr = estrdup(Z_STRVAL_PP(string));
tmplen = Z_STRLEN_PP(string);
/* php_str_to_str uses a smart_str that allocates memory */
Index: php4/ext/dbx/dbx_odbc.c
diff -u php4/ext/dbx/dbx_odbc.c:1.18 php4/ext/dbx/dbx_odbc.c:1.19
--- php4/ext/dbx/dbx_odbc.c:1.18Wed Oct 30 07:02:50 2002
+++ php4/ext/dbx/dbx_odbc.c Wed Oct 30 10:03:00 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx_odbc.c,v 1.18 2002/10/30 12:02:50 mboeren Exp $ */
+/* $Id: dbx_odbc.c,v 1.19 2002/10/30 15:03:00 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_odbc.h"
@@ -284,7 +284,7 @@
if (Z_STRLEN_PP(string) == 0) {
ZVAL_EMPTY_STRING(*rv);
return 1;
-   }
+   }
tmpstr = estrdup(Z_STRVAL_PP(string));
tmplen = Z_STRLEN_PP(string);
/* php_str_to_str uses a smart_str that allocates memory */
Index: php4/ext/dbx/dbx_pgsql.c
diff -u php4/ext/dbx/dbx_pgsql.c:1.19 php4/ext/dbx/dbx_pgsql.c:1.20
--- php4/ext/dbx/dbx_pgsql.c:1.19   Wed Oct 30 07:02:50 2002
+++ php4/ext/dbx/dbx_pgsql.cWed Oct 30 10:03:00 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: dbx_pgsql.c,v 1.19 2002/10/30 12:02:50 mboeren Exp $ */
+/* $Id: dbx_pgsql.c,v 1.20 2002/10/30 15:03:00 mboeren Exp $ */
 
 #include "dbx.h"
 #include "php_dbx.h"
@@ -288,7 +288,7 @@
if (Z_STRLEN_PP(string) == 0) {
ZVAL_EMPTY_STRING(*rv);
return 1;
-   }
+   }
tmpstr = estrdup(Z_STRV

[PHP-CVS] cvs: php4 /ext/dbx dbx_oci8.c

2002-10-30 Thread Marc Boeren
mboeren Wed Oct 30 09:57:56 2002 EDT

  Modified files:  
/php4/ext/dbx   dbx_oci8.c 
  Log:
  Fixed weird membug in oci8 support.
  
  
Index: php4/ext/dbx/dbx_oci8.c
diff -u php4/ext/dbx/dbx_oci8.c:1.11 php4/ext/dbx/dbx_oci8.c:1.12
--- php4/ext/dbx/dbx_oci8.c:1.11Wed Oct 30 07:02:50 2002
+++ php4/ext/dbx/dbx_oci8.c Wed Oct 30 09:57:55 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx_oci8.c,v 1.11 2002/10/30 12:02:50 mboeren Exp $ */
+/* $Id: dbx_oci8.c,v 1.12 2002/10/30 14:57:55 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_oci8.h"
@@ -218,6 +218,7 @@
zval *returned_zval=NULL;
 
MAKE_STD_ZVAL(zval_returned_array); /* no value needed, it will be overwritten 
anyway */
+   ZVAL_EMPTY_STRING(zval_returned_array); /* there seems to be some weird 
+mem-bug, so assigning a value anyway */
MAKE_STD_ZVAL(zval_resulttype);
ZVAL_LONG(zval_resulttype, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS); /* 
no ASSOC, dbx handles that part */
arguments[0]=result_handle;



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




[PHP-CVS] cvs: php4 /ext/dbx dbx_fbsql.c dbx_mssql.c dbx_mysql.c dbx_oci8.c dbx_odbc.c dbx_pgsql.c dbx_sybasect.c

2002-10-30 Thread Marc Boeren
mboeren Wed Oct 30 07:02:51 2002 EDT

  Modified files:  
/php4/ext/dbx   dbx_fbsql.c dbx_mssql.c dbx_mysql.c dbx_oci8.c 
dbx_odbc.c dbx_pgsql.c dbx_sybasect.c 
  Log:
  escape_string functions will now return empty string directly.
  
  
Index: php4/ext/dbx/dbx_fbsql.c
diff -u php4/ext/dbx/dbx_fbsql.c:1.7 php4/ext/dbx/dbx_fbsql.c:1.8
--- php4/ext/dbx/dbx_fbsql.c:1.7Tue Oct 29 09:08:39 2002
+++ php4/ext/dbx/dbx_fbsql.cWed Oct 30 07:02:49 2002
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: dbx_fbsql.c,v 1.7 2002/10/29 14:08:39 mboeren Exp $ */
+/* $Id: dbx_fbsql.c,v 1.8 2002/10/30 12:02:49 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_fbsql.h"
@@ -259,6 +259,10 @@
char * tmpstr;
int tmplen;
 
+   if (Z_STRLEN_PP(string) == 0) {
+   ZVAL_EMPTY_STRING(*rv);
+   return 1;
+   }
tmpstr = estrdup(Z_STRVAL_PP(string));
tmplen = Z_STRLEN_PP(string);
/* php_str_to_str uses a smart_str that allocates memory */
Index: php4/ext/dbx/dbx_mssql.c
diff -u php4/ext/dbx/dbx_mssql.c:1.10 php4/ext/dbx/dbx_mssql.c:1.11
--- php4/ext/dbx/dbx_mssql.c:1.10   Tue Oct 29 09:08:39 2002
+++ php4/ext/dbx/dbx_mssql.cWed Oct 30 07:02:49 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx_mssql.c,v 1.10 2002/10/29 14:08:39 mboeren Exp $ */
+/* $Id: dbx_mssql.c,v 1.11 2002/10/30 12:02:49 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_mssql.h"
@@ -258,6 +258,10 @@
char * tmpstr;
int tmplen;
 
+   if (Z_STRLEN_PP(string) == 0) {
+   ZVAL_EMPTY_STRING(*rv);
+   return 1;
+   }
tmpstr = estrdup(Z_STRVAL_PP(string));
tmplen = Z_STRLEN_PP(string);
/* php_str_to_str uses a smart_str that allocates memory */
Index: php4/ext/dbx/dbx_mysql.c
diff -u php4/ext/dbx/dbx_mysql.c:1.15 php4/ext/dbx/dbx_mysql.c:1.16
--- php4/ext/dbx/dbx_mysql.c:1.15   Tue Oct 29 09:08:39 2002
+++ php4/ext/dbx/dbx_mysql.cWed Oct 30 07:02:50 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx_mysql.c,v 1.15 2002/10/29 14:08:39 mboeren Exp $ */
+/* $Id: dbx_mysql.c,v 1.16 2002/10/30 12:02:50 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_mysql.h"
@@ -266,6 +266,10 @@
char * tmpstr;
int tmplen;
 
+   if (Z_STRLEN_PP(string) == 0) {
+   ZVAL_EMPTY_STRING(*rv);
+   return 1;
+   }
arguments[0]=string;
arguments[1]=dbx_handle;
dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, 
"mysql_real_escape_string", &returned_zval, number_of_arguments, arguments);
Index: php4/ext/dbx/dbx_oci8.c
diff -u php4/ext/dbx/dbx_oci8.c:1.10 php4/ext/dbx/dbx_oci8.c:1.11
--- php4/ext/dbx/dbx_oci8.c:1.10Tue Oct 29 09:08:39 2002
+++ php4/ext/dbx/dbx_oci8.c Wed Oct 30 07:02:50 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx_oci8.c,v 1.10 2002/10/29 14:08:39 mboeren Exp $ */
+/* $Id: dbx_oci8.c,v 1.11 2002/10/30 12:02:50 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_oci8.h"
@@ -276,6 +276,10 @@
char * tmpstr;
int tmplen;
 
+   if (Z_STRLEN_PP(string) == 0) {
+   ZVAL_EMPTY_STRING(*rv);
+   return 1;
+   }
tmpstr = estrdup(Z_STRVAL_PP(string));
tmplen = Z_STRLEN_PP(string);
/* php_str_to_str uses a smart_str that allocates memory */
Index: php4/ext/dbx/dbx_odbc.c
diff -u php4/ext/dbx/dbx_odbc.c:1.17 php4/ext/dbx/dbx_odbc.c:1.18
--- php4/ext/dbx/dbx_odbc.c:1.17Tue Oct 29 09:08:39 2002
+++ php4/ext/dbx/dbx_odbc.c Wed Oct 30 07:02:50 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx_odbc.c,v 1.17 2002/10/29 14:08:39 mboeren Exp $ */
+/* $Id: dbx_odbc.c,v 1.18 2002/10/30 12:02:50 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_odbc.h"
@@ -281,6 +281,10 @@
char * tmpstr;
int tmplen;
 
+   if (Z_STRLEN_PP(string) == 0) {
+   ZVAL_EMPTY_STRING(*rv);
+   return 1;
+   }
tmpstr = estrdup(Z_STRVAL_PP(string));
tmplen = Z_STRLEN_PP(string);
/* php_str_to_str uses a smart_str that allocates memory */
Index: php4/ext/dbx/dbx_pgsql.c
diff -u php4/ext/dbx/dbx_pgsql.c:1.18 php4/ext/dbx/dbx_pgsql.c:1.19
--- php4/ext/dbx/dbx_pgsql.c:1.18   Tue Oct 29 09:08:40 2002
+++ php4/ext/dbx/dbx_pgsql.cWed Oct 30 07:02:50 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: dbx_pgsql.c,v 1.18 2002/10/29 14:08:40 mboeren Exp $ */
+/* $Id: dbx_pgsql.c,v 1.19 2002/10/30 12:02:50 mboeren Exp $ */
 
 #include "dbx.h"

[PHP-CVS] cvs: php4 /ext/dbx dbx.c dbx.h dbx_fbsql.c dbx_fbsql.h dbx_mssql.c dbx_mssql.h dbx_mysql.c dbx_mysql.h dbx_oci8.c dbx_oci8.h dbx_odbc.c dbx_odbc.h dbx_pgsql.c dbx_pgsql.h dbx_sybasect.c dbx_sybasect.h php_dbx.h

2002-10-29 Thread Marc Boeren
mboeren Tue Oct 29 09:08:40 2002 EDT

  Modified files:  
/php4/ext/dbx   dbx.c dbx.h dbx_fbsql.c dbx_fbsql.h dbx_mssql.c 
dbx_mssql.h dbx_mysql.c dbx_mysql.h dbx_oci8.c 
dbx_oci8.h dbx_odbc.c dbx_odbc.h dbx_pgsql.c 
dbx_pgsql.h dbx_sybasect.c dbx_sybasect.h php_dbx.h 
  Log:
  Added dbx_escape_string function
  # tested on odbc, oci8 and mysql
  @Added dbx_escape_string function to dbx module. (Marc)
  
  
Index: php4/ext/dbx/dbx.c
diff -u php4/ext/dbx/dbx.c:1.40 php4/ext/dbx/dbx.c:1.41
--- php4/ext/dbx/dbx.c:1.40 Mon Oct 28 04:41:15 2002
+++ php4/ext/dbx/dbx.c  Tue Oct 29 09:08:39 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx.c,v 1.40 2002/10/28 09:41:15 mboeren Exp $ */
+/* $Id: dbx.c,v 1.41 2002/10/29 14:08:39 mboeren Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -30,7 +30,6 @@
 #include "php_ini.h"
 #include "php_dbx.h"
 #include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
 
 /* defines for supported databases */
 #define DBX_UNKNOWN 0
@@ -137,6 +136,8 @@
/* 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 */
+int switch_dbx_esc(zval **rv, zval **dbx_handle, zval **string, 
+INTERNAL_FUNCTION_PARAMETERS, zval **dbx_module);
+   /* returns escaped string */
 
 /* Every user visible function must have an entry in dbx_functions[].
 */
@@ -145,6 +146,7 @@
ZEND_FE(dbx_close,  NULL)
ZEND_FE(dbx_query,  NULL)
ZEND_FE(dbx_error,  NULL)
+   ZEND_FE(dbx_escape_string,  NULL)
 
ZEND_FE(dbx_sort,   NULL)
ZEND_FE(dbx_compare,NULL)
@@ -168,15 +170,15 @@
 #ifdef COMPILE_DL_DBX
 ZEND_GET_MODULE(dbx)
 #endif
-
-ZEND_INI_BEGIN()
-ZEND_INI_ENTRY("dbx.colnames_case", "unchanged", ZEND_INI_SYSTEM, NULL)
-ZEND_INI_END()
+
+ZEND_INI_BEGIN()
+ZEND_INI_ENTRY("dbx.colnames_case", "unchanged", ZEND_INI_SYSTEM, NULL)
+ZEND_INI_END()
 
 ZEND_MINIT_FUNCTION(dbx)
 {
-REGISTER_INI_ENTRIES();
-
+REGISTER_INI_ENTRIES();
+
REGISTER_LONG_CONSTANT("DBX_MYSQL", DBX_MYSQL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DBX_ODBC", DBX_ODBC, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DBX_PGSQL", DBX_PGSQL, CONST_CS | CONST_PERSISTENT);
@@ -190,10 +192,10 @@
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_COLNAMES_UNCHANGED", DBX_COLNAMES_UNCHANGED, 
CONST_CS | CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT("DBX_COLNAMES_UPPERCASE", DBX_COLNAMES_UPPERCASE, 
CONST_CS | CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT("DBX_COLNAMES_LOWERCASE", DBX_COLNAMES_LOWERCASE, 
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);
+   REGISTER_LONG_CONSTANT("DBX_COLNAMES_LOWERCASE", DBX_COLNAMES_LOWERCASE, 
+CONST_CS | CONST_PERSISTENT);
 
REGISTER_LONG_CONSTANT("DBX_CMP_NATIVE", DBX_CMP_NATIVE, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DBX_CMP_TEXT", DBX_CMP_TEXT, CONST_CS | 
CONST_PERSISTENT);
@@ -206,7 +208,7 @@
 
 ZEND_MSHUTDOWN_FUNCTION(dbx)
 {
-UNREGISTER_INI_ENTRIES();
+UNREGISTER_INI_ENTRIES();
return SUCCESS;
 }
 
@@ -227,7 +229,7 @@
php_info_print_table_row(2, "dbx version", "1.0.0");
php_info_print_table_row(2, "supported databases", 
"MySQL\nODBC\nPostgreSQL\nMicrosoft SQL Server\nFrontBase\nOracle 8 
(oci8)\nSybase-CT");
php_info_print_table_end();
-DISPLAY_INI_ENTRIES();
+DISPLAY_INI_ENTRIES();
 }
 
 /*
@@ -366,20 +368,20 @@
long col_index;
long row_count;
zval *info;
-   long query_flags;
-   long result_flags;
+   long query_flags;
+   long result_flags;
zval *data;
zval **row_ptr;
-   zval **inforow_ptr;
-   /* default values for colname-case */
-   char * colnames_case = INI_STR("dbx.colnames_case");
-   long colcase = DBX_COLNAMES_UNCHANGED;
-   if (!strcmp(colnames_case, "uppercase")) {
-   colcase = DBX_COLNAMES_UPPERCASE;
-   }
-   if (!strcmp(colnames_case, "lowercase")) {
-   colcase = DBX_COLNAMES_LOWERCASE;
-   }
+   zval **inforow_ptr;
+   /* default values for colname-case */
+   char * colnames_case = INI_STR("db

[PHP-CVS] cvs: php4 /ext/dbx/tests 009.phpt

2002-10-29 Thread Marc Boeren
mboeren Tue Oct 29 09:01:27 2002 EDT

  Added files: 
/php4/ext/dbx/tests 009.phpt 
  Log:
  Added test for dbx_escape_string
  
  

Index: php4/ext/dbx/tests/009.phpt
+++ php4/ext/dbx/tests/009.phpt
--TEST--
dbx_escape_string
--SKIPIF--

--FILE--
data[0]['field2']===$txt?'ok':'fail 
('.$dro->data[0]['field2'].')').': '.$txt."\n");
}
}
}
test_dbx_escape_string('no special characters');
test_dbx_escape_string('quote \' string');
test_dbx_escape_string('doublequote " string');
test_dbx_escape_string('backslash \\ string');
test_dbx_escape_string('backslash and quote \\ \' string');
test_dbx_escape_string('ampersand & string');
// delete query
dbx_query($dlo, $sql_delete_statement);
// generate errors
if (!@dbx_escape_string(0, "any_text")) {
print('wrong dbx_link_object: escape_string failure works ok'."\n");
}
if (!@dbx_escape_string($dlo, "any_text", "12many")) {
print('too many parameters: escape_string failure works ok'."\n");
}
if (!@dbx_escape_string($dlo)) {
print('too few parameters: escape_string failure works ok'."\n");
}
dbx_close($dlo);
}
?>
--EXPECT--
ok: no special characters
ok: quote ' string
ok: doublequote " string
ok: backslash \ string
ok: backslash and quote \ ' string
ok: ampersand & string
wrong dbx_link_object: escape_string failure works ok
too many parameters: escape_string failure works ok
too few parameters: escape_string failure works ok



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




[PHP-CVS] cvs: php4 / php.ini-dist php.ini-recommended

2002-10-28 Thread Marc Boeren
mboeren Mon Oct 28 04:54:21 2002 EDT

  Modified files:  
/php4   php.ini-dist php.ini-recommended 
  Log:
  Added dbx.colnames_case option that controls the case of the returned
  column names.
  
  
Index: php4/php.ini-dist
diff -u php4/php.ini-dist:1.167 php4/php.ini-dist:1.168
--- php4/php.ini-dist:1.167 Mon Oct 21 09:09:29 2002
+++ php4/php.ini-dist   Mon Oct 28 04:54:21 2002
@@ -721,6 +721,16 @@
 ; Minimum client message severity to display.
 sybct.min_client_severity = 10
 
+[dbx]
+; returned column names can be converted for compatibility reasons
+; possible values for dbx.colnames_case are
+; "unchanged" (default, if not set)
+; "lowercase"
+; "uppercase"
+; the recommended default is either upper- or lowercase, but
+; unchanged is currently set for backwards compatibility
+dbx.colnames_case = "unchanged"
+
 [bcmath]
 ; Number of decimal digits for all bcmath functions.
 bcmath.scale = 0
Index: php4/php.ini-recommended
diff -u php4/php.ini-recommended:1.115 php4/php.ini-recommended:1.116
--- php4/php.ini-recommended:1.115  Mon Oct 21 09:09:29 2002
+++ php4/php.ini-recommendedMon Oct 28 04:54:21 2002
@@ -738,6 +738,16 @@
 ; Minimum client message severity to display.
 sybct.min_client_severity = 10
 
+[dbx]
+; returned column names can be converted for compatibility reasons
+; possible values for dbx.colnames_case are
+; "unchanged" (default, if not set)
+; "lowercase"
+; "uppercase"
+; the recommended default is either upper- or lowercase, but
+; unchanged is currently set for backwards compatibility
+dbx.colnames_case = "lowercase"
+
 [bcmath]
 ; Number of decimal digits for all bcmath functions.
 bcmath.scale = 0



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




[PHP-CVS] cvs: php4 /ext/dbx dbx.c dbx.h dbx_oci8.c /ext/dbx/tests 002.phpt 005.phpt

2002-10-28 Thread Marc Boeren
mboeren Mon Oct 28 04:41:15 2002 EDT

  Modified files:  
/php4/ext/dbx   dbx.c dbx.h dbx_oci8.c 
/php4/ext/dbx/tests 002.phpt 005.phpt 
  Log:
  Added ini-entry and dbx_query flags to control the returned
  column names (unchanged, lowercase, uppercase).
  
  
Index: php4/ext/dbx/dbx.c
diff -u php4/ext/dbx/dbx.c:1.39 php4/ext/dbx/dbx.c:1.40
--- php4/ext/dbx/dbx.c:1.39 Wed Oct 23 06:50:21 2002
+++ php4/ext/dbx/dbx.c  Mon Oct 28 04:41:15 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx.c,v 1.39 2002/10/23 10:50:21 mboeren Exp $ */
+/* $Id: dbx.c,v 1.40 2002/10/28 09:41:15 mboeren Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -30,6 +30,7 @@
 #include "php_ini.h"
 #include "php_dbx.h"
 #include "ext/standard/info.h"
+#include "ext/standard/php_string.h"
 
 /* defines for supported databases */
 #define DBX_UNKNOWN 0
@@ -167,9 +168,15 @@
 #ifdef COMPILE_DL_DBX
 ZEND_GET_MODULE(dbx)
 #endif
+
+ZEND_INI_BEGIN()
+ZEND_INI_ENTRY("dbx.colnames_case", "unchanged", ZEND_INI_SYSTEM, NULL)
+ZEND_INI_END()
 
 ZEND_MINIT_FUNCTION(dbx)
 {
+REGISTER_INI_ENTRIES();
+
REGISTER_LONG_CONSTANT("DBX_MYSQL", DBX_MYSQL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DBX_ODBC", DBX_ODBC, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DBX_PGSQL", DBX_PGSQL, CONST_CS | CONST_PERSISTENT);
@@ -183,6 +190,10 @@
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_COLNAMES_UNCHANGED", DBX_COLNAMES_UNCHANGED, 
+CONST_CS | CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT("DBX_COLNAMES_UPPERCASE", DBX_COLNAMES_UPPERCASE, 
+CONST_CS | CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT("DBX_COLNAMES_LOWERCASE", DBX_COLNAMES_LOWERCASE, 
+CONST_CS | CONST_PERSISTENT);
 
REGISTER_LONG_CONSTANT("DBX_CMP_NATIVE", DBX_CMP_NATIVE, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DBX_CMP_TEXT", DBX_CMP_TEXT, CONST_CS | 
CONST_PERSISTENT);
@@ -195,6 +206,7 @@
 
 ZEND_MSHUTDOWN_FUNCTION(dbx)
 {
+UNREGISTER_INI_ENTRIES();
return SUCCESS;
 }
 
@@ -215,6 +227,7 @@
php_info_print_table_row(2, "dbx version", "1.0.0");
php_info_print_table_row(2, "supported databases", 
"MySQL\nODBC\nPostgreSQL\nMicrosoft SQL Server\nFrontBase\nOracle 8 
(oci8)\nSybase-CT");
php_info_print_table_end();
+DISPLAY_INI_ENTRIES();
 }
 
 /*
@@ -353,10 +366,20 @@
long col_index;
long row_count;
zval *info;
-   long info_flags;
+   long query_flags;
+   long result_flags;
zval *data;
zval **row_ptr;
-   zval **inforow_ptr;
+   zval **inforow_ptr;
+   /* default values for colname-case */
+   char * colnames_case = INI_STR("dbx.colnames_case");
+   long colcase = DBX_COLNAMES_UNCHANGED;
+   if (!strcmp(colnames_case, "uppercase")) {
+   colcase = DBX_COLNAMES_UPPERCASE;
+   }
+   if (!strcmp(colnames_case, "lowercase")) {
+   colcase = DBX_COLNAMES_LOWERCASE;
+   }
 
if (ZEND_NUM_ARGS()number_of_arguments || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), 
arguments) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -366,15 +389,27 @@
RETURN_LONG(0);
}
/* default values */
-   info_flags = DBX_RESULT_INFO | DBX_RESULT_INDEX | DBX_RESULT_ASSOC;
+   result_flags = DBX_RESULT_INFO | DBX_RESULT_INDEX | DBX_RESULT_ASSOC;
/* parameter overrides */
if (ZEND_NUM_ARGS()>2) {
convert_to_long_ex(arguments[2]);
-   info_flags = Z_LVAL_PP(arguments[2]);
-   /* fieldnames are needed for association! */
-   if (info_flags & DBX_RESULT_ASSOC) {
-   info_flags |= DBX_RESULT_INFO;
-   }
+   query_flags = Z_LVAL_PP(arguments[2]);
+   /* fieldnames are needed for association! */
+   result_flags = (query_flags & DBX_RESULT_INFO) | (query_flags & 
+DBX_RESULT_INDEX) | (query_flags & DBX_RESULT_ASSOC);
+   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;
+   /* override ini-setting for colcase */
+   if (query_flags & DBX_COLNAMES_UNCHANGED) {
+   colcase = DBX_COLNAMES_UNCHANGED;
+   }
+   if (query_flags & DBX_COLNAMES_UPPERCASE) {
+   colcase = DBX_COLNAMES_UPPERCASE;
+   }
+   if (query_flags & DBX_COLNAMES_LOWERCASE) {
+ 

[PHP-CVS] cvs: php4 /ext/dbx dbx_oci8.c

2002-10-24 Thread Marc Boeren
mboeren Thu Oct 24 10:26:14 2002 EDT

  Modified files:  
/php4/ext/dbx   dbx_oci8.c 
  Log:
  Changed the dbx_oci8 behaviour to return lowercase column-names,
  which is a hack but at least it makes it easier for users
  to create portable apps.
  # Perhaps this should be controlled by a (.ini?) directive or define
  # which determines the change (toupper, tolower, nochange)?
  
  
Index: php4/ext/dbx/dbx_oci8.c
diff -u php4/ext/dbx/dbx_oci8.c:1.7 php4/ext/dbx/dbx_oci8.c:1.8
--- php4/ext/dbx/dbx_oci8.c:1.7 Thu Oct 24 08:52:13 2002
+++ php4/ext/dbx/dbx_oci8.c Thu Oct 24 10:26:14 2002
@@ -20,10 +20,11 @@
+--+
 */
 
-/* $Id: dbx_oci8.c,v 1.7 2002/10/24 12:52:13 derick Exp $ */
+/* $Id: dbx_oci8.c,v 1.8 2002/10/24 14:26:14 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_oci8.h"
+#include "ext/standard/php_string.h" /* for auto-change column names to lowercase*/
 
 #define OCI_ASSOC1<<0
 #define OCI_NUM  1<<1
@@ -178,6 +179,7 @@
return 0;
}
FREE_ZVAL(zval_column_index);
+   php_strtolower(Z_STRVAL_P(returned_zval), Z_STRLEN_P(returned_zval));
MOVE_RETURNED_TO_RV(rv, returned_zval);
return 1;
 }



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




[PHP-CVS] cvs: php4 /ext/dbx/tests 005.phpt 007.phpt 008.phpt dbx_test.p

2002-10-24 Thread Marc Boeren
mboeren Thu Oct 24 10:16:29 2002 EDT

  Modified files:  
/php4/ext/dbx/tests 005.phpt 007.phpt 008.phpt dbx_test.p 
  Log:
  Not happy with the hack to handle the uppercase fieldnames that oracle 
  returns. Changed the dbx_oci8 behaviour to return lowercase instead,
  which is also a hack but at least it makes it much easier for users
  to create portable apps (Mc).
  # also, I prefer lowercase :-)
  
  
Index: php4/ext/dbx/tests/005.phpt
diff -u php4/ext/dbx/tests/005.phpt:1.5 php4/ext/dbx/tests/005.phpt:1.6
--- php4/ext/dbx/tests/005.phpt:1.5 Wed Oct 23 06:45:29 2002
+++ php4/ext/dbx/tests/005.phpt Thu Oct 24 10:16:27 2002
@@ -30,9 +30,9 @@
 // select query
 if ($dro=dbx_query($dlo, $sql_statement)) {
 for ($i=0; $i<$dro->rows; ++$i) {
-
print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".$dro->data[$i][$fieldname_case_function('field1')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
+
+print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".$dro->data[$i]['field1'].".".strlen($dro->data[$i]['field2'])."\n");
 }
-$dro->data[0][$fieldname_case_function('id')]='changed_value';
+$dro->data[0]['id']='changed_value';
 print($dro->data[0][0]."\n");
 }
 // insert query
@@ -40,7 +40,7 @@
 print('insert-query: dbx_query works ok'."\n");
 if ($dro=dbx_query($dlo, $sql_select_statement)) {
 for ($i=0; $i<$dro->rows; ++$i) {
-
print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
+
+print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
 }
 }
 }
@@ -49,7 +49,7 @@
 print('update-query: dbx_query works ok'."\n");
 if ($dro=dbx_query($dlo, $sql_select_statement)) {
 for ($i=0; $i<$dro->rows; ++$i) {
-
print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
+
+print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
 }
 }
 }
@@ -58,7 +58,7 @@
 print('delete-query: dbx_query works ok'."\n");
 if ($dro=dbx_query($dlo, $sql_select_statement)) {
 for ($i=0; $i<$dro->rows; ++$i) {
-
print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
+
+print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
 }
 }
 }
Index: php4/ext/dbx/tests/007.phpt
diff -u php4/ext/dbx/tests/007.phpt:1.3 php4/ext/dbx/tests/007.phpt:1.4
--- php4/ext/dbx/tests/007.phpt:1.3 Wed Oct 23 06:45:29 2002
+++ php4/ext/dbx/tests/007.phpt Thu Oct 24 10:16:28 2002
@@ -22,9 +22,8 @@
 return "blabla";
 }
 function cmp($a, $b) {
-$fieldname_case_function = $GLOBALS['fieldname_case_function'];
-$rv = dbx_compare($a, $b, $fieldname_case_function("description"));
-if (!$rv) $rv = dbx_compare($a, $b, $fieldname_case_function("id"));
+$rv = dbx_compare($a, $b, "description");
+if (!$rv) $rv = dbx_compare($a, $b, "id");
 return $rv;
 }
 if (!$dlo) {
@@ -36,11 +35,11 @@
 print('this won\'t work'."\n");
 }
 for ($i=0; $i<$dro->rows; ++$i) {
-
print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
+print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
 }
 if (dbx_sort($dro, $compare_function)) {
 for ($i=0; $i<$dro->rows; ++$i) {
-
print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
+print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
 }
 }
 if (!@dbx_sort(0, $compare_function)) {
Index: php4/ext/dbx/tests/008.phpt
diff -u php4/ext/dbx/tests/008.phpt:1.3 php4/ext/dbx/tests/008.phpt:1.4
--- php4/ext/dbx/tests/008.phpt:1.3 Wed Oct 23 06:45:29 2002
+++ php4/ext/dbx/tests/008.phpt Thu Oct 24 10:16:28 2002
@@ -22,39 +22,33 @@
 $compare_function_6 = "cmp_description_number_id";
 $dlo = dbx_connect($module, $host, $database, $username, $password);
 function cmp_description_id($a, $b) {
-$fieldname_case_function = $GLOBALS['fieldname_case_function'];
-$rv = dbx_compare($a, $b, $fieldname_case_function("description"));
-if (!$rv) $rv = dbx_compare($a, $b

RE: [PHP-CVS] cvs: php4 /ext/dbx dbx.c dbx_oci8.c howto_extend_dbx.html

2002-10-23 Thread Marc Boeren

>   Modified files:  
> /php4/ext/dbx dbx.c dbx_oci8.c howto_extend_dbx.html 
>   Log:
>   Added Oracle (oci8) support

Only tested on Win32 with Oracle 9.2 so far...

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




[PHP-CVS] cvs: php4 /ext/dbx dbx.c dbx_oci8.c howto_extend_dbx.html

2002-10-23 Thread Marc Boeren
mboeren Wed Oct 23 06:50:23 2002 EDT

  Modified files:  
/php4/ext/dbx   dbx.c dbx_oci8.c howto_extend_dbx.html 
  Log:
  Added Oracle (oci8) support
  @Added Oracle (oci8) support to dbx module (Mc)
  
  
Index: php4/ext/dbx/dbx.c
diff -u php4/ext/dbx/dbx.c:1.38 php4/ext/dbx/dbx.c:1.39
--- php4/ext/dbx/dbx.c:1.38 Tue Jul 23 09:45:49 2002
+++ php4/ext/dbx/dbx.c  Wed Oct 23 06:50:21 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx.c,v 1.38 2002/07/23 13:45:49 sas Exp $ */
+/* $Id: dbx.c,v 1.39 2002/10/23 10:50:21 mboeren Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -213,7 +213,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "dbx support", "enabled");
php_info_print_table_row(2, "dbx version", "1.0.0");
-   php_info_print_table_row(2, "supported databases", 
"MySQL\nODBC\nPostgreSQL\nMicrosoft SQL Server\nFrontBase\nOracle 8 (not 
really)\nSybase-CT");
+   php_info_print_table_row(2, "supported databases", 
+"MySQL\nODBC\nPostgreSQL\nMicrosoft SQL Server\nFrontBase\nOracle 8 
+(oci8)\nSybase-CT");
php_info_print_table_end();
 }
 
@@ -673,8 +673,7 @@
case DBX_PGSQL: return dbx_pgsql_connect(rv, host, db, username, 
password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
case DBX_MSSQL: return dbx_mssql_connect(rv, host, db, username, 
password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
case DBX_FBSQL: return dbx_fbsql_connect(rv, host, db, username, 
password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
-   case DBX_OCI8:  zend_error(E_WARNING, "dbx_connect: OCI8 extension is 
still highly experimental!"); 
-   return dbx_oci8_connect(rv, host, db, username, password, 
INTERNAL_FUNCTION_PARAM_PASSTHRU);
+   case DBX_OCI8:  return dbx_oci8_connect(rv, host, db, username, 
+password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
case DBX_SYBASECT: return dbx_sybasect_connect(rv, host, db, username, 
password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
zend_error(E_WARNING, "dbx_connect: not supported in this module");
@@ -690,8 +689,7 @@
case DBX_PGSQL: return dbx_pgsql_pconnect(rv, host, db, username, 
password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
case DBX_MSSQL: return dbx_mssql_pconnect(rv, host, db, username, 
password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
case DBX_FBSQL: return dbx_fbsql_pconnect(rv, host, db, username, 
password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
-   case DBX_OCI8:  zend_error(E_WARNING, "dbx_pconnect: OCI8 extension is 
still highly experimental!"); 
-   return dbx_oci8_pconnect(rv, host, db, username, password, 
INTERNAL_FUNCTION_PARAM_PASSTHRU);
+   case DBX_OCI8:  return dbx_oci8_pconnect(rv, host, db, username, 
+password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
case DBX_SYBASECT: return dbx_sybasect_pconnect(rv, host, db, 
username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
zend_error(E_WARNING, "dbx_pconnect: not supported in this module");
@@ -803,7 +801,7 @@
case DBX_PGSQL: return dbx_pgsql_error(rv, dbx_handle, 
INTERNAL_FUNCTION_PARAM_PASSTHRU);
case DBX_MSSQL: return dbx_mssql_error(rv, dbx_handle, 
INTERNAL_FUNCTION_PARAM_PASSTHRU);
case DBX_FBSQL: return dbx_fbsql_error(rv, dbx_handle, 
INTERNAL_FUNCTION_PARAM_PASSTHRU);
-   case DBX_OCI8:  return dbx_oci8_error(rv, dbx_handle, 
INTERNAL_FUNCTION_PARAM_PASSTHRU);
+   /* case DBX_OCI8:  return dbx_oci8_error(rv, dbx_handle, 
+INTERNAL_FUNCTION_PARAM_PASSTHRU); */
case DBX_SYBASECT: return dbx_sybasect_error(rv, dbx_handle, 
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
zend_error(E_WARNING, "dbx_error: not supported in this module");
Index: php4/ext/dbx/dbx_oci8.c
diff -u php4/ext/dbx/dbx_oci8.c:1.5 php4/ext/dbx/dbx_oci8.c:1.6
--- php4/ext/dbx/dbx_oci8.c:1.5 Tue Dec 11 10:29:05 2001
+++ php4/ext/dbx/dbx_oci8.c Wed Oct 23 06:50:22 2002
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: dbx_oci8.c,v 1.5 2001/12/11 15:29:05 sebastian Exp $ */
+/* $Id: dbx_oci8.c,v 1.6 2002/10/23 10:50:22 mboeren Exp $ */
 
 #include "dbx.h"
 #include "dbx_oci8.h"
@@ -71,6 +71,8 @@
 int dbx_oci8_close(zval **rv, zval **dbx_handle, INTERNAL_FUNCTION_PARAMETERS)
 {
/* returns 1 as long on success or 0 as long on failure */
+   /* actually, ocilogoff officially does nothing, so what should I return? */
+   /* I will just return NULL right now and change the test accordingly */
int number_of_arguments=1;
zval **arguments[1];
zval *returned_zval=NULL;
@@ -87,11 +89,12 @@
 
 int dbx_oci8_query(zval **rv, zval **dbx_handle, zval **db_name, zval 
**sql_statement, INTERNAL_FUNCTION_PARAMETERS)
 {

[PHP-CVS] cvs: php4 /ext/dbx/tests 004.phpt 005.phpt 006.phpt 007.phpt 008.phpt dbx_test.p

2002-10-23 Thread Marc Boeren
mboeren Wed Oct 23 06:45:30 2002 EDT

  Modified files:  
/php4/ext/dbx/tests 004.phpt 005.phpt 006.phpt 007.phpt 008.phpt 
dbx_test.p 
  Log:
  Updated tests for Oracle (oci8) support (Mc)
  
  
Index: php4/ext/dbx/tests/004.phpt
diff -u php4/ext/dbx/tests/004.phpt:1.2 php4/ext/dbx/tests/004.phpt:1.3
--- php4/ext/dbx/tests/004.phpt:1.2 Mon Oct  7 05:27:02 2002
+++ php4/ext/dbx/tests/004.phpt Wed Oct 23 06:45:29 2002
@@ -14,11 +14,16 @@
 dbx_close($dlo)) {
 print('close failure works ok'."\n");
 }
Index: php4/ext/dbx/tests/005.phpt
diff -u php4/ext/dbx/tests/005.phpt:1.4 php4/ext/dbx/tests/005.phpt:1.5
--- php4/ext/dbx/tests/005.phpt:1.4 Mon Oct  7 05:27:02 2002
+++ php4/ext/dbx/tests/005.phpt Wed Oct 23 06:45:29 2002
@@ -30,9 +30,9 @@
 // select query
 if ($dro=dbx_query($dlo, $sql_statement)) {
 for ($i=0; $i<$dro->rows; ++$i) {
-
print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".$dro->data[$i]['field1'].".".strlen($dro->data[$i]['field2'])."\n");
+
+print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".$dro->data[$i][$fieldname_case_function('field1')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
 }
-$dro->data[0]['id']='changed_value';
+$dro->data[0][$fieldname_case_function('id')]='changed_value';
 print($dro->data[0][0]."\n");
 }
 // insert query
@@ -40,7 +40,7 @@
 print('insert-query: dbx_query works ok'."\n");
 if ($dro=dbx_query($dlo, $sql_select_statement)) {
 for ($i=0; $i<$dro->rows; ++$i) {
-
print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
+
+print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
 }
 }
 }
@@ -49,7 +49,7 @@
 print('update-query: dbx_query works ok'."\n");
 if ($dro=dbx_query($dlo, $sql_select_statement)) {
 for ($i=0; $i<$dro->rows; ++$i) {
-
print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
+
+print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
 }
 }
 }
@@ -58,7 +58,7 @@
 print('delete-query: dbx_query works ok'."\n");
 if ($dro=dbx_query($dlo, $sql_select_statement)) {
 for ($i=0; $i<$dro->rows; ++$i) {
-
print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
+
+print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
 }
 }
 }
Index: php4/ext/dbx/tests/006.phpt
diff -u php4/ext/dbx/tests/006.phpt:1.4 php4/ext/dbx/tests/006.phpt:1.5
--- php4/ext/dbx/tests/006.phpt:1.4 Mon Oct  7 05:27:02 2002
+++ php4/ext/dbx/tests/006.phpt Wed Oct 23 06:45:29 2002
@@ -13,8 +13,9 @@
 --FILE--
 @ -22,8 +22,9 @@
 return "blabla";
 }
 function cmp($a, $b) {
-$rv = dbx_compare($a, $b, "description");
-if (!$rv) $rv = dbx_compare($a, $b, "id");
+$fieldname_case_function = $GLOBALS['fieldname_case_function'];
+$rv = dbx_compare($a, $b, $fieldname_case_function("description"));
+if (!$rv) $rv = dbx_compare($a, $b, $fieldname_case_function("id"));
 return $rv;
 }
 if (!$dlo) {
@@ -35,11 +36,11 @@
 print('this won\'t work'."\n");
 }
 for ($i=0; $i<$dro->rows; ++$i) {
-print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
+
+print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
 }
 if (dbx_sort($dro, $compare_function)) {
 for ($i=0; $i<$dro->rows; ++$i) {
-print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
+
+print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
 }
 }
 if (!@dbx_sort(0, $compare_function)) {
Index: php4/ext/dbx/tests/008.phpt
diff -u php4/ext/dbx/tests/008.phpt:1.2 php4/ext/dbx/tests/008.phpt:1.3
--- php4/ext/dbx/tests/008.phpt:1.2 Mon Oct  7 05:27:02 2002
+++ php4/ext/dbx/tests/008.phpt Wed Oct 23 06:45:29 2002
@@ -22,33 +22,39 @@
 $compare_function_6 = "cmp_description_number_id";
 $dlo = dbx_connect($module, $host, $database, $username, $password);
 function cmp_description_id($a, $b) {
-$rv = dbx_compare

[PHP-CVS] cvs: php4 /ext/dbx/tests 003.phpt 004.phpt 005.phpt 006.phpt 007.phpt 008.phpt dbx_test.p

2002-10-07 Thread Marc Boeren

mboeren Mon Oct  7 05:27:03 2002 EDT

  Modified files:  
/php4/ext/dbx/tests 003.phpt 004.phpt 005.phpt 006.phpt 007.phpt 
008.phpt dbx_test.p 
  Log:
  Tests will be skipped if a tester does not explicitly specify the
  test-database setup in dbx_test.p.
  
  
Index: php4/ext/dbx/tests/003.phpt
diff -u php4/ext/dbx/tests/003.phpt:1.3 php4/ext/dbx/tests/003.phpt:1.4
--- php4/ext/dbx/tests/003.phpt:1.3 Wed Jun 13 09:35:17 2001
+++ php4/ext/dbx/tests/003.phpt Mon Oct  7 05:27:02 2002
@@ -1,12 +1,18 @@
 --TEST--
 dbx_connect
 --SKIPIF--
-
+
 --POST--
 --GET--
 --FILE--
 
+
 --POST--
 --GET--
 --FILE--
 
+
 --POST--
 --GET--
 --FILE--
 
+
 --POST--
 --GET--
 --FILE--
 
+
 --POST--
 --GET--
 --FILE--
 
+
 --POST--
 --GET--
 --FILE--
 http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php