Skip to Content.
Sympa Menu

freetds - RE: [freetds] Weird SP behaviour

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Arnar Birgisson" <ArnarB AT oddi.is>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Weird SP behaviour
  • Date: Fri, 04 Jul 2003 08:09:31 +0000

Hello..

I'm sorry, apparently this was on me again. Strange though. What I did
to fix this was to free the statement handler prepared before this one,
something that is usually not needed in PHP, where as the program has a
short lifetime (it's a web page). This might be a problem with php, or
freetds. I haven't tried the code on Windows, I don't have the time
right now to write a test case, but I'll definately do that sometime.
This should definately not be a problem, at least if the code from where
the error originates is supposed to be thread-safe.

The biggest problem in my opinion is that nowhere along the way did the
application fail gracefully. Return codes for the binding and execution
of the procedure indicated success, and garbage was sent to SQL server,
which in a production environment could have had severe side effects on
the underlying data. After the connection was dropped, all functions
just silently ran, without any errors or log messages.

Arnar

>>> Frediano.Ziglio AT vodafone.com 4.7.2003 07:57:25 >>>

> 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
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page