mssql.dll fix

From: Date: Sun, 07 May 2000 18:37:59 +0000
Subject: mssql.dll fix
Groups: php.dev 
Request: Send a blank email to php-dev+get-18500@lists.php.net to get a copy of this message
a bug/shortcomming in the mssql module - in both the 3x sources and 4.0 rc1 source... if a query doesn't return any rows, but it's successful, then mssql_query returns TRUE, which is >0 (according to the docs means that it's a result identifier)... PHPLIB needs a function to return the number of rows affected by updates, inserts, and deletes for example... i changed the source so that if no fields are returned, instead of returning true, it allocated a result structure with no rows, so that result->num_rows still gets filled with DBCOUNT()... original 4.x/3.x code... num_fields = dbnumcols(mssql_ptr->link); if (num_fields <= 0) { RETURN_TRUE; } mine... num_fields = dbnumcols(mssql_ptr->link); if (num_fields <= 0) { result = (mssql_result*) emalloc(sizeof(mssql_result) ); result->data = (pval**) emalloc(sizeof(pval*)*MSSQL_ROWS_BLOCK ); result->mssql_ptr = mssql_ptr; result->num_fields = 0; result->num_rows = DBCOUNT( mssql_ptr->link ); return_value->value.lval = php3_list_insert(result
                                      ,msSQL_GLOBAL(le_result));
return_value->type = IS_LONG; return; } ... i'm not quite sure if the empty result structure would cause any problems anywhere else but it seems to work fine, and now after a successful query, mssql_num_rows() will always be the number of rows affected... now i have PHPLIB and php3 working with mssql : ) -ben/anix, djanix@hotmail.com ________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

« previous php.dev (#18500) next »