Date: 05/07/00
- Next message: Jim Winstead: "[PHP-DEV] cvs: /CVSROOT loginfo.pl"
- Previous message: Jim Winstead: "[PHP-DEV] cvs: /CVSROOT commitinfo loginfo"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 <email protected>
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Jim Winstead: "[PHP-DEV] cvs: /CVSROOT loginfo.pl"
- Previous message: Jim Winstead: "[PHP-DEV] cvs: /CVSROOT commitinfo loginfo"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

