ID:               17291
 User updated by:  mgruetzner at rw3 dot com
 Reported By:      mgruetzner at rw3 dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Sybase (dblib) related
 Operating System: Linux
 PHP Version:      4.3.1
 New Comment:

<a
href="http://www.xnitech.com/php_sybase_db.c";>http://www.xnitech.com/php_sybase_db.c</a>


Previous Comments:
------------------------------------------------------------------------

[2003-02-21 03:21:29] [EMAIL PROTECTED]

Please put the file somewhere to be downloaded and
add an url here.


------------------------------------------------------------------------

[2003-02-20 09:11:57] mgruetzner at rw3 dot com

The issue is still not resolved.  FreeTDS addressed the issue on their
end, but I still have to merge in my fix to 
/ext/sybase/php_sybase_db.c every time I update PHP.  Again, I have a
version of /ext/sybase/php_sybase_db.c which addresses the problem.  It
involves a few small changes to the sybase_query function.  I can send
it to you if you are interested.

------------------------------------------------------------------------

[2003-02-20 07:58:46] [EMAIL PROTECTED]

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


And we're already at 4.3.1...


------------------------------------------------------------------------

[2003-02-09 15:02:23] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip



------------------------------------------------------------------------

[2002-05-17 11:58:53] mgruetzner at rw3 dot com

If you make the following calls in PHP 4.1.2 on Linux using freetds
0.53 to connect to a MS SQL Server 7 database:

mssql_query ("mystoredproc");
$msg = mssql_get_last_message ();
print $msg;

where "mystoredproc" is a stored procedure that returns N rows of data
and calls the SQL function below to send a warning message:

raiserror ('QueryLimit',9,1)

you would expect the value of $msg to be "QueryLimit" after the call to
mssql_query.  In fact, this is how it works on Windows but not on Linux
using freetds.  I have debugged this issue on both the freetds and php
software and found the following.  On Freetds, the message number that
gets returned from SQL is 50000 which when stored as a 16-bit signed
integer is a negative value in the freetds code, so the freetds code
ignores the message.  I modified the freetds code to NOT ignore
negative message numbers but to go ahead and pass those messages on to
the appropriate callback function in PHP.  That helped matters, but
there was still an issue in the php code in the "sybase_query" function
in php_sybase_db.c.  Basically, what is happening is that in the case
described above, you receive 2 sets of database results as a result of
the query, but the sybase_query function is only reading the first set
of results.  To remedy the problem, I modified the sybase_query
function to save the results of the first call to dbresults().  Then,
after reading all the rows of data from the first set of results, I
checked the result of the first call to dbresults.  If it is not set to
NO_MORE_RESULTS, I call dbresults again to read the second set of
results, which in this case, is the warning message.  By doing so, this
causes the freetds software to recognize the message and callback PHP
with the message.  I have tested these fixes on Linux and they seem to
work find I can email the source code for the fix if you are
interested....



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=17291&edit=1

Reply via email to