Skip to Content.
Sympa Menu

freetds - RE: [freetds] Using sp_executesql with Microsoft SQL Server 2000

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Rogers, Tom" <tom.rogers AT ccur.com>
  • To: 'FreeTDS Development Group' <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Using sp_executesql with Microsoft SQL Server 2000
  • Date: Wed, 2 Jul 2003 09:54:48 -0400

So, then will this or won't this work with UnixODBC and the escape query
format?

We are not using FreeTds directly, but are using the UnixODBC interfaces and
code that calls SQLSetParameter, SQLExecute, and uses the "{? = call
myproc(?, ?)}}" syntax. I am not sure of the interaction with UnixODBC, and
FreeTDS, other than that when we built FreeTDS we instructed it that we were
using UnixODBC. I guess if the new RPC stuff is used transparently and
automatically at a low enough level, it would just "start to work" under
UnixODBC, but I don't know if that is the case.

I think you are saying it won't work????

Also, I suspect with MSFT made their change they also changed their ODBC
drivers accordingly.

Thomas Rogers
System Engineer
Concurrent Computer Corporation
> phone: 215.712.7422 x7261


-----Original Message-----
From: Lowden, James K [mailto:LowdenJK AT bernstein.com]
Sent: Wednesday, July 02, 2003 9:46 AM
To: 'FreeTDS Development Group'
Subject: RE: [freetds] Using sp_executesql with Microsoft SQL Server
2000


> From: Rogers, Tom [mailto:tom.rogers AT ccur.com]
> Sent: July 1, 2003 9:04 AM
> To: 'FreeTDS Development Group'
> Subject: RE: [freetds] Using sp_executesql with Microsoft SQL Server
> 2000
>
> Up until about a month ago, we were told by several on this group that
> FreeTDS would not support output parameters on MS SQL because
> of a change
> Microsoft made in the way it handled output params, circa SQL
> 7.0, SPx. At
> that time, they changed the output params such that they were
> being sent
> "out of band" and not part of the normal messages returned
> (or something like that).

Let me try to clarify that. :-)

Nick Castellano discovered that as of SQL Server 7.0 SP3, using TDS 7.0,
Microsoft stopped supporting output parameters embedded in SQL text. If you
sent

declare @a int
exec a @a output

prior to SP3, the server sent a special result set packet. With db-lib, the
application would call dbnumrets() and friends to fetch the output.
Starting with SP3, Microsoft simply ceased sending that special result set
packet; the same application would be told there were no output parameters
returned.

The remedy lay in the RPC protocol, which Frediano had begun to work on for
a different purpose, for placeholder support. In short order we were able
to add the db-lib and ct-lib RPC functions. If they're used, the server
will once again return the data. There are unit tests for both:

src/ctlib/unittests/rpc_ct_param.c
src/ctlib/unittests/rpc_ct_setparam.c
src/dblib/unittests/rpc.c
src/dblib/unittests/t0022.c

Microsoft's own db-lib uses TDS 4.2, which is unaffected. I'm not familiar
enough with the ODBC idiom to know whether or not it has any non-RPC way to
retrieve output parameter values. Perhaps the change affected no Microsoft
customers.

> query = "{? = call mysp(?, ?, ?}"

>From reading the ChangeLog, I doubt you can fetch output parameters that
way
yet, but it looks close.

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that we do not accept account orders and/or
instructions by e-mail, and therefore will not be responsible for carrying
out such orders and/or instructions.


_______________________________________________
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