[freetds] Weird SP behaviour

ZIGLIO Frediano Frediano.Ziglio at vodafone.com
Fri Jul 4 10:57:25 EDT 2003


 
> Hello there..
> 
> I've been having some very strange problems for the last few 
> days. Let me start by noting that this is the case with 
> freetds 0.61, 0.61.1 and the snapshot as of 2003-07-02.
> 
> First of all, only one procedure behaves in this way. The 
> procedures are being run from a web page, that on each load 
> executes several procedures and commands. All of them work, 
> except for my latest addition. This is a straight forward 
> procedure, that simply looks at it inputs, takes some action 
> and returns 0 on success, or an errorcode otherwise.
> 
> Now.. first of all, I forgot to give the user execute 
> permission on the procedure. This would normally show up as 
> an error and I could recive the error message throught php's 
> mssql_get_last_message(). But in the case of this procedure, 
> no errors at all are returned (I tried triggering other 
> errors, f.x. leaving out required parameters, same thing).
> 
> The worst problem though, is that the parameters I send don't 
> show up correctly at the server end! I checked many times and 
> assured myself that PHP sends these parameters: 1, 0, 'Test 
> string'. SQL profiler revelast that the sp was called (in 
> 0.61 and 0.61.1) with two very high numbers, and the contents 
> of some buffer I've never seen, usually containing 
> "true<controlchar>"  or some random string with null bytes. 
> After upgrading to the snapshot, the parameters changed to 
> 1,1 and the third one simply not passed at all!
> 
> Also.. the procedure was never run, so the changes it should 
> have made didn't come through. I looked at tdsdump and it 
> showed that it was iterating through dbresults several times. 
> The procedure doesn't return any result sets, so I added 
> "select 1" to the top of it. That made the procedure run and 
> the changes were made, but the parameters were still passed 
> as 1,1 although I asked for 1,0,'Test string'.
> 
> In all cases, the connection seems to be dropped after this 
> fiasco, but silently, no error messages show up anywhere, in 
> my script, in tdsdump or in the SQL Server logs.
> 
> I'm simply stumped here and I don't know what to do next. Any ideas?
> 

Can you post procedure source and php code?
I think FreeTDS send, for some reasons, garbage data, so sql server drop
connection... However I don't understand why it doesn't run only for
this procedure... How did you compile php? What library did you use?

freddy77


More information about the FreeTDS mailing list