File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1053,7 +1053,7 @@ PHP_FUNCTION(mssql_query)
1053
1053
RETURN_FALSE ;
1054
1054
}
1055
1055
1056
- if ((num_fields = dbnumcols (mssql_ptr -> link )) <= 0 ) {
1056
+ if ((num_fields = dbnumcols (mssql_ptr -> link )) <= 0 && ! dbdataready ( mssql_ptr -> link ) ) {
1057
1057
RETURN_TRUE ;
1058
1058
}
1059
1059
@@ -1067,8 +1067,10 @@ PHP_FUNCTION(mssql_query)
1067
1067
result -> mssql_ptr = mssql_ptr ;
1068
1068
result -> cur_field = result -> cur_row = result -> num_rows = 0 ;
1069
1069
1070
- result -> fields = (mssql_field * ) emalloc (sizeof (mssql_field )* result -> num_fields );
1071
- result -> num_rows = _mssql_fetch_batch (mssql_ptr , result , retvalue TSRMLS_CC );
1070
+ if (num_fields > 0 ) {
1071
+ result -> fields = (mssql_field * ) emalloc (sizeof (mssql_field )* result -> num_fields );
1072
+ result -> num_rows = _mssql_fetch_batch (mssql_ptr , result , retvalue TSRMLS_CC );
1073
+ }
1072
1074
1073
1075
ZEND_REGISTER_RESOURCE (return_value , result , le_result );
1074
1076
}
You can’t perform that action at this time.
0 commit comments