affected_rows for mSQL

From: Date: Sun, 18 Oct 1998 11:17:51 +0000
Subject: affected_rows for mSQL
Groups: php.dev 
Request: Send a blank email to php-dev+get-1904@lists.php.net to get a copy of this message
(I didn't see a charter for this list, feel free to flame me to post it here :-) ) This patch adds a function to the mSQL module which is similiar to affected_rows() of MySQL or pq_cmdtuples of PostgreSQL. I had only a quick glance at the code and perhaps I did something wrong, so it would be nice to hear one or two comments on it :) Sascha Index: msql.c =================================================================== RCS file: /repository/php3/functions/msql.c,v retrieving revision 1.97 diff -u -t -r1.97 msql.c --- msql.c 1998/09/29 23:33:37 1.97 +++ msql.c 1998/10/18 11:10:51 @@ -105,6 +105,7 @@ {"msql_fieldtype", php3_msql_field_type, NULL}, {"msql_fieldflags", php3_msql_field_flags, NULL}, {"msql_regcase", php3_sql_regcase, NULL}, + {"msql_affected_rows", php3_affected_rows, NULL}, /* for downwards compatability */ {"msql", php3_msql_db_query, NULL}, {"msql_selectdb", php3_msql_select_db, NULL}, @@ -210,6 +211,7 @@ MSQL_GLOBAL(php3_msql_module).le_plink = register_list_destructors(NULL,_close_msql_plink); msql_module_entry.type = type; + MSQL_GLOBAL(php3_msql_module).af_rows = 0; return SUCCESS; } @@ -599,6 +601,7 @@ pval *query,*msql_link; int id,type; int msql; + int af_rows; m_result *msql_result; MSQL_TLS_VARS; @@ -628,7 +631,7 @@ } convert_to_string(query); - if (msqlQuery(msql,query->value.str.val)==-1) { + if ((af_rows = msqlQuery(msql,query->value.str.val))==-1) { RETURN_FALSE; } if ((msql_result=msqlStoreResult())==NULL) { @@ -638,10 +641,16 @@ */ RETURN_TRUE; } + MSQL_GLOBAL(php3_msql_module).af_rows = af_rows; return_value->value.lval = php3_list_insert(msql_result,MSQL_GLOBAL(php3_msql_module).le_result); return_value->type = IS_LONG; } +DLEXPORT void php3_affected_rows(INTERNAL_FUNCTION_PARAMETERS) +{ + return_value->value.lval = MSQL_GLOBAL(php3_msql_module).af_rows; + return_value->type = IS_LONG; +} DLEXPORT void php3_msql_db_query(INTERNAL_FUNCTION_PARAMETERS) { Index: php3_msql.h =================================================================== RCS file: /repository/php3/functions/php3_msql.h,v retrieving revision 1.23 diff -u -t -r1.23 php3_msql.h --- php3_msql.h 1998/05/15 10:57:33 1.23 +++ php3_msql.h 1998/10/18 11:10:51 @@ -85,6 +85,7 @@ int le_result; int le_link; int le_plink; + int af_rows; } msql_module; #ifndef THREAD_SAFE -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#1904) next »