[freetds] Problem with 0.61.2, PHP, MSSQL Server and Stored Procedure

Darryl Friesen, ITS Darryl.Friesen at usask.ca
Mon Sep 8 15:11:59 EDT 2003


Details first:  FreeTDS 0.61.2 on a Solaris 8 box; Apache 2.0.46; PHP 4.3.2.
Database servers are MS SQL Server 7 and 2000 (same problem with both)

I have a PHP script that worked with FreeTDS 0.53 but fails now with 0.61.2.
I'm trying to execute a system stored procedure (sp_columns) to get
information about a table.  mssql_query() seems to be returning a boolean
(TRUE) rather than a result resource, and the call to mssql_fetch_array()
fails (of course).

The result data does appear in the TDS log, so I'm almost inclined to rule
this a PHP bug, but I thought I'd run it past you good folks first.  I'll
attach my TDS dump, and I've included my test script below.

If I can, or need to, provide anymore information, please let me know.  I'm
more than willing.

Thanx,

- Darryl

 ----------------------------------------------------------------------
  Darryl Friesen, B.Sc., Programmer/Analyst    Darryl.Friesen at usask.ca
  Education & Research Technology Services,     http://gollum.usask.ca/
  Information Technology Services Division,
  University of Saskatchewan
 ----------------------------------------------------------------------
  "Go not to the Elves for counsel, for they will say both no and yes"



<?php

putenv('TDSDUMP=/tmp/freetds.dump');
putenv('TDSDUMPCONFIG=/tmp/freetds.config');

$dbh  = mssql_connect('BEDROCK', 'username', 'password');

$sql = "EXECUTE sp_columns @table_name='PTypes'";
print "DEBUG: query is " . $sql . "<br>\n";

$result = mssql_query($sql);
print "DEBUG: result is $result<br>\n";

while ($field = mssql_fetch_array($result))
{
    $field_data[]  = $field;
}

mssql_close($dbh);
?>


Output of the above is:

DEBUG: query is EXECUTE sp_columns @table_name='PTypes'
DEBUG: result is 1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: freetds.dump
Type: application/octet-stream
Size: 49615 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20030908/cd225a8c/freetds-0001.obj


More information about the FreeTDS mailing list