Skip to Content.
Sympa Menu

freetds - RE: [freetds] unixODBC via FreeTDS, PHP and Stored Procedure Help

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] unixODBC via FreeTDS, PHP and Stored Procedure Help
  • Date: Thu, 1 Jul 2004 15:06:54 -0400

> From: Joseph Geiser
> Sent: July 1, 2004 1:58 PM
>
> We're running a Linux (Fedora Core 2) server with PHP 4.3.6,
> FreeTDS 0.62.3 (using TDS 7.0) and unixODBC 2.2.8. Up to
> now, we've been running just fine using FreeTDS and the PHP
> "mssql" db calls with direct queries, but no stored procedures.
...
> After installing a fresh server (the one described above), we
> tested FreeTDS and for direct queries, it works just great.
> For Stored Procedures, if the call is written exactly as it
> would be written with TSQL/SQLQA, FreeTDS handles it.
> Straight queries through isql (unixODBC) execute just fine as
> well, but isql is not handling a Stored Procedure call at
> all. In an attempt to code with PHP, it's also failing.

To clarify, the PHP mssql extension uses db-lib, isql uses ODBC, and tsql
uses the TDS layer directly. So, you really can't test the mssql extension
with isql; at least, you're using different client libraries when you do.

We now have a db-lib test facility: bsqldb, first included in 0.62.3. (If
you want a man page, though, get a nightly snapshot.) The attached script
works with bsqldb; I'd be curious to know if isql can process it, too. But:
all it's doing is T-SQL. If you use the -v option, bsqldb will show you that
no parameters are returned as such to the client.

In the old days, Microsoft servers did return output parameter data when a
stored procedure was called with "execute" in a T-SQL batch. Lately they
don't; the application must use the rpc functions instead. We have unit test
that demonstrates how.

That leaves PHP, which I don't use. Unless the mssql extension supports the
db-lib rpc functions -- unless, that is, you see some explicit support for
stored procedures and parameter binding -- you're not going to be able to
fetch output parameters. The workaround is to call a wrapper procedure that
selects the output values, creating a normal resultset.

HTH.

--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.
If you, as the intended recipient of this message, the purpose of which is to
inform and update our clients, prospects and consultants of developments
relating to our services and products, would not like to receive further
e-mail correspondence from the sender, please "reply" to the sender
indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New York,
NY 10105.

Attachment: params.sql
Description: params.sql




Archive powered by MHonArc 2.6.24.

Top of Page